summaryrefslogtreecommitdiffstats
path: root/test/CacheDir
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-03-12 22:24:00 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2017-03-12 22:24:00 (GMT)
commit1e010cb43dabeda08a5882f4f93969d217c8eecc (patch)
treecc5cb79b00e1a99b7f76753dac3af02431fb00d6 /test/CacheDir
parent80691453682f5af7fc863b9a6b7e790005bbb562 (diff)
downloadSCons-1e010cb43dabeda08a5882f4f93969d217c8eecc.zip
SCons-1e010cb43dabeda08a5882f4f93969d217c8eecc.tar.gz
SCons-1e010cb43dabeda08a5882f4f93969d217c8eecc.tar.bz2
py2/3 fixes. mostly mode=r on must_match. Also skip the symlink test on windows because os.symlink exists on py3 (didn't in py2), but requires permissions to work on windows which aren't default
Diffstat (limited to 'test/CacheDir')
-rw-r--r--test/CacheDir/CacheDir.py10
-rw-r--r--test/CacheDir/SideEffect.py6
-rw-r--r--test/CacheDir/VariantDir.py10
-rw-r--r--test/CacheDir/environment.py14
-rw-r--r--test/CacheDir/option--cd.py14
-rw-r--r--test/CacheDir/option--cf.py7
-rw-r--r--test/CacheDir/option--cr.py14
-rw-r--r--test/CacheDir/option--cs.py6
-rw-r--r--test/CacheDir/symlink.py10
9 files changed, 49 insertions, 42 deletions
diff --git a/test/CacheDir/CacheDir.py b/test/CacheDir/CacheDir.py
index fe73cad..45c5db5 100644
--- a/test/CacheDir/CacheDir.py
+++ b/test/CacheDir/CacheDir.py
@@ -89,8 +89,8 @@ test.fail_test(os.listdir(cache) != ['config'])
# This should populate the cache with our derived files.
test.run(chdir = 'src', arguments = '.')
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
-test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
+test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -130,7 +130,7 @@ test.must_not_exist(src_all)
# even though it doesn't report anything.
test.run(chdir = 'src', arguments = '-s .', stdout = "")
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
test.must_not_exist(src_cat_out)
test.up_to_date(chdir = 'src', arguments = '.')
@@ -148,8 +148,8 @@ Retrieved `ccc.out' from cache
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
"""))
-test.must_match(['src', 'all'], "aaa.in\nbbb.in 2\nccc.in\n")
-test.must_match(['src', 'cat.out'], "bbb.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in 2\nccc.in\n", mode='r')
+test.must_match(['src', 'cat.out'], "bbb.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
diff --git a/test/CacheDir/SideEffect.py b/test/CacheDir/SideEffect.py
index 386b16a..2ddba31 100644
--- a/test/CacheDir/SideEffect.py
+++ b/test/CacheDir/SideEffect.py
@@ -69,7 +69,7 @@ f1.in -> f1.out
f2.in -> f2.out
"""
-test.must_match(['work', 'log.txt'], expect)
+test.must_match(['work', 'log.txt'], expect, mode='r')
@@ -84,7 +84,7 @@ f2.in -> f2.out
f3.in -> f3.out
"""
-test.must_match(['work', 'log.txt'], expect)
+test.must_match(['work', 'log.txt'], expect, mode='r')
@@ -100,7 +100,7 @@ f3.in -> f3.out
f1.in -> f1.out
"""
-test.must_match(['work', 'log.txt'], expect)
+test.must_match(['work', 'log.txt'], expect, mode='r')
diff --git a/test/CacheDir/VariantDir.py b/test/CacheDir/VariantDir.py
index 30325d2..d31b9ed 100644
--- a/test/CacheDir/VariantDir.py
+++ b/test/CacheDir/VariantDir.py
@@ -75,8 +75,8 @@ SConscript('build/SConscript')
# This should populate the cache with our derived files.
test.run()
-test.must_match(['build', 'all'], "aaa.in\nbbb.in\nccc.in\n")
-test.must_match('cat.out', "%s\n%s\n%s\n%s\n" % (build_aaa_out, build_bbb_out, build_ccc_out, build_all))
+test.must_match(['build', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
+test.must_match('cat.out', "%s\n%s\n%s\n%s\n" % (build_aaa_out, build_bbb_out, build_ccc_out, build_all), mode='r')
test.up_to_date(arguments = '.')
@@ -116,7 +116,7 @@ test.must_not_exist(test.workpath('build', 'all'))
# even though it doesn't report anything.
test.run(arguments = '-s .', stdout = "")
-test.must_match(['build', 'all'], "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['build', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
test.must_not_exist(cat_out)
test.up_to_date(arguments = '.')
@@ -137,8 +137,8 @@ cat(["%s"], ["%s", "%s", "%s"])
build_ccc_out,
build_all, build_aaa_out, build_bbb_out, build_ccc_out)))
-test.must_match(['build', 'all'], "aaa.in\nbbb.in 2\nccc.in\n")
-test.must_match('cat.out', "%s\n%s\n" % (build_bbb_out, build_all))
+test.must_match(['build', 'all'], "aaa.in\nbbb.in 2\nccc.in\n", mode='r')
+test.must_match('cat.out', "%s\n%s\n" % (build_bbb_out, build_all), mode='r')
test.up_to_date(arguments = '.')
diff --git a/test/CacheDir/environment.py b/test/CacheDir/environment.py
index eb28c19..e37b999 100644
--- a/test/CacheDir/environment.py
+++ b/test/CacheDir/environment.py
@@ -92,8 +92,8 @@ test.fail_test(os.listdir(cache) != ['config'])
# This should populate the cache with our derived files.
test.run(chdir = 'src', arguments = '.')
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
-test.must_match(src_cat_out, "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
+test.must_match(src_cat_out, "aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -109,7 +109,7 @@ Retrieved `ccc.out' from cache
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
"""))
-test.must_match(src_cat_out, "bbb.out\nall\n")
+test.must_match(src_cat_out, "bbb.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -134,9 +134,9 @@ test.must_not_exist(src_all)
# even though it doesn't report anything.
test.run(chdir = 'src', arguments = '-s .', stdout = "")
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
-test.must_match(src_cat_out, "bbb.out\nall\n")
+test.must_match(src_cat_out, "bbb.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -154,8 +154,8 @@ Retrieved `ccc.out' from cache
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
"""))
-test.must_match(['src', 'all'], "aaa.in\nbbb.in 2\nccc.in\n")
-test.must_match(src_cat_out, "bbb.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in 2\nccc.in\n", mode='r')
+test.must_match(src_cat_out, "bbb.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
diff --git a/test/CacheDir/option--cd.py b/test/CacheDir/option--cd.py
index efcf843..fad5add 100644
--- a/test/CacheDir/option--cd.py
+++ b/test/CacheDir/option--cd.py
@@ -62,8 +62,8 @@ test.write(['src', 'ccc.in'], "ccc.in\n")
# This should populate the cache with our derived files.
test.run(chdir = 'src', arguments = '.')
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
-test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
+test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -79,7 +79,7 @@ Retrieved `ccc.out' from cache
Retrieved `all' from cache
"""))
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
test.must_not_exist(test.workpath('src', 'cat.out'))
test.up_to_date(chdir = 'src', arguments = '.')
@@ -97,8 +97,8 @@ cat(["ccc.out"], ["ccc.in"])
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
"""))
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
-test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
+test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -116,8 +116,8 @@ cat(["ccc.out"], ["ccc.in"])
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
"""))
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
-test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
+test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
diff --git a/test/CacheDir/option--cf.py b/test/CacheDir/option--cf.py
index ace0df6..bb9d1cc 100644
--- a/test/CacheDir/option--cf.py
+++ b/test/CacheDir/option--cf.py
@@ -38,6 +38,7 @@ test = TestSCons.TestSCons()
test.subdir('cache', 'src')
test.write(['src', 'SConstruct'], """
+DefaultEnvironment(tools=[])
def cat(env, source, target):
target = str(target[0])
open('cat.out', 'a').write(target + "\\n")
@@ -61,8 +62,10 @@ test.write(['src', 'ccc.in'], "ccc.in\n")
# This should populate the cache with our derived files.
test.run(chdir = 'src', arguments = '.')
-test.fail_test(test.read(['src', 'all']) != "aaa.in\nbbb.in\nccc.in\n")
-test.fail_test(test.read(['src', 'cat.out']) != "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src','all'],"aaa.in\nbbb.in\nccc.in\n", mode='r')
+# test.fail_test(test.read(['src', 'all']) != "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['src','cat.out'],"aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
+# test.fail_test(test.read(['src', 'cat.out']) != "aaa.out\nbbb.out\nccc.out\nall\n")
test.up_to_date(chdir = 'src', arguments = '.')
diff --git a/test/CacheDir/option--cr.py b/test/CacheDir/option--cr.py
index 165e049..792dede 100644
--- a/test/CacheDir/option--cr.py
+++ b/test/CacheDir/option--cr.py
@@ -62,8 +62,8 @@ test.write(['src', 'ccc.in'], "ccc.in\n")
# This should populate the cache with our derived files.
test.run(chdir = 'src', arguments = '.')
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
-test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
+test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -80,7 +80,7 @@ Retrieved `ccc.out' from cache
Retrieved `all' from cache
"""))
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
test.must_not_exist(test.workpath('src', 'cat.out'))
test.up_to_date(chdir = 'src', arguments = '.')
@@ -100,9 +100,9 @@ Retrieved `ccc.out' from cache
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
"""))
-test.must_match(['src', 'all'], "aaa.rebuild\nbbb.in\nccc.in\n")
+test.must_match(['src', 'all'], "aaa.rebuild\nbbb.in\nccc.in\n", mode='r')
# cat.out contains only the things we built (not got from cache)
-test.must_match(['src', 'cat.out'], "aaa.out\nall\n")
+test.must_match(['src', 'cat.out'], "aaa.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -120,8 +120,8 @@ Retrieved `ccc.out' from cache
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
"""))
-test.must_match(['src', 'all'], "aaa.rebuild\nbbb.in\nccc.in\n")
-test.must_match(['src', 'cat.out'], "aaa.out\nall\n")
+test.must_match(['src', 'all'], "aaa.rebuild\nbbb.in\nccc.in\n", mode='r')
+test.must_match(['src', 'cat.out'], "aaa.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
diff --git a/test/CacheDir/option--cs.py b/test/CacheDir/option--cs.py
index bff585d..2e37e5a 100644
--- a/test/CacheDir/option--cs.py
+++ b/test/CacheDir/option--cs.py
@@ -79,9 +79,9 @@ test.write(['src1', 'ccc.in'], "ccc.in\n")
# This should populate the cache with our derived files.
test.run(chdir = 'src1', arguments = '.')
-test.must_match(['src1', 'all'], "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['src1', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
-test.must_match(['src1', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src1', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
test.up_to_date(chdir = 'src1', arguments = '.')
@@ -145,7 +145,7 @@ test.run(chdir = 'src1',
arguments = '--cache-show -s .',
stdout = "")
-test.must_match(['src1', 'all'], "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['src1', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
test.must_not_exist(test.workpath('src1', 'cat.out'))
#
diff --git a/test/CacheDir/symlink.py b/test/CacheDir/symlink.py
index ca3bbe2..e23c25e 100644
--- a/test/CacheDir/symlink.py
+++ b/test/CacheDir/symlink.py
@@ -21,6 +21,10 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
+import os
+import sys
+
+import TestSCons
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -29,13 +33,13 @@ Verify that we push and retrieve a built symlink to/from a CacheDir()
as an actualy symlink, not by copying the file contents.
"""
-import os
-import TestSCons
+
test = TestSCons.TestSCons()
-if not hasattr(os, 'symlink'):
+if not hasattr(os, 'symlink') or sys.platform == 'win32':
+ # Skip test on windows as well, because this requires permissions which aren't default
import sys
test.skip_test('%s has no os.symlink() method; skipping test\n' % sys.executable)