diff options
-rw-r--r-- | etc/TestSCons.py | 11 | ||||
-rw-r--r-- | src/CHANGES.txt | 4 | ||||
-rw-r--r-- | test/AR.py | 6 | ||||
-rw-r--r-- | test/ARFLAGS.py | 6 | ||||
-rw-r--r-- | test/CPPPATH.py | 4 | ||||
-rw-r--r-- | test/HeaderGen.py | 33 | ||||
-rw-r--r-- | test/HeaderInstall.py | 4 | ||||
-rw-r--r-- | test/LIBPATH.py | 10 | ||||
-rw-r--r-- | test/LIBPREFIXES.py | 4 | ||||
-rw-r--r-- | test/LIBS.py | 12 | ||||
-rw-r--r-- | test/LIBSUFFIXES.py | 4 | ||||
-rw-r--r-- | test/Library.py | 6 | ||||
-rw-r--r-- | test/QT.py | 10 | ||||
-rw-r--r-- | test/QTFLAGS.py | 5 | ||||
-rw-r--r-- | test/RANLIB.py | 6 | ||||
-rw-r--r-- | test/RANLIBFLAGS.py | 6 | ||||
-rw-r--r-- | test/Repository/StaticLibrary.py | 14 | ||||
-rw-r--r-- | test/SharedLibrary.py | 6 | ||||
-rw-r--r-- | test/long-lines.py | 4 | ||||
-rw-r--r-- | test/scan-once.py | 4 |
20 files changed, 104 insertions, 55 deletions
diff --git a/etc/TestSCons.py b/etc/TestSCons.py index 8cba239..737f8a2 100644 --- a/etc/TestSCons.py +++ b/etc/TestSCons.py @@ -208,3 +208,14 @@ class TestSCons(TestCommon): self.match_func = match_re_dotall apply(self.run, [], kw) self.match_func = old_match_func + +# In some environments, $AR will generate a warning message to stderr +# if the library doesn't previously exist and is being created. One +# way to fix this is to tell AR to be quiet (sometimes the 'c' flag), +# but this is difficult to do in a platform-/implementation-specific +# method. Instead, we will use the following as a stderr match for +# tests that use AR so that we will view zero or more "ar: creating +# <file>" messages to be successful executions of the test (see +# test/AR.py for sample usage). + +noisy_ar=r'(ar: creating \S+\n?)*' diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6694df2..ab32cef 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -162,8 +162,12 @@ RELEASE 0.96 - XXX From Kevin Quick: + - Handling SCons exceptions according to Pythonic standards. + - Fix test/chained-build.py on systems that execute within one second. + - Fix tests on systems where 'ar' warns about archive creation. + From Anthony Roach: - Fix use of the --implicit-cache option with timestamp signatures. @@ -32,7 +32,7 @@ import TestSCons python = TestSCons.python _exe = TestSCons._exe -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.write("wrapper.py", """import os @@ -82,11 +82,11 @@ main(int argc, char *argv[]) """) -test.run(arguments = 'f' + _exe) +test.run(arguments = 'f' + _exe, stderr=TestSCons.noisy_ar) test.fail_test(os.path.exists(test.workpath('wrapper.out'))) -test.run(arguments = 'b' + _exe) +test.run(arguments = 'b' + _exe, stderr=TestSCons.noisy_ar) test.fail_test(test.read('wrapper.out') != "wrapper.py\n") diff --git a/test/ARFLAGS.py b/test/ARFLAGS.py index a9dc572..15ce994 100644 --- a/test/ARFLAGS.py +++ b/test/ARFLAGS.py @@ -32,7 +32,7 @@ import TestSCons python = TestSCons.python _exe = TestSCons._exe -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.write("wrapper.py", """import os @@ -82,11 +82,11 @@ main(int argc, char *argv[]) """) -test.run(arguments = 'f' + _exe) +test.run(arguments = 'f' + _exe, stderr=TestSCons.noisy_ar) test.fail_test(os.path.exists(test.workpath('wrapper.out'))) -test.run(arguments = 'b' + _exe) +test.run(arguments = 'b' + _exe, stderr=TestSCons.noisy_ar) test.fail_test(test.read('wrapper.out') != "wrapper.py\n") diff --git a/test/CPPPATH.py b/test/CPPPATH.py index 1f93bf5..d3185c0 100644 --- a/test/CPPPATH.py +++ b/test/CPPPATH.py @@ -36,7 +36,7 @@ variant_prog = os.path.join('variant', 'prog' + _exe) args = prog + ' ' + subdir_prog + ' ' + variant_prog -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.subdir('include', 'subdir', ['subdir', 'include'], 'inc2') @@ -203,6 +203,6 @@ env.Library('foo', source = 'empty.c') test.write('empty.c', """ """) -test.run(arguments = '.') +test.run(arguments = '.', stderr=TestSCons.noisy_ar) test.pass_test() diff --git a/test/HeaderGen.py b/test/HeaderGen.py index 9a3a6ab..44dd3ce 100644 --- a/test/HeaderGen.py +++ b/test/HeaderGen.py @@ -25,12 +25,13 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Test that dependencies in generated header files get re-scanned correctly. +Test that dependencies in generated header files get re-scanned correctly +and that generated header files don't cause circular dependencies. """ import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.write('SConstruct', """\ def writeFile(target, contents): @@ -50,8 +51,34 @@ env.Command('gen.cpp', [], lambda env,target,source: writeFile(target, '#include "gen.h"\\n')) """) -test.run() +test.run(stderr=TestSCons.noisy_ar) test.up_to_date(arguments = '.') +test.write('SConstruct', """\ +env = Environment() + +def gen_a_h(target, source, env): + t = open(str(target[0]), 'wb') + s = open(str(source[0]), 'rb') + s.readline() + t.write(s.readline()[:-1] + ';\\n') + +MakeHeader = Builder(action = gen_a_h) +env_no_scan = env.Copy(SCANNERS=[], BUILDERS={'MakeHeader' : MakeHeader}) +env_no_scan.MakeHeader('a.h', 'a.c') + +env.StaticObject('a.c') +""") + +test.write('a.c', """\ +#include "a.h" +void a(void) +{ + ; +} +""") + +test.run() + test.pass_test() diff --git a/test/HeaderInstall.py b/test/HeaderInstall.py index cccf4d6..ae4213f 100644 --- a/test/HeaderInstall.py +++ b/test/HeaderInstall.py @@ -31,7 +31,7 @@ import os.path import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.subdir('work1', ['work1', 'dist']) @@ -64,7 +64,7 @@ test.write(['work1', 'dist', 'h3.h'], """\ int foo = 3; """) -test.run(chdir = 'work1', arguments = ".") +test.run(chdir = 'work1', arguments = ".", stderr=TestSCons.noisy_ar) test.up_to_date(chdir = 'work1', arguments = ".") diff --git a/test/LIBPATH.py b/test/LIBPATH.py index d691af2..9f5bbfd 100644 --- a/test/LIBPATH.py +++ b/test/LIBPATH.py @@ -33,7 +33,7 @@ _exe = TestSCons._exe _dll = TestSCons._dll dll_ = TestSCons.dll_ -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.subdir('lib1', 'lib2') @@ -86,7 +86,7 @@ main(int argc, char *argv[]) } """) -test.run(arguments = '.') +test.run(arguments = '.', stderr=TestSCons.noisy_ar) test.run(program = prog1, stdout = "f1.c\nprog.c\n") @@ -107,7 +107,7 @@ f1(void) } """) -test.run(arguments = '.') +test.run(arguments = '.', stderr=TestSCons.noisy_ar) test.run(program = prog1, stdout = "f1.c 1\nprog.c\n") test.fail_test(oldtime2 == os.path.getmtime(prog2)) @@ -138,7 +138,7 @@ f1(void) } """) -test.run(arguments = '.') +test.run(arguments = '.', stderr=TestSCons.noisy_ar) test.run(program = prog1, stdout = "f1.c 2\nprog.c\n") @@ -154,6 +154,6 @@ env = Environment(LIBPATH = '') env.Library('foo', source = 'empty.c') """) -test.run(arguments = '.') +test.run(arguments = '.', stderr=TestSCons.noisy_ar) test.pass_test() diff --git a/test/LIBPREFIXES.py b/test/LIBPREFIXES.py index abd2120..7abf0d4 100644 --- a/test/LIBPREFIXES.py +++ b/test/LIBPREFIXES.py @@ -33,7 +33,7 @@ if sys.platform == 'win32': else: _lib = '.a' -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.write('SConstruct', """ env = Environment(LIBPREFIX = 'xxx-', @@ -62,7 +62,7 @@ main(int argc, char *argv[]) } """) -test.run(arguments = '.') +test.run(arguments = '.', stderr=TestSCons.noisy_ar) test.fail_test(not os.path.exists(test.workpath('xxx-foo' + _lib))) diff --git a/test/LIBS.py b/test/LIBS.py index c91e38d..07f1746 100644 --- a/test/LIBS.py +++ b/test/LIBS.py @@ -34,7 +34,7 @@ else: _exe = '' bar_lib = 'libbar.a' -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.subdir('sub1', 'sub2') @@ -145,11 +145,11 @@ SConscript('sub1/SConscript', 'env') SConscript('sub2/SConscript', 'env') """) -test.run(arguments = '.', stderr=None) # on IRIX, ld32 prints out a warning saying that libbaz.a isn't used sw = 'ld32: WARNING 84 : ./libbaz.a is not used for resolving any symbol.\n' -test.fail_test(not test.stderr() in ['', sw]) +test.run(arguments = '.', stderr='(%s|%s'%(sw, TestSCons.noisy_ar[1:])) +#test.fail_test(not test.stderr() in ['', sw]) test.run(program=foo1_exe, stdout='sub1/bar.c\nsub1/baz.c\n') @@ -174,8 +174,8 @@ void baz() } """) -test.run(arguments = '.', stderr=None) -test.fail_test(not test.stderr() in ['', sw]) +test.run(arguments = '.', stderr='(%s|%s'%(sw, TestSCons.noisy_ar[1:])) +#test.fail_test(not test.stderr() in ['', sw, TestSCons.noisy_ar]) test.run(program=foo1_exe, stdout='sub1/bar.c\nsub1/baz.c 2\n') @@ -251,7 +251,7 @@ int DisplayMessage2 (void) } """) -test.run(arguments = '.') +test.run(arguments = '.', stderr=TestSCons.noisy_ar) test.run(program=blender_exe, stdout='src/component1/message.c\nsrc/component2/hello.c\n') diff --git a/test/LIBSUFFIXES.py b/test/LIBSUFFIXES.py index 19a092f..4e0073e 100644 --- a/test/LIBSUFFIXES.py +++ b/test/LIBSUFFIXES.py @@ -33,7 +33,7 @@ if sys.platform == 'win32': else: lib_ = 'lib' -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.write('SConstruct', """ env = Environment(LIBSUFFIX = '.xxx', @@ -62,7 +62,7 @@ main(int argc, char *argv[]) } """) -test.run(arguments = '.') +test.run(arguments = '.', stderr=TestSCons.noisy_ar) test.fail_test(not os.path.exists(test.workpath(lib_ + 'foo.xxx'))) diff --git a/test/Library.py b/test/Library.py index f22172c..2b0810f 100644 --- a/test/Library.py +++ b/test/Library.py @@ -26,7 +26,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.write('SConstruct', """ env = Environment(LIBS = [ 'foo1', 'libfoo2' ], @@ -121,7 +121,7 @@ main(int argc, char *argv[]) } """) -test.run(arguments = '.') +test.run(arguments = '.', stderr=TestSCons.noisy_ar) test.run(program = test.workpath('prog'), stdout = "f1.c\nf2a.c\nf2b.c\nf2c.c\nf3a.c\nf3b.c\nf3c.cpp\nprog.c\n") @@ -150,7 +150,7 @@ int main() { } """) -test.run() +test.run(stderr=TestSCons.noisy_ar) test.run(program = test.workpath('uses-nrd'), stdout = "nrd\n") @@ -43,7 +43,7 @@ dll_ = TestSCons.dll_ _dll = TestSCons._dll _shobj = TestSCons._shobj -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.subdir( 'qt', ['qt', 'bin'], ['qt', 'include'], ['qt', 'lib'] ) @@ -126,7 +126,8 @@ env = Environment() env.StaticLibrary( 'myqt', 'my_qobject.cpp' ) """) -test.run(chdir=test.workpath('qt','lib'), arguments = '.') +test.run(chdir=test.workpath('qt','lib'), arguments = '.', + stderr=TestSCons.noisy_ar) QT = test.workpath('qt') QT_LIB = 'myqt' @@ -310,7 +311,7 @@ void useit() { } """) -test.run(chdir='work3', arguments = lib_aaa) +test.run(chdir='work3', arguments = lib_aaa, stderr=TestSCons.noisy_ar) test.up_to_date(chdir='work3', options = '-n', arguments = lib_aaa) test.write(['work3', 'aaa.cpp'], r""" #include "my_qobject.h" @@ -322,7 +323,8 @@ test.not_up_to_date(chdir='work3', options = '-n', arguments = moc) test.run(chdir='work3', arguments = "build_dir=1 " + - test.workpath('work3', 'build', lib_aaa) ) + test.workpath('work3', 'build', lib_aaa), + stderr=TestSCons.noisy_ar ) test.run(chdir='work3', arguments = "build_dir=1 chdir=1 " + test.workpath('work3', 'build', lib_aaa) ) diff --git a/test/QTFLAGS.py b/test/QTFLAGS.py index 867dbfb..3563d37 100644 --- a/test/QTFLAGS.py +++ b/test/QTFLAGS.py @@ -34,7 +34,7 @@ import os.path python = TestSCons.python _exe = TestSCons._exe -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.subdir( 'qt', ['qt', 'bin'], ['qt', 'include'], ['qt', 'lib'] ) @@ -116,7 +116,8 @@ env = Environment() env.StaticLibrary( 'myqt', 'my_qobject.cpp' ) """) -test.run(chdir=test.workpath('qt','lib'), arguments = '.') +test.run(chdir=test.workpath('qt','lib'), arguments = '.', + stderr=TestSCons.noisy_ar) QT = test.workpath('qt') QT_LIB = 'myqt' diff --git a/test/RANLIB.py b/test/RANLIB.py index cb8f1db..5de4a09 100644 --- a/test/RANLIB.py +++ b/test/RANLIB.py @@ -34,7 +34,7 @@ python = TestSCons.python _exe = TestSCons._exe -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) ranlib = test.detect('RANLIB', 'ranlib') @@ -89,11 +89,11 @@ main(int argc, char *argv[]) """) -test.run(arguments = 'f' + _exe) +test.run(arguments = 'f' + _exe, stderr=TestSCons.noisy_ar) test.fail_test(os.path.exists(test.workpath('wrapper.out'))) -test.run(arguments = 'b' + _exe) +test.run(arguments = 'b' + _exe, stderr=TestSCons.noisy_ar) test.fail_test(test.read('wrapper.out') != "wrapper.py\n") diff --git a/test/RANLIBFLAGS.py b/test/RANLIBFLAGS.py index 07da92e..64c6847 100644 --- a/test/RANLIBFLAGS.py +++ b/test/RANLIBFLAGS.py @@ -32,7 +32,7 @@ import TestSCons python = TestSCons.python _exe = TestSCons._exe -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) ranlib = test.detect('RANLIB', 'ranlib') @@ -86,11 +86,11 @@ main(int argc, char *argv[]) """) -test.run(arguments = 'f' + _exe) +test.run(arguments = 'f' + _exe, stderr=TestSCons.noisy_ar) test.fail_test(os.path.exists(test.workpath('wrapper.out'))) -test.run(arguments = 'b' + _exe) +test.run(arguments = 'b' + _exe, stderr=TestSCons.noisy_ar) test.fail_test(test.read('wrapper.out') != "wrapper.py\n") diff --git a/test/Repository/StaticLibrary.py b/test/Repository/StaticLibrary.py index 00c5eb5..2dd8f88 100644 --- a/test/Repository/StaticLibrary.py +++ b/test/Repository/StaticLibrary.py @@ -37,7 +37,7 @@ else: -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) # test.subdir('repository', 'work1', 'work2', 'work3') @@ -100,7 +100,8 @@ main(int argc, char *argv[]) test.writable('repository', 0) # -test.run(chdir = 'work1', options = opts, arguments = ".") +test.run(chdir = 'work1', options = opts, arguments = ".", + stderr=TestSCons.noisy_ar) test.run(program = work1_foo, stdout = """repository/aaa.c @@ -123,7 +124,8 @@ bbb(void) } """) -test.run(chdir = 'work1', options = opts, arguments = ".") +test.run(chdir = 'work1', options = opts, arguments = ".", + stderr=TestSCons.noisy_ar) test.run(program = work1_foo, stdout = """repository/aaa.c @@ -141,7 +143,8 @@ test.up_to_date(chdir = 'work1', options = opts, arguments = ".") # test.writable('repository', 1) -test.run(chdir = 'repository', options = opts, arguments = ".") +test.run(chdir = 'repository', options = opts, arguments = ".", + stderr=TestSCons.noisy_ar) test.run(program = repository_foo, stdout = """repository/aaa.c @@ -169,7 +172,8 @@ bbb(void) } """) -test.run(chdir = 'work2', options = opts, arguments = ".") +test.run(chdir = 'work2', options = opts, arguments = ".", + stderr=TestSCons.noisy_ar) test.run(program = work2_foo, stdout = """repository/aaa.c diff --git a/test/SharedLibrary.py b/test/SharedLibrary.py index 6ad278d..d4eb730 100644 --- a/test/SharedLibrary.py +++ b/test/SharedLibrary.py @@ -31,7 +31,7 @@ import sys import TestCmd import TestSCons -test = TestSCons.TestSCons(match=TestCmd.match_re) +test = TestSCons.TestSCons(match=TestCmd.match_re_dotall) test.write('SConstruct', """ import sys @@ -191,7 +191,7 @@ main(int argc, char *argv[]) } """) -test.run(arguments = '.') +test.run(arguments = '.', stderr=TestSCons.noisy_ar) if os.name == 'posix': os.environ['LD_LIBRARY_PATH'] = '.' @@ -213,7 +213,7 @@ scons: \*\*\* Source file: foo\..* is static and is not compatible with shared t scons: \*\*\* Source file: foo\..* is static and is not compatible with shared target: .* ''') -test.run(arguments = '-f SConstructFoo2') +test.run(arguments = '-f SConstructFoo2', stderr=TestSCons.noisy_ar) if sys.platform == 'win32': # Make sure we don't insert a .def source file (when diff --git a/test/long-lines.py b/test/long-lines.py index 9d38504..5216429 100644 --- a/test/long-lines.py +++ b/test/long-lines.py @@ -30,7 +30,7 @@ import string import sys import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) if sys.platform == 'win32': lib_static_lib = 'static.lib' @@ -103,7 +103,7 @@ main(int argc, char *argv[]) """) -test.run(arguments = '.') +test.run(arguments = '.', stderr=TestSCons.noisy_ar) test.up_to_date(arguments = '.') diff --git a/test/scan-once.py b/test/scan-once.py index 606590b..57a8d36 100644 --- a/test/scan-once.py +++ b/test/scan-once.py @@ -43,7 +43,7 @@ import sys import TestCmd import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) test.subdir('simple', 'SLF', @@ -474,7 +474,7 @@ XScanner: node = file3.x create file4.x from file3.x """)) -test.run(arguments = 'SLF') +test.run(arguments = 'SLF', stderr=TestSCons.noisy_ar) # XXX Note that the generated .h files still get scanned twice, # once before they're generated and once after. That's the |