diff options
author | William Blevins <wblevins001@gmail.com> | 2016-09-21 23:54:23 (GMT) |
---|---|---|
committer | William Blevins <wblevins001@gmail.com> | 2016-09-21 23:54:23 (GMT) |
commit | 88eb753eb8e65721368beb2fc1247312e2a5ab4c (patch) | |
tree | f8628927dfdc201f4e4aca0a0101210be85fb1fc /test | |
parent | f5035c6a61ad10f440a22c14ce22bbb1d6796f62 (diff) | |
download | SCons-88eb753eb8e65721368beb2fc1247312e2a5ab4c.zip SCons-88eb753eb8e65721368beb2fc1247312e2a5ab4c.tar.gz SCons-88eb753eb8e65721368beb2fc1247312e2a5ab4c.tar.bz2 |
Fixed difference in types MethodType argument list between 2/3 which allowed finishing CC folder.
Diffstat (limited to 'test')
-rw-r--r-- | test/CC/CC-fixture/bar.c | 10 | ||||
-rw-r--r-- | test/CC/CC-fixture/foo.c | 10 | ||||
-rw-r--r-- | test/CC/CC-fixture/test1.c | 3 | ||||
-rw-r--r-- | test/CC/CC-fixture/test2.C | 3 | ||||
-rw-r--r-- | test/CC/CC.py | 57 | ||||
-rw-r--r-- | test/CC/CCVERSION-fixture/.exclude_tests | 1 | ||||
-rw-r--r-- | test/CC/CCVERSION-fixture/versioned.py | 12 | ||||
-rw-r--r-- | test/CC/CCVERSION.py | 29 |
8 files changed, 49 insertions, 76 deletions
diff --git a/test/CC/CC-fixture/bar.c b/test/CC/CC-fixture/bar.c new file mode 100644 index 0000000..de1e6e5 --- /dev/null +++ b/test/CC/CC-fixture/bar.c @@ -0,0 +1,10 @@ +#include <stdio.h> +#include <stdlib.h> + +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf("foo.c\n"); + exit (0); +} diff --git a/test/CC/CC-fixture/foo.c b/test/CC/CC-fixture/foo.c new file mode 100644 index 0000000..de1e6e5 --- /dev/null +++ b/test/CC/CC-fixture/foo.c @@ -0,0 +1,10 @@ +#include <stdio.h> +#include <stdlib.h> + +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf("foo.c\n"); + exit (0); +} diff --git a/test/CC/CC-fixture/test1.c b/test/CC/CC-fixture/test1.c new file mode 100644 index 0000000..7535b0a --- /dev/null +++ b/test/CC/CC-fixture/test1.c @@ -0,0 +1,3 @@ +This is a .c file. +/*cc*/ +/*link*/ diff --git a/test/CC/CC-fixture/test2.C b/test/CC/CC-fixture/test2.C new file mode 100644 index 0000000..a1ee9e3 --- /dev/null +++ b/test/CC/CC-fixture/test2.C @@ -0,0 +1,3 @@ +This is a .C file. +/*cc*/ +/*link*/ diff --git a/test/CC/CC.py b/test/CC/CC.py index 9500088..7478cbe 100644 --- a/test/CC/CC.py +++ b/test/CC/CC.py @@ -33,7 +33,7 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() - +test.dir_fixture('CC-fixture') if sys.platform == 'win32': @@ -53,7 +53,7 @@ while args: infile = open(args[0], 'rb') outfile = open(out, 'wb') for l in infile.readlines(): - if l[:8] != '/*link*/': + if l[:8] != b'/*link*/': outfile.write(l) sys.exit(0) """) @@ -77,7 +77,7 @@ while args: infile = open(inf, 'rb') outfile = open(out, 'wb') for l in infile.readlines(): - if l[:6] != '/*cc*/': + if l[:6] != b'/*cc*/': outfile.write(l) sys.exit(0) """) @@ -93,7 +93,7 @@ for opt, arg in opts: infile = open(args[0], 'rb') outfile = open(out, 'wb') for l in infile.readlines(): - if l[:8] != '/*link*/': + if l[:8] != b'/*link*/': outfile.write(l) sys.exit(0) """) @@ -107,7 +107,7 @@ for opt, arg in opts: infile = open(args[0], 'rb') outfile = open(out, 'wb') for l in infile.readlines(): - if l[:6] != '/*cc*/': + if l[:6] != b'/*cc*/': outfile.write(l) sys.exit(0) """) @@ -122,14 +122,9 @@ env = Environment(LINK = r'%(_python_)s mylink.py', env.Program(target = 'test1', source = 'test1.c') """ % locals()) -test.write('test1.c', r"""This is a .c file. -/*cc*/ -/*link*/ -""") - test.run(arguments = '.', stderr = None) -test.fail_test(test.read('test1' + _exe) != "This is a .c file.\n") +test.must_match('test1' + _exe, "This is a .c file.\n") if os.path.normcase('.c') == os.path.normcase('.C'): @@ -141,23 +136,14 @@ env = Environment(LINK = r'%(_python_)s mylink.py', env.Program(target = 'test2', source = 'test2.C') """ % locals()) - test.write('test2.C', r"""This is a .C file. -/*cc*/ -/*link*/ -""") - test.run(arguments = '.', stderr = None) - - test.fail_test(test.read('test2' + _exe) != "This is a .C file.\n") - - - + test.must_match('test2' + _exe, "This is a .C file.\n") test.write("wrapper.py", """import os import sys if '--version' not in sys.argv and '-dumpversion' not in sys.argv: - open('%s', 'wb').write("wrapper.py\\n") + open('%s', 'wb').write(b"wrapper.py\\n") os.system(" ".join(sys.argv[1:])) """ % test.workpath('wrapper.out').replace('\\', '\\\\')) @@ -169,33 +155,6 @@ foo.Program(target = 'foo', source = 'foo.c') bar.Program(target = 'bar', source = 'bar.c') """ % locals()) -test.write('foo.c', r""" -#include <stdio.h> -#include <stdlib.h> - -int -main(int argc, char *argv[]) -{ - argv[argc++] = "--"; - printf("foo.c\n"); - exit (0); -} -""") - -test.write('bar.c', r""" -#include <stdio.h> -#include <stdlib.h> - -int -main(int argc, char *argv[]) -{ - argv[argc++] = "--"; - printf("foo.c\n"); - exit (0); -} -""") - - test.run(arguments = 'foo' + _exe) test.must_not_exist(test.workpath('wrapper.out')) diff --git a/test/CC/CCVERSION-fixture/.exclude_tests b/test/CC/CCVERSION-fixture/.exclude_tests new file mode 100644 index 0000000..775816e --- /dev/null +++ b/test/CC/CCVERSION-fixture/.exclude_tests @@ -0,0 +1 @@ +versioned.py diff --git a/test/CC/CCVERSION-fixture/versioned.py b/test/CC/CCVERSION-fixture/versioned.py new file mode 100644 index 0000000..d6c7ae8 --- /dev/null +++ b/test/CC/CCVERSION-fixture/versioned.py @@ -0,0 +1,12 @@ +import os +import sys +if '-dumpversion' in sys.argv: + print('3.9.9') + sys.exit(0) +if '--version' in sys.argv: + print('this is version 2.9.9 wrapping', sys.argv[2]) + sys.exit(0) +if sys.argv[1] not in [ '2.9.9', '3.9.9' ]: + print('wrong version', sys.argv[1], 'when wrapping', sys.argv[2]) + sys.exit(1) +os.system(" ".join(sys.argv[2:])) diff --git a/test/CC/CCVERSION.py b/test/CC/CCVERSION.py index f785ddc..20d8616 100644 --- a/test/CC/CCVERSION.py +++ b/test/CC/CCVERSION.py @@ -36,20 +36,8 @@ test = TestSCons.TestSCons() if sys.platform == 'win32': test.skip_test('CCVERSION not set with MSVC, skipping test.') -test.write("versioned.py", -"""import os -import sys -if '-dumpversion' in sys.argv: - print '3.9.9' - sys.exit(0) -if '--version' in sys.argv: - print 'this is version 2.9.9 wrapping', sys.argv[2] - sys.exit(0) -if sys.argv[1] not in [ '2.9.9', '3.9.9' ]: - print 'wrong version', sys.argv[1], 'when wrapping', sys.argv[2] - sys.exit(1) -os.system(" ".join(sys.argv[2:])) -""") +test.dir_fixture('CCVERSION-fixture') +test.file_fixture(os.path.join('CC-fixture', 'foo.c')) test.write('SConstruct', """ cc = Environment().Dictionary('CC') @@ -57,19 +45,6 @@ foo = Environment(CC = r'%(_python_)s versioned.py "${CCVERSION}" ' + cc) foo.Program(target = 'foo', source = 'foo.c') """ % locals()) -test.write('foo.c', r""" -#include <stdio.h> -#include <stdlib.h> - -int -main(int argc, char *argv[]) -{ - argv[argc++] = "--"; - printf("foo.c\n"); - exit (0); -} -""") - test.run(arguments = 'foo' + _exe) test.up_to_date(arguments = 'foo' + _exe) |