summaryrefslogtreecommitdiff
path: root/test cases/common
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-01-14 14:41:18 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-01-24 00:20:51 +0530
commit7d6f628ed4c3c3dca32bef01b2581f2e9bcde189 (patch)
tree995cb632db1f11e94209bfc18205f7c8e81f52f2 /test cases/common
parent905ff356118d3317aa1922bbfee3dd4c3cb71a6f (diff)
downloadmeson-7d6f628ed4c3c3dca32bef01b2581f2e9bcde189.tar.gz
Support file perms for install_data and install_subdir
With the 'install_mode' kwarg, you can now specify the file and directory permissions and the owner and the group to be used while installing. You can pass either: * A single string specifying just the permissions * A list of strings with: - The first argument a string of permissions - The second argument a string specifying the owner or an int specifying the uid - The third argument a string specifying the group or an int specifying the gid Specifying `false` as any of the arguments skips setting that one. The format of the permissions kwarg is the same as the symbolic notation used by ls -l with the first character that specifies 'd', '-', 'c', etc for the file type omitted since that is always obvious from the context. Includes unit tests for the same. Sadly these only run on Linux right now, but we want them to run on all platforms. We do set the mode in the integration tests for all platforms but we don't check if they were actually set correctly.
Diffstat (limited to 'test cases/common')
-rw-r--r--test cases/common/12 data/installed_files.txt1
-rw-r--r--test cases/common/12 data/meson.build11
-rw-r--r--test cases/common/12 data/runscript.sh3
-rw-r--r--test cases/common/66 install subdir/meson.build4
-rw-r--r--test cases/common/66 install subdir/subdir/meson.build4
5 files changed, 19 insertions, 4 deletions
diff --git a/test cases/common/12 data/installed_files.txt b/test cases/common/12 data/installed_files.txt
index 8651e3a59..af1a7353f 100644
--- a/test cases/common/12 data/installed_files.txt
+++ b/test cases/common/12 data/installed_files.txt
@@ -3,3 +3,4 @@ usr/share/progname/fileobject_datafile.dat
usr/share/progname/vanishing.dat
usr/share/progname/vanishing2.dat
etc/etcfile.dat
+usr/bin/runscript.sh
diff --git a/test cases/common/12 data/meson.build b/test cases/common/12 data/meson.build
index 7494abcb4..d3407d112 100644
--- a/test cases/common/12 data/meson.build
+++ b/test cases/common/12 data/meson.build
@@ -1,7 +1,14 @@
project('data install test', 'c')
install_data(sources : 'datafile.dat', install_dir : 'share/progname')
-install_data(sources : 'etcfile.dat', install_dir : '/etc')
-install_data(files('fileobject_datafile.dat'), install_dir : 'share/progname')
+# Some file in /etc that is only read-write by root; add a sticky bit for testing
+install_data(sources : 'etcfile.dat', install_dir : '/etc', install_mode : 'rw------T')
+# Some script that needs to be executable by the group
+install_data('runscript.sh',
+ install_dir : get_option('bindir'),
+ install_mode : ['rwxr-sr-x', 'root', 0])
+install_data(files('fileobject_datafile.dat'),
+ install_dir : 'share/progname',
+ install_mode : [false, false, 0])
subdir('vanishing')
diff --git a/test cases/common/12 data/runscript.sh b/test cases/common/12 data/runscript.sh
new file mode 100644
index 000000000..8bc5ca6ce
--- /dev/null
+++ b/test cases/common/12 data/runscript.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo "Runscript"
diff --git a/test cases/common/66 install subdir/meson.build b/test cases/common/66 install subdir/meson.build
index 669cf09a8..fed2f8909 100644
--- a/test cases/common/66 install subdir/meson.build
+++ b/test cases/common/66 install subdir/meson.build
@@ -1,5 +1,7 @@
project('install a whole subdir', 'c')
subdir('subdir')
-install_subdir('sub1', install_dir : 'share')
+# A subdir with write perms only for the owner
+# and read-list perms for owner and group
+install_subdir('sub1', install_dir : 'share', install_mode : ['rwxr-x--t', 'root'])
install_subdir('sub/sub1', install_dir : 'share')
diff --git a/test cases/common/66 install subdir/subdir/meson.build b/test cases/common/66 install subdir/subdir/meson.build
index 08b417d2b..37d2da455 100644
--- a/test cases/common/66 install subdir/subdir/meson.build
+++ b/test cases/common/66 install subdir/subdir/meson.build
@@ -1 +1,3 @@
-install_subdir('sub1', install_dir : 'share')
+install_subdir('sub1', install_dir : 'share',
+ # This mode will be overriden by the mode set in the outer install_subdir
+ install_mode : 'rwxr-x---')