From: stevenknight Date: Fri, 21 Dec 2001 19:01:07 +0000 (+0000) Subject: Windows NT portability fixes for tests. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c7abf4292a493a827b0659dff42eb15d90dc5d31;p=scons.git Windows NT portability fixes for tests. git-svn-id: http://scons.tigris.org/svn/scons/trunk@171 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index c2faa350..878e7361 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -220,7 +220,8 @@ class EnvironmentTestCase(unittest.TestCase): tgt = env.Install('export', [ 'build/foo1', 'build/foo2' ]) paths = map(str, tgt) paths.sort() - assert paths == [ 'export/foo1', 'export/foo2' ], paths + expect = map(os.path.normpath, [ 'export/foo1', 'export/foo2' ]) + assert paths == expect, paths for tnode in tgt: assert tnode.builder == InstallBuilder diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index ee5deaaa..adfd4401 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -192,6 +192,7 @@ class FS: dir.path_ = drive + dir.path_ dir.abspath = drive + dir.abspath dir.abspath_ = drive + dir.abspath_ + dir.srcpath = dir.path return self.Root.setdefault(drive, dir) if head: # Recursively look up our parent directories. diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index b166be1e..f2130d78 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -68,8 +68,8 @@ class BuildDirTestCase(unittest.TestCase): f1 = fs.File('build/test1') fs.BuildDir('build', 'src') f2 = fs.File('build/test2') - assert f1.srcpath == 'src/test1', f1.srcpath - assert f2.srcpath == 'src/test2', f2.srcpath + assert f1.srcpath == os.path.normpath('src/test1'), f1.srcpath + assert f2.srcpath == os.path.normpath('src/test2'), f2.srcpath fs = SCons.Node.FS.FS() f1 = fs.File('build/test1') @@ -83,8 +83,8 @@ class BuildDirTestCase(unittest.TestCase): fs.BuildDir('build/var2', 'src') f1 = fs.File('build/var1/test1') f2 = fs.File('build/var2/test1') - assert f1.srcpath == 'src/test1', f1.srcpath - assert f2.srcpath == 'src/test1', f2.srcpath + assert f1.srcpath == os.path.normpath('src/test1'), f1.srcpath + assert f2.srcpath == os.path.normpath('src/test1'), f2.srcpath # Test to see if file_link() works... test=TestCmd(workdir='') diff --git a/test/BuildDir.py b/test/BuildDir.py index 78d2afcb..8f7c149d 100644 --- a/test/BuildDir.py +++ b/test/BuildDir.py @@ -93,11 +93,11 @@ main(int argc, char *argv[]) } """) -test.write('src/f1.h', """ +test.write('src/f1.h', r""" #define F1_STR "f1.c\n" """) -test.write('src/f2.h', """ +test.write('src/f2.h', r""" #define F2_STR "f2.c\n" """) diff --git a/test/Install.py b/test/Install.py index dce9990e..37d288c4 100644 --- a/test/Install.py +++ b/test/Install.py @@ -47,7 +47,7 @@ t=env.Program(target='foo2', source='f2.c') env.Install(dir='export', source=t) """) -test.write('f1.c', """ +test.write('f1.c', r""" #include int main(void) @@ -57,7 +57,7 @@ int main(void) } """) -test.write('f2.c', """ +test.write('f2.c', r""" #include int main(void) @@ -76,7 +76,7 @@ test.run(program = foo2, stdout = "f2.c\n") oldtime1 = os.path.getmtime(foo1) oldtime2 = os.path.getmtime(foo2) -test.write('f1.c', """ +test.write('f1.c', r""" #include int main(void) diff --git a/test/build-errors.py b/test/build-errors.py index e7bcdd7a..9f09ea02 100644 --- a/test/build-errors.py +++ b/test/build-errors.py @@ -25,7 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os -import os.path +import string import TestCmd import TestSCons @@ -44,7 +44,7 @@ test.write('SConstruct1', r""" bld = Builder(name = 'bld', action = '%s $SOURCES $TARGET') env = Environment(BUILDERS = [bld]) env.bld(target = 'f1', source = 'f1.in') -""" % os.path.normpath(no_such_file)) +""" % string.replace(no_such_file, '\\', '\\\\')) test.run(arguments='-f SConstruct1 .', stdout = "%s f1.in f1\n" % no_such_file, @@ -56,7 +56,7 @@ test.write('SConstruct2', r""" bld = Builder(name = 'bld', action = '%s $SOURCES $TARGET') env = Environment(BUILDERS = [bld]) env.bld(target = 'f2', source = 'f2.in') -""" % os.path.normpath(not_executable)) +""" % string.replace(not_executable, '\\', '\\\\')) if os.name == 'nt': expect = """scons: %s: No such file or directory @@ -75,7 +75,7 @@ test.write('SConstruct3', r""" bld = Builder(name = 'bld', action = '%s $SOURCES $TARGET') env = Environment(BUILDERS = [bld]) env.bld(target = 'f3', source = 'f3.in') -""" % os.path.normpath(test.workdir)) +""" % string.replace(test.workdir, '\\', '\\\\')) test.run(arguments='-f SConstruct3 .', stdout = "%s f3.in f3\n" % test.workdir,