diff options
| author | Steven Knight <knight@baldmt.com> | 2001-11-24 23:15:01 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2001-11-24 23:15:01 (GMT) |
| commit | 378373defaf150feb90cd54d13626516c6dbe1b4 (patch) | |
| tree | fc9783004f1cae3c3558846d6f9a1c589e104a3e /test | |
| parent | 139a0052dc0bff059dc9b8cf1739396304e7c129 (diff) | |
| download | SCons-378373defaf150feb90cd54d13626516c6dbe1b4.zip SCons-378373defaf150feb90cd54d13626516c6dbe1b4.tar.gz SCons-378373defaf150feb90cd54d13626516c6dbe1b4.tar.bz2 | |
More NT portability fixes.
Diffstat (limited to 'test')
| -rw-r--r-- | test/CC.py | 4 | ||||
| -rw-r--r-- | test/CCFLAGS.py | 36 | ||||
| -rw-r--r-- | test/Default.py | 4 | ||||
| -rw-r--r-- | test/Library.py | 18 | ||||
| -rw-r--r-- | test/Object.py | 12 | ||||
| -rw-r--r-- | test/Program.py | 26 | ||||
| -rw-r--r-- | test/nonwritable-sconsign.py | 2 | ||||
| -rw-r--r-- | test/subdir.py | 20 |
8 files changed, 69 insertions, 53 deletions
@@ -47,7 +47,7 @@ foo.Program(target = 'foo', source = 'foo.c') bar.Program(target = 'bar', source = 'bar.c') """ % python) -test.write('foo.c', """ +test.write('foo.c', r""" int main(int argc, char *argv[]) { @@ -57,7 +57,7 @@ main(int argc, char *argv[]) } """) -test.write('bar.c', """ +test.write('bar.c', r""" int main(int argc, char *argv[]) { diff --git a/test/CCFLAGS.py b/test/CCFLAGS.py index 8b0e5a8..3c9e716 100644 --- a/test/CCFLAGS.py +++ b/test/CCFLAGS.py @@ -24,20 +24,30 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import sys import TestSCons +if sys.platform == 'win32': + _obj = '.obj' + fooflags = '/nologo -DFOO' + barflags = '/nologo -DBAR' +else: + _obj = '.o' + fooflags = '-DFOO' + barflags = '-DBAR' + test = TestSCons.TestSCons() test.write('SConstruct', """ -foo = Environment(CCFLAGS = '-DFOO') -bar = Environment(CCFLAGS = '-DBAR') -foo.Object(target = 'foo.o', source = 'prog.c') -bar.Object(target = 'bar.o', source = 'prog.c') -foo.Program(target = 'foo', source = 'foo.o') -bar.Program(target = 'bar', source = 'bar.o') -""") +foo = Environment(CCFLAGS = '%s') +bar = Environment(CCFLAGS = '%s') +foo.Object(target = 'foo%s', source = 'prog.c') +bar.Object(target = 'bar%s', source = 'prog.c') +foo.Program(target = 'foo', source = 'foo%s') +bar.Program(target = 'bar', source = 'bar%s') +""" % (fooflags, barflags, _obj, _obj, _obj, _obj)) -test.write('prog.c', """ +test.write('prog.c', r""" int main(int argc, char *argv[]) { @@ -60,11 +70,11 @@ test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n") test.write('SConstruct', """ bar = Environment(CCFLAGS = '-DBAR') -bar.Object(target = 'foo.o', source = 'prog.c') -bar.Object(target = 'bar.o', source = 'prog.c') -bar.Program(target = 'foo', source = 'foo.o') -bar.Program(target = 'bar', source = 'bar.o') -""") +bar.Object(target = 'foo%s', source = 'prog.c') +bar.Object(target = 'bar%s', source = 'prog.c') +bar.Program(target = 'foo', source = 'foo%s') +bar.Program(target = 'bar', source = 'bar%s') +""" % (_obj, _obj, _obj, _obj)) test.run(arguments = '.') diff --git a/test/Default.py b/test/Default.py index 93e6be6..ceab745 100644 --- a/test/Default.py +++ b/test/Default.py @@ -71,9 +71,9 @@ for dir in ['one', 'two', 'three']: foo_in = os.path.join(dir, 'foo.in') bar_in = os.path.join(dir, 'bar.in') - test.write(foo_in, foo_in + "\n"); + test.write(foo_in, dir + "/foo.in\n"); - test.write(bar_in, bar_in + "\n"); + test.write(bar_in, dir + "/bar.in\n"); test.run(chdir = dir) # no arguments, use the Default diff --git a/test/Library.py b/test/Library.py index f5e9edb..12f98f0 100644 --- a/test/Library.py +++ b/test/Library.py @@ -37,7 +37,7 @@ env.Library(target = 'foo3', source = ['f3a.c', 'f3b.c', 'f3c.c']) env.Program(target = 'prog', source = 'prog.c') """) -test.write('f1.c', """ +test.write('f1.c', r""" void f1(void) { @@ -45,7 +45,7 @@ f1(void) } """) -test.write('f2a.c', """ +test.write('f2a.c', r""" void f2a(void) { @@ -53,7 +53,7 @@ f2a(void) } """) -test.write('f2b.c', """ +test.write('f2b.c', r""" void f2b(void) { @@ -61,7 +61,7 @@ f2b(void) } """) -test.write('f2c.c', """ +test.write('f2c.c', r""" void f2c(void) { @@ -69,7 +69,7 @@ f2c(void) } """) -test.write('f3a.c', """ +test.write('f3a.c', r""" void f3a(void) { @@ -77,7 +77,7 @@ f3a(void) } """) -test.write('f3b.c', """ +test.write('f3b.c', r""" void f3b(void) { @@ -85,14 +85,14 @@ f3b(void) } """) -test.write('f3c.c', """ +test.write('f3c.c', r""" f3c(void) { printf("f3c.c\n"); } """) -test.write('prog.c', """ +test.write('prog.c', r""" void f1(void); void f2a(void); void f2b(void); @@ -116,7 +116,7 @@ main(int argc, char *argv[]) } """) -test.run(arguments = 'prog') +test.run(arguments = '.') test.run(program = test.workpath('prog'), stdout = "f1.c\nf2a.c\nf2b.c\nf2c.c\nf3a.c\nf3b.c\nf3c.c\nprog.c\n") diff --git a/test/Object.py b/test/Object.py index 53bab36..ebbdf0f 100644 --- a/test/Object.py +++ b/test/Object.py @@ -24,8 +24,14 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import sys import TestSCons +if sys.platform == 'win32': + _obj = '.obj' +else: + _obj = '.o' + test = TestSCons.TestSCons() test.write('SConstruct', """ @@ -33,10 +39,10 @@ env = Environment() f1 = env.Object(target = 'f1', source = 'f1.c') f2 = env.Object(target = 'f2', source = 'f2.cpp') f3 = env.Object(target = 'f3', source = 'f3.c') -env.Program(target = 'prog1', source = 'f1.o f2.o f3.o prog.cpp') +env.Program(target = 'prog1', source = 'f1%s f2%s f3%s prog.cpp') env.Program(target = 'prog2', source = [f1, f2, f3, 'prog.cpp']) -env.Program(target = 'prog3', source = ['f1.o', f2, 'f3.o', 'prog.cpp']) -""") +env.Program(target = 'prog3', source = ['f1%s', f2, 'f3%s', 'prog.cpp']) +""" % (_obj, _obj, _obj, _obj, _obj)) test.write('f1.c', """ void diff --git a/test/Program.py b/test/Program.py index 80c1d95..a32c48e 100644 --- a/test/Program.py +++ b/test/Program.py @@ -39,7 +39,7 @@ env.Program(target = 'foo2', source = 'f2a.c f2b.c f2c.c') env.Program(target = 'foo3', source = ['f3a.c', 'f3b.c', 'f3c.c']) """) -test.write('f1.c', """ +test.write('f1.c', r""" int main(int argc, char *argv[]) { @@ -49,7 +49,7 @@ main(int argc, char *argv[]) } """) -test.write('f2a.c', """ +test.write('f2a.c', r""" void f2a(void) { @@ -57,7 +57,7 @@ f2a(void) } """) -test.write('f2b.c', """ +test.write('f2b.c', r""" void f2b(void) { @@ -65,7 +65,7 @@ f2b(void) } """) -test.write('f2c.c', """ +test.write('f2c.c', r""" extern void f2a(void); extern void f2b(void); int @@ -79,7 +79,7 @@ main(int argc, char *argv[]) } """) -test.write('f3a.c', """ +test.write('f3a.c', r""" void f3a(void) { @@ -87,7 +87,7 @@ f3a(void) } """) -test.write('f3b.c', """ +test.write('f3b.c', r""" void f3b(void) { @@ -95,7 +95,7 @@ f3b(void) } """) -test.write('f3c.c', """ +test.write('f3c.c', r""" extern void f3a(void); extern void f3b(void); int @@ -117,7 +117,7 @@ test.run(program = test.workpath('foo3'), stdout = "f3a.c\nf3b.c\nf3c.c\n") test.up_to_date(arguments = '.') -test.write('f1.c', """ +test.write('f1.c', r""" int main(int argc, char *argv[]) { @@ -127,7 +127,7 @@ main(int argc, char *argv[]) } """) -test.write('f3b.c', """ +test.write('f3b.c', r""" void f3b(void) { @@ -156,7 +156,7 @@ test.fail_test(not (oldtime1 == os.path.getmtime(test.workpath('foo1')))) test.fail_test(not (oldtime2 == os.path.getmtime(test.workpath('foo2')))) test.fail_test(not (oldtime3 == os.path.getmtime(test.workpath('foo3')))) -test.write('f1.c', """ +test.write('f1.c', r""" int main(int argc, char *argv[]) { @@ -166,7 +166,7 @@ main(int argc, char *argv[]) } """) -test.write('f3b.c', """ +test.write('f3b.c', r""" void f3b(void) { @@ -182,7 +182,7 @@ test.run(program = test.workpath('foo3'), stdout = "f3a.c\nf3b.c Y\nf3c.c\n") test.up_to_date(arguments = 'foo1 foo2 foo3') -test.write('f1.c', """ +test.write('f1.c', r""" int main(int argc, char *argv[]) { @@ -192,7 +192,7 @@ main(int argc, char *argv[]) } """) -test.write('f3b.c', """ +test.write('f3b.c', r""" void f3b(void) { diff --git a/test/nonwritable-sconsign.py b/test/nonwritable-sconsign.py index 350a63d..4bc04bb 100644 --- a/test/nonwritable-sconsign.py +++ b/test/nonwritable-sconsign.py @@ -34,7 +34,7 @@ env = Environment() env.Program(target = 'foo1', source = 'f1.c') """) -test.write('f1.c', """ +test.write('f1.c', r""" int main(int argc, char *argv[]) { diff --git a/test/subdir.py b/test/subdir.py index 2161195..318cf82 100644 --- a/test/subdir.py +++ b/test/subdir.py @@ -33,8 +33,8 @@ test.subdir('subdir') test.write('build.py', r""" import sys -contents = open(sys.argv[2], 'r').read() -file = open(sys.argv[1], 'w') +contents = open(sys.argv[2], 'rb').read() +file = open(sys.argv[1], 'wb') file.write(contents) file.close() """) @@ -48,17 +48,17 @@ env.B(target = 'subdir/f3.out', source = 'subdir/f3.in') env.B(target = 'subdir/f4.out', source = 'subdir/f4.in') """) -test.write('subdir/f1.in', "f1.in\n") -test.write('subdir/f2.in', "f2.in\n") -test.write('subdir/f3.in', "f3.in\n") -test.write('subdir/f4.in', "f4.in\n") +test.write(['subdir', 'f1.in'], "f1.in\n") +test.write(['subdir', 'f2.in'], "f2.in\n") +test.write(['subdir', 'f3.in'], "f3.in\n") +test.write(['subdir', 'f4.in'], "f4.in\n") test.run(arguments = 'subdir') -test.fail_test(test.read('subdir/f1.out') != "f1.in\n") -test.fail_test(test.read('subdir/f2.out') != "f2.in\n") -test.fail_test(test.read('subdir/f3.out') != "f3.in\n") -test.fail_test(test.read('subdir/f4.out') != "f4.in\n") +test.fail_test(test.read(['subdir', 'f1.out']) != "f1.in\n") +test.fail_test(test.read(['subdir', 'f2.out']) != "f2.in\n") +test.fail_test(test.read(['subdir', 'f3.out']) != "f3.in\n") +test.fail_test(test.read(['subdir', 'f4.out']) != "f4.in\n") test.up_to_date(arguments = 'subdir') |
