Source

SCons / test / Chmod.py

Diff from to

test/Chmod.py

 env.Command('f7.out', 'f7.in', [Cat,
                                 Chmod('Chmod-$SOURCE', 0666),
                                 Chmod('${TARGET}-Chmod', 0666)])
+
+# Make sure Chmod works with a list of arguments
+env = Environment(FILE = 'f9')
+env.Command('f8.out', 'f8.in', [Chmod(['$FILE', File('f10')], 0666), Cat])
+Execute(Chmod(['d11', Dir('d12')], 0777))
 """)
 
 test.write('f1', "f1\n")
 test.write('f7.in', "f7.in\n")
 test.write('Chmod-f7.in', "Chmod-f7.in\n")
 test.write('f7.out-Chmod', "f7.out-Chmod\n")
+test.write('f8.in', "f8.in\n")
+test.write('f9', "f9\n")
+test.write('f10', "f10\n")
+test.subdir('d11')
+test.subdir('d12')
 
 os.chmod(test.workpath('f1'), 0444)
 os.chmod(test.workpath('f1-File'), 0444)
 os.chmod(test.workpath('f5'), 0444)
 os.chmod(test.workpath('Chmod-f7.in'), 0444)
 os.chmod(test.workpath('f7.out-Chmod'), 0444)
+os.chmod(test.workpath('f9'), 0444)
+os.chmod(test.workpath('f10'), 0444)
+os.chmod(test.workpath('d11'), 0555)
+os.chmod(test.workpath('d12'), 0555)
 
 expect = test.wrap_stdout(read_str = """\
 Chmod("f1", 0666)
 Chmod("f1-File", 0666)
 Chmod("d2", 0777)
 Chmod("d2-Dir", 0777)
+Chmod(["d11", "d12"], 0777)
 """,
                           build_str = """\
 cat(["bar.out"], ["bar.in"])
 cat(["f7.out"], ["f7.in"])
 Chmod("Chmod-f7.in", 0666)
 Chmod("f7.out-Chmod", 0666)
+Chmod(["f9", "f10"], 0666)
+cat(["f8.out"], ["f8.in"])
 """)
 test.run(options = '-n', arguments = '.', stdout = expect)
 
 test.fail_test(s != 0444)
 s = stat.S_IMODE(os.stat(test.workpath('f7.out-Chmod'))[stat.ST_MODE])
 test.fail_test(s != 0444)
+test.must_not_exist('f8.out')
+s = stat.S_IMODE(os.stat(test.workpath('f9'))[stat.ST_MODE])
+test.fail_test(s != 0444)
+s = stat.S_IMODE(os.stat(test.workpath('f10'))[stat.ST_MODE])
+test.fail_test(s != 0444)
+s = stat.S_IMODE(os.stat(test.workpath('d11'))[stat.ST_MODE])
+test.fail_test(s != 0555)
+s = stat.S_IMODE(os.stat(test.workpath('d12'))[stat.ST_MODE])
+test.fail_test(s != 0555)
 
 test.run()
 
 test.fail_test(s != 0666)
 s = stat.S_IMODE(os.stat(test.workpath('f7.out-Chmod'))[stat.ST_MODE])
 test.fail_test(s != 0666)
+test.must_match('f8.out', "f8.in\n")
+s = stat.S_IMODE(os.stat(test.workpath('f9'))[stat.ST_MODE])
+test.fail_test(s != 0666)
+s = stat.S_IMODE(os.stat(test.workpath('f10'))[stat.ST_MODE])
+test.fail_test(s != 0666)
+s = stat.S_IMODE(os.stat(test.workpath('d11'))[stat.ST_MODE])
+test.fail_test(s != 0777)
+s = stat.S_IMODE(os.stat(test.workpath('d12'))[stat.ST_MODE])
+test.fail_test(s != 0777)
 
 test.pass_test()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.