summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/BuildDir.py33
-rw-r--r--test/SHCCFLAGS.py42
-rw-r--r--test/TAR.py4
-rw-r--r--test/TARFLAGS.py2
-rw-r--r--test/option--U.py10
-rw-r--r--test/option-v.py17
6 files changed, 61 insertions, 47 deletions
diff --git a/test/BuildDir.py b/test/BuildDir.py
index 14c24e2..a283ac7 100644
--- a/test/BuildDir.py
+++ b/test/BuildDir.py
@@ -36,6 +36,11 @@ else:
test = TestSCons.TestSCons()
+test.write('SConstruct', "print Environment()['F77']\n")
+test.run()
+f77 = test.where_is(test.stdout()[:-1])
+test.unlink('SConstruct')
+
foo11 = test.workpath('test', 'build', 'var1', 'foo1' + _exe)
foo12 = test.workpath('test', 'build', 'var1', 'foo2' + _exe)
foo21 = test.workpath('test', 'build', 'var2', 'foo1' + _exe)
@@ -105,9 +110,10 @@ env.Command(target='f2.c', source='f2.in', action=buildIt)
env.Program(target='foo2', source='f2.c')
env.Program(target='foo1', source='f1.c')
-env.Command(target='b2.f', source='b2.in', action=buildIt)
-env.Copy(LIBS = 'g2c').Program(target='bar2', source='b2.f')
-env.Copy(LIBS = 'g2c').Program(target='bar1', source='b1.f')
+if WhereIs(env['F77']):
+ env.Command(target='b2.f', source='b2.in', action=buildIt)
+ env.Copy(LIBS = 'g2c').Program(target='bar2', source='b2.f')
+ env.Copy(LIBS = 'g2c').Program(target='bar1', source='b1.f')
""")
test.write('test/src/f1.c', r"""
@@ -177,16 +183,17 @@ test.run(program = foo42, stdout = "f2.c\n")
test.run(program = foo51, stdout = "f1.c\n")
test.run(program = foo52, stdout = "f2.c\n")
-test.run(program = bar11, stdout = " b1.for\n")
-test.run(program = bar12, stdout = " b2.for\n")
-test.run(program = bar21, stdout = " b1.for\n")
-test.run(program = bar22, stdout = " b2.for\n")
-test.run(program = bar31, stdout = " b1.for\n")
-test.run(program = bar32, stdout = " b2.for\n")
-test.run(program = bar41, stdout = " b1.for\n")
-test.run(program = bar42, stdout = " b2.for\n")
-test.run(program = bar51, stdout = " b1.for\n")
-test.run(program = bar52, stdout = " b2.for\n")
+if f77:
+ test.run(program = bar11, stdout = " b1.for\n")
+ test.run(program = bar12, stdout = " b2.for\n")
+ test.run(program = bar21, stdout = " b1.for\n")
+ test.run(program = bar22, stdout = " b2.for\n")
+ test.run(program = bar31, stdout = " b1.for\n")
+ test.run(program = bar32, stdout = " b2.for\n")
+ test.run(program = bar41, stdout = " b1.for\n")
+ test.run(program = bar42, stdout = " b2.for\n")
+ test.run(program = bar51, stdout = " b1.for\n")
+ test.run(program = bar52, stdout = " b2.for\n")
# Make sure we didn't duplicate the source files in build/var3.
test.fail_test(os.path.exists(test.workpath('test', 'build', 'var3', 'f1.c')))
diff --git a/test/SHCCFLAGS.py b/test/SHCCFLAGS.py
index 8b5a984..32b3838 100644
--- a/test/SHCCFLAGS.py
+++ b/test/SHCCFLAGS.py
@@ -29,11 +29,9 @@ import TestSCons
import os
if sys.platform == 'win32':
- _obj = '.obj'
fooflags = '/nologo -DFOO'
barflags = '/nologo -DBAR'
else:
- _obj = '.o'
fooflags = '-DFOO'
barflags = '-DBAR'
@@ -45,19 +43,21 @@ test = TestSCons.TestSCons()
test.write('SConstruct', """
foo = Environment(SHCCFLAGS = '%s', WIN32_INSERT_DEF=1)
bar = Environment(SHCCFLAGS = '%s', WIN32_INSERT_DEF=1)
-foo.SharedObject(target = 'foo%s', source = 'prog.c')
-bar.SharedObject(target = 'bar%s', source = 'prog.c')
-foo.SharedLibrary(target = 'foo', source = 'foo%s')
-bar.SharedLibrary(target = 'bar', source = 'bar%s')
+
+foo_obj = foo.SharedObject(target = 'foo', source = 'prog.c')
+foo.SharedLibrary(target = 'foo', source = foo_obj)
+
+bar_obj = bar.SharedObject(target = 'bar', source = 'prog.c')
+bar.SharedLibrary(target = 'bar', source = bar_obj)
fooMain = foo.Copy(LIBS='foo', LIBPATH='.')
-foo_obj = fooMain.Object(target='foomain', source='main.c')
-fooMain.Program(target='fooprog', source=foo_obj)
+foomain_obj = fooMain.Object(target='foomain', source='main.c')
+fooMain.Program(target='fooprog', source=foomain_obj)
barMain = bar.Copy(LIBS='bar', LIBPATH='.')
-bar_obj = barMain.Object(target='barmain', source='main.c')
-barMain.Program(target='barprog', source=bar_obj)
-""" % (fooflags, barflags, _obj, _obj, _obj, _obj))
+barmain_obj = barMain.Object(target='barmain', source='main.c')
+barMain.Program(target='barprog', source=barmain_obj)
+""" % (fooflags, barflags))
test.write('foo.def', r"""
LIBRARY "foo"
@@ -107,17 +107,19 @@ test.run(program = test.workpath('barprog'), stdout = "prog.c: BAR\n")
test.write('SConstruct', """
bar = Environment(SHCCFLAGS = '%s', WIN32_INSERT_DEF=1)
-bar.SharedObject(target = 'foo%s', source = 'prog.c')
-bar.SharedObject(target = 'bar%s', source = 'prog.c')
-bar.SharedLibrary(target = 'foo', source = 'foo%s')
-bar.SharedLibrary(target = 'bar', source = 'bar%s')
+
+foo_obj = bar.SharedObject(target = 'foo', source = 'prog.c')
+bar.SharedLibrary(target = 'foo', source = foo_obj)
+
+bar_obj = bar.SharedObject(target = 'bar', source = 'prog.c')
+bar.SharedLibrary(target = 'bar', source = bar_obj)
barMain = bar.Copy(LIBS='bar', LIBPATH='.')
-foo_obj = barMain.Object(target='foomain', source='main.c')
-bar_obj = barMain.Object(target='barmain', source='main.c')
-barMain.Program(target='barprog', source=foo_obj)
-barMain.Program(target='fooprog', source=bar_obj)
-""" % (barflags, _obj, _obj, _obj, _obj))
+foomain_obj = barMain.Object(target='foomain', source='main.c')
+barmain_obj = barMain.Object(target='barmain', source='main.c')
+barMain.Program(target='barprog', source=foomain_obj)
+barMain.Program(target='fooprog', source=barmain_obj)
+""" % (barflags))
test.run(arguments = '.')
diff --git a/test/TAR.py b/test/TAR.py
index 0327ca9..0d6f857 100644
--- a/test/TAR.py
+++ b/test/TAR.py
@@ -123,10 +123,10 @@ bar.Tar(target = 'bar.tar', source = 'file15')
test.fail_test(not os.path.exists(test.workpath('bar.tar')))
- test.run(program = tar, arguments = "-t -f foo.tar")
+ test.run(program = tar, arguments = "-t -f foo.tar", stderr = None)
test.fail_test(test.stdout() != "file10\nfile11\nfile12\n")
- test.run(program = tar, arguments = "-t -f bar.tar")
+ test.run(program = tar, arguments = "-t -f bar.tar", stderr = None)
test.fail_test(test.stdout() != "file13\nfile14\nfile15\n")
test.pass_test()
diff --git a/test/TARFLAGS.py b/test/TARFLAGS.py
index 4701f35..6fcff43 100644
--- a/test/TARFLAGS.py
+++ b/test/TARFLAGS.py
@@ -127,7 +127,7 @@ bar.Tar(target = 'bar.tar', source = 'file15')
test.fail_test(not os.path.exists(test.workpath('bar.tar')))
- test.run(program = tar, arguments = "-t -f foo.tar")
+ test.run(program = tar, arguments = "-t -f foo.tar", stderr = None)
test.fail_test(test.stdout() != "file10\nfile11\nfile12\n")
test.run(program = tar, arguments = "-t -f bar.tar", stderr = None)
diff --git a/test/option--U.py b/test/option--U.py
index 1facab8..013b81f 100644
--- a/test/option--U.py
+++ b/test/option--U.py
@@ -71,7 +71,7 @@ test.write(['sub2', 'bar.in'], "sub2/bar.in\n")
test.write(['sub3', 'baz.in'], "sub3/baz.in\n")
test.write('xxx.in', "xxx.in\n")
-test.write('SConscript', """assert GetLaunchDir() == '%s'"""%test.workpath('sub1'))
+test.write('SConscript', """assert GetLaunchDir() == r'%s'"""%test.workpath('sub1'))
test.run(arguments = '-U foo.out', chdir = 'sub1')
test.fail_test(not os.path.exists(test.workpath('sub1', 'foo.out')))
@@ -83,7 +83,7 @@ test.fail_test(os.path.exists(test.workpath('sub2/xxx.out')))
test.unlink(['sub1', 'foo.out'])
-test.write('SConscript', """assert GetLaunchDir() == '%s'"""%test.workpath('sub1'))
+test.write('SConscript', """assert GetLaunchDir() == r'%s'"""%test.workpath('sub1'))
test.run(arguments = '-U', chdir = 'sub1')
test.fail_test(os.path.exists(test.workpath('sub1', 'foo.out')))
test.fail_test(os.path.exists(test.workpath('sub2', 'bar.out')))
@@ -92,7 +92,7 @@ test.fail_test(os.path.exists(test.workpath('sub3', 'baz.out')))
test.fail_test(os.path.exists(test.workpath('bar.out')))
test.fail_test(os.path.exists(test.workpath('sub2/xxx.out')))
-test.write('SConscript', """assert GetLaunchDir() == '%s'"""%test.workpath('sub2'))
+test.write('SConscript', """assert GetLaunchDir() == r'%s'"""%test.workpath('sub2'))
test.run(chdir = 'sub2', arguments = '-U')
test.fail_test(os.path.exists(test.workpath('sub1', 'foo.out')))
test.fail_test(not os.path.exists(test.workpath('sub2', 'bar.out')))
@@ -105,7 +105,7 @@ test.unlink(['sub2', 'bar.out'])
test.unlink(['sub2b', 'bar.out'])
test.unlink('bar.out')
-test.write('SConscript', """assert GetLaunchDir() == '%s'"""%test.workpath())
+test.write('SConscript', """assert GetLaunchDir() == r'%s'"""%test.workpath())
test.run(arguments='-U')
test.fail_test(not os.path.exists(test.workpath('sub1', 'foo.out')))
test.fail_test(os.path.exists(test.workpath('sub2', 'bar.out')))
@@ -118,7 +118,7 @@ test.unlink(['sub1', 'foo.out'])
test.unlink(['sub3', 'baz.out'])
test.unlink(['sub2', 'xxx.out'])
-test.write('SConscript', """assert GetLaunchDir() == '%s'"""%test.workpath('sub3'))
+test.write('SConscript', """assert GetLaunchDir() == r'%s'"""%test.workpath('sub3'))
test.run(chdir = 'sub3', arguments='-U bar')
test.fail_test(os.path.exists(test.workpath('sub1', 'foo.out')))
test.fail_test(not os.path.exists(test.workpath('sub2', 'bar.out')))
diff --git a/test/option-v.py b/test/option-v.py
index a0f7d93..0461e68 100644
--- a/test/option-v.py
+++ b/test/option-v.py
@@ -33,21 +33,26 @@ test = TestSCons.TestSCons(match = TestCmd.match_re)
test.write('SConstruct', "")
-if sys.platform == 'win32':
- expect = r"""SCons by Steven Knight et al.:
+# Win32 may or may not print a line for the script version
+# depending on whether it's invoked through scons.py or scons.bat.
+expect1 = r"""SCons by Steven Knight et al.:
\tengine: v\S+, [^,]*, by \S+ on \S+
Copyright 2001, 2002 Steven Knight
"""
-else:
- expect = r"""SCons by Steven Knight et al.:
+
+expect2 = r"""SCons by Steven Knight et al.:
\tscript: v\S+, [^,]*, by \S+ on \S+
\tengine: v\S+, [^,]*, by \S+ on \S+
Copyright 2001, 2002 Steven Knight
"""
-test.run(arguments = '-v', stdout = expect)
+test.run(arguments = '-v')
+test.fail_test(not test.match_re(test.stdout(), expect1) and
+ not test.match_re(test.stdout(), expect2))
-test.run(arguments = '--version', stdout = expect)
+test.run(arguments = '--version')
+test.fail_test(not test.match_re(test.stdout(), expect1) and
+ not test.match_re(test.stdout(), expect2))
test.pass_test()