[PATCH] command: test umask support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add testsuite coverage for the previous patch.

* 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@xxxxxxxxxx>
---
 tests/commanddata/test10.log | 1 +
 tests/commanddata/test11.log | 1 +
 tests/commanddata/test12.log | 1 +
 tests/commanddata/test13.log | 1 +
 tests/commanddata/test14.log | 1 +
 tests/commanddata/test15.log | 1 +
 tests/commanddata/test2.log  | 1 +
 tests/commanddata/test20.log | 1 +
 tests/commanddata/test21.log | 1 +
 tests/commanddata/test24.log | 1 +
 tests/commanddata/test3.log  | 1 +
 tests/commanddata/test4.log  | 1 +
 tests/commanddata/test5.log  | 1 +
 tests/commanddata/test6.log  | 1 +
 tests/commanddata/test7.log  | 1 +
 tests/commanddata/test8.log  | 1 +
 tests/commanddata/test9.log  | 1 +
 tests/commandhelper.c        | 3 +++
 tests/commandtest.c          | 3 +++
 19 files changed, 23 insertions(+)

diff --git a/tests/commanddata/test10.log b/tests/commanddata/test10.log
index e1d6092..6b22786 100644
--- a/tests/commanddata/test10.log
+++ b/tests/commanddata/test10.log
@@ -12,3 +12,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test11.log b/tests/commanddata/test11.log
index e1d6092..6b22786 100644
--- a/tests/commanddata/test11.log
+++ b/tests/commanddata/test11.log
@@ -12,3 +12,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test12.log b/tests/commanddata/test12.log
index 1b59206..703e6da 100644
--- a/tests/commanddata/test12.log
+++ b/tests/commanddata/test12.log
@@ -10,3 +10,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test13.log b/tests/commanddata/test13.log
index 1b59206..703e6da 100644
--- a/tests/commanddata/test13.log
+++ b/tests/commanddata/test13.log
@@ -10,3 +10,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test14.log b/tests/commanddata/test14.log
index 1b59206..703e6da 100644
--- a/tests/commanddata/test14.log
+++ b/tests/commanddata/test14.log
@@ -10,3 +10,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test15.log b/tests/commanddata/test15.log
index f439a85..edb2fc3 100644
--- a/tests/commanddata/test15.log
+++ b/tests/commanddata/test15.log
@@ -10,3 +10,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:.../commanddata
+UMASK:0002
diff --git a/tests/commanddata/test2.log b/tests/commanddata/test2.log
index 1b59206..703e6da 100644
--- a/tests/commanddata/test2.log
+++ b/tests/commanddata/test2.log
@@ -10,3 +10,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test20.log b/tests/commanddata/test20.log
index 7d48121..a0475e6 100644
--- a/tests/commanddata/test20.log
+++ b/tests/commanddata/test20.log
@@ -11,3 +11,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test21.log b/tests/commanddata/test21.log
index 1b59206..703e6da 100644
--- a/tests/commanddata/test21.log
+++ b/tests/commanddata/test21.log
@@ -10,3 +10,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test24.log b/tests/commanddata/test24.log
index 8670952..38cbb54 100644
--- a/tests/commanddata/test24.log
+++ b/tests/commanddata/test24.log
@@ -5,3 +5,4 @@ FD:3
 FD:4
 DAEMON:yes
 CWD:/
+UMASK:0022
diff --git a/tests/commanddata/test3.log b/tests/commanddata/test3.log
index c6da253..f44400b 100644
--- a/tests/commanddata/test3.log
+++ b/tests/commanddata/test3.log
@@ -12,3 +12,4 @@ FD:5
 FD:7
 DAEMON:no
 CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test4.log b/tests/commanddata/test4.log
index 1876685..6cd2095 100644
--- a/tests/commanddata/test4.log
+++ b/tests/commanddata/test4.log
@@ -10,3 +10,4 @@ FD:1
 FD:2
 DAEMON:yes
 CWD:/
+UMASK:0022
diff --git a/tests/commanddata/test5.log b/tests/commanddata/test5.log
index f745c3f..f801dca 100644
--- a/tests/commanddata/test5.log
+++ b/tests/commanddata/test5.log
@@ -8,3 +8,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test6.log b/tests/commanddata/test6.log
index 5394428..1476995 100644
--- a/tests/commanddata/test6.log
+++ b/tests/commanddata/test6.log
@@ -4,3 +4,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test7.log b/tests/commanddata/test7.log
index cdfe445..e30efe7 100644
--- a/tests/commanddata/test7.log
+++ b/tests/commanddata/test7.log
@@ -9,3 +9,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test8.log b/tests/commanddata/test8.log
index 87874fd..897bf6e 100644
--- a/tests/commanddata/test8.log
+++ b/tests/commanddata/test8.log
@@ -5,3 +5,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test9.log b/tests/commanddata/test9.log
index 3a93c19..e9e1611 100644
--- a/tests/commanddata/test9.log
+++ b/tests/commanddata/test9.log
@@ -18,3 +18,4 @@ FD:1
 FD:2
 DAEMON:no
 CWD:/tmp
+UMASK:0022
diff --git a/tests/commandhelper.c b/tests/commandhelper.c
index 796b89d..03fe506 100644
--- a/tests/commandhelper.c
+++ b/tests/commandhelper.c
@@ -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")) {
diff --git a/tests/commandtest.c b/tests/commandtest.c
index 5f52a00..6400ea2 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -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());

-- 
1.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]