From 98792e70711bb39b7862e4427c09787aab691631 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Sun, 27 Apr 2003 03:41:27 +0000 Subject: Follow-up test portability fixes for IRIX. (Chad Austin) --- src/engine/SCons/Util.py | 4 ++++ src/engine/SCons/UtilTests.py | 8 ++++++-- test/CVS.py | 3 ++- test/LIBS.py | 2 +- test/build-errors.py | 13 +++++++++++++ test/option-c.py | 4 ++-- 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index a570a71..47aa37e 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -861,6 +861,10 @@ def dir_index(directory): for file in os.listdir(directory): fullname = os.path.join(directory, file) files.append(fullname) + + # os.listdir() isn't guaranteed to return files in any specific order, + # but some of the test code expects sorted output. + files.sort() return files def fs_delete(path, remove=1): diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py index 5f0eaa8..b7aa478 100644 --- a/src/engine/SCons/UtilTests.py +++ b/src/engine/SCons/UtilTests.py @@ -631,21 +631,25 @@ class UtilTestCase(unittest.TestCase): test = TestCmd.TestCmd(workdir = '') base = test.workpath('') xxx = test.workpath('xxx.xxx') + ZZZ = test.workpath('ZZZ.ZZZ') sub1_yyy = test.workpath('sub1', 'yyy.yyy') + test.subdir('sub1') test.write(xxx, "\n") + test.write(ZZZ, "\n") test.write(sub1_yyy, "\n") old_stdout = sys.stdout sys.stdout = OutBuffer() - exp = "Removed " + os.path.join(base, sub1_yyy) + '\n' + \ + exp = "Removed " + os.path.join(base, ZZZ) + "\n" + \ + "Removed " + os.path.join(base, sub1_yyy) + '\n' + \ "Removed directory " + os.path.join(base, 'sub1') + '\n' + \ "Removed " + os.path.join(base, xxx) + '\n' + \ "Removed directory " + base + '\n' SCons.Util.fs_delete(base, remove=0) - assert sys.stdout.buffer == exp + assert sys.stdout.buffer == exp, sys.stdout.buffer assert os.path.exists(sub1_yyy) sys.stdout.buffer = "" diff --git a/test/CVS.py b/test/CVS.py index 1296c5e..33fbe0f 100644 --- a/test/CVS.py +++ b/test/CVS.py @@ -233,7 +233,8 @@ test.fail_test(not is_writable(test.workpath('work2', 'sub', 'fff.in'))) test.subdir(['work3']) test.write(['work3', 'SConstruct'], """\ -env = Environment() +import os +env = Environment(ENV = { 'PATH' : os.environ['PATH'] }) env.SourceCode('.', env.CVS(':pserver:anonymous:@cvs.sourceforge.net:/cvsroot/scons')) env.Install('install', 'scons/SConstruct') """) diff --git a/test/LIBS.py b/test/LIBS.py index 7a99f68..c9bcecd 100644 --- a/test/LIBS.py +++ b/test/LIBS.py @@ -123,7 +123,7 @@ 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.' +sw = 'ld32: WARNING 84 : ./libbaz.a is not used for resolving any symbol.\n' test.fail_test(not test.stderr() in ['', sw]) test.run(program=foo_exe, stdout='sub1/bar.c\nsub1/baz.c\n') diff --git a/test/build-errors.py b/test/build-errors.py index 2cec416..ac6e066 100644 --- a/test/build-errors.py +++ b/test/build-errors.py @@ -26,6 +26,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import string +import sys import TestCmd import TestSCons @@ -71,6 +72,10 @@ if os.name == 'nt': unspecified % 'f1' ] test.fail_test(not test.stderr() in errs) +elif string.find(sys.platform, 'irix') != -1: + test.fail_test(test.stderr() != """sh: %s: not found +scons: *** [f1] Error 127 +""" % no_such_file) else: test.fail_test(test.stderr() != """sh: %s: No such file or directory scons: *** [f1] Error 127 @@ -96,6 +101,10 @@ if os.name == 'nt': unspecified % 'f2' ] test.fail_test(not test.stderr() in errs) +elif string.find(sys.platform, 'irix') != -1: + test.fail_test(test.stderr() != """sh: %s: cannot execute +scons: *** [f2] Error 126 +""" % not_executable) else: test.fail_test(test.stderr() != """sh: %s: Permission denied scons: *** [f2] Error 126 @@ -120,6 +129,10 @@ if os.name == 'nt': unspecified % 'f3' ] test.fail_test(not test.stderr() in errs) +elif string.find(sys.platform, 'irix') != -1: + test.fail_test(test.stderr() != """sh: %s: cannot execute +scons: *** [f3] Error 126 +""" % test.workdir) else: test.fail_test(test.stderr() != """sh: %s: is a directory scons: *** [f3] Error 126 diff --git a/test/option-c.py b/test/option-c.py index 6501d75..d545b10 100644 --- a/test/option-c.py +++ b/test/option-c.py @@ -193,7 +193,7 @@ Removed foo3.out Removed %s Removed %s Removed directory subd -""" % (os.path.join('subd','foon.in'), os.path.join('subd', 'SConscript'))) +""" % (os.path.join('subd', 'SConscript'), os.path.join('subd','foon.in'))) test.run(arguments = '-c -n .', stdout=expect) expect = test.wrap_stdout("""Removed foo1.out @@ -202,7 +202,7 @@ Removed foo3.out Removed %s Removed %s Removed directory subd -""" % (os.path.join('subd','foon.in'), os.path.join('subd', 'SConscript'))) +""" % (os.path.join('subd','SConscript'), os.path.join('subd', 'foon.in'))) test.run(arguments = '-c .', stdout=expect) test.fail_test(os.path.exists(test.workpath('subdir', 'foon.in'))) test.fail_test(os.path.exists(test.workpath('subdir'))) -- cgit v0.12