]> xenbits.xensource.com Git - libvirt.git/commitdiff
command: test umask support
authorEric Blake <eblake@redhat.com>
Wed, 3 Sep 2014 15:13:21 +0000 (09:13 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 3 Sep 2014 15:36:13 +0000 (09:36 -0600)
Add testsuite coverage for the recent commit 0e1a1a8.

* tests/commandhelper.c (main): Output umask.
* tests/commandtest.c (test15): Also test umask.
(mymain): Add test.
* tests/commanddata/*.log: Update expected output.

Signed-off-by: Eric Blake <eblake@redhat.com>
19 files changed:
tests/commanddata/test10.log
tests/commanddata/test11.log
tests/commanddata/test12.log
tests/commanddata/test13.log
tests/commanddata/test14.log
tests/commanddata/test15.log
tests/commanddata/test2.log
tests/commanddata/test20.log
tests/commanddata/test21.log
tests/commanddata/test24.log
tests/commanddata/test3.log
tests/commanddata/test4.log
tests/commanddata/test5.log
tests/commanddata/test6.log
tests/commanddata/test7.log
tests/commanddata/test8.log
tests/commanddata/test9.log
tests/commandhelper.c
tests/commandtest.c

index e1d60927d1a82c4635b3a97e17cbc7a2bb77d511..6b22786532e2d0df2e0e6667cd9eaefdc3dabdad 100644 (file)
@@ -12,3 +12,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
index e1d60927d1a82c4635b3a97e17cbc7a2bb77d511..6b22786532e2d0df2e0e6667cd9eaefdc3dabdad 100644 (file)
@@ -12,3 +12,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
index 1b592063525a605cc4a38de41060d53e05c61ea0..703e6dae91f2da575a3157577e08370afc001566 100644 (file)
@@ -10,3 +10,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
index 1b592063525a605cc4a38de41060d53e05c61ea0..703e6dae91f2da575a3157577e08370afc001566 100644 (file)
@@ -10,3 +10,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
index 1b592063525a605cc4a38de41060d53e05c61ea0..703e6dae91f2da575a3157577e08370afc001566 100644 (file)
@@ -10,3 +10,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
index f439a85dfd8cdd4357b318b5d6dd208e54a2b08f..edb2fc3fac48098ce985f56aac27d976f205f11a 100644 (file)
@@ -10,3 +10,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:.../commanddata
+UMASK:0002
index 1b592063525a605cc4a38de41060d53e05c61ea0..703e6dae91f2da575a3157577e08370afc001566 100644 (file)
@@ -10,3 +10,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
index 7d48121f309a91e69bec27d4f87278af7ca3fa1c..a0475e6f4ecad9a3be695172c3b598888e09ffe5 100644 (file)
@@ -11,3 +11,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
index 1b592063525a605cc4a38de41060d53e05c61ea0..703e6dae91f2da575a3157577e08370afc001566 100644 (file)
@@ -10,3 +10,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
index 8670952cadca2cbae82c17f7719691982225f305..38cbb5451b3aa7220f2bdb3bbadc364b88db2d43 100644 (file)
@@ -5,3 +5,4 @@ FD:3
 FD:4
 DAEMON:yes
 CWD:/
+UMASK:0022
index c6da25345c9e7122c5d2208e4872e61a1030759c..f44400bc82b0995c84b2e6b1eb9dfd4b799ad6eb 100644 (file)
@@ -12,3 +12,4 @@ FD:5
 FD:7
 DAEMON:no
 CWD:/tmp
+UMASK:0022
index 1876685a687ac173e06d647b88a6f52e20b51e50..6cd20959d340cf5b62926736445a3dd685b49d75 100644 (file)
@@ -10,3 +10,4 @@ FD:1
 FD:2
 DAEMON:yes
 CWD:/
+UMASK:0022
index f745c3f5589d63da38b42bd7e6fa01df23dca935..f801dca886375f3a67d4890504baa73a7ba30741 100644 (file)
@@ -8,3 +8,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
index 5394428162ebde1b2b662099ce39379a58a92f73..1476995794d961f3399b75437be89d098fb280cc 100644 (file)
@@ -4,3 +4,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
index cdfe445e3b7982abee89094c471a1df7476497de..e30efe7b6cfa2cc417c87a47e031fa4177ab9f34 100644 (file)
@@ -9,3 +9,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
index 87874fde0ab7ccd2acb2ce25131826a48d045e94..897bf6e5b9164a9bc4fc5bf7038d6e7389dc3c09 100644 (file)
@@ -5,3 +5,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
index 3a93c19ea43861a06e28d265794b328c3394a38c..e9e161152899df8068f9c9706dcbc61126db1641 100644 (file)
@@ -18,3 +18,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
index 796b89d8b03d8d35a62b6da12bd02ec54ee7a992..03fe50625a33982555d3e568cdc7b4cf1e657821 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <string.h>
+#include <sys/stat.h>
 
 #include "internal.h"
 #include "virutil.h"
@@ -121,6 +122,8 @@ int main(int argc, char **argv) {
     fprintf(log, "CWD:%s\n", cwd);
     VIR_FREE(cwd);
 
+    fprintf(log, "UMASK:%04o\n", umask(0));
+
     VIR_FORCE_FCLOSE(log);
 
     if (argc > 1 && STREQ(argv[1], "--close-stdin")) {
index 5f52a0085d0fad5482f5fc0a57201919158b339c..6400ea283f8a16f8efd1c03c3699494aff07835d 100644 (file)
@@ -617,6 +617,7 @@ static int test15(const void *unused ATTRIBUTE_UNUSED)
     if (virAsprintf(&cwd, "%s/commanddata", abs_srcdir) < 0)
         goto cleanup;
     virCommandSetWorkingDirectory(cmd, cwd);
+    virCommandSetUmask(cmd, 002);
 
     if (virCommandRun(cmd, NULL) < 0) {
         virErrorPtr err = virGetLastError();
@@ -1133,6 +1134,8 @@ mymain(void)
     if (chdir("/tmp") < 0)
         return EXIT_FAILURE;
 
+    umask(022);
+
     setpgid(0, 0);
     ignore_value(setsid());