Follow-up test portability fixes for IRIX. (Chad Austin)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 27 Apr 2003 03:41:27 +0000 (03:41 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 27 Apr 2003 03:41:27 +0000 (03:41 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@660 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Util.py
src/engine/SCons/UtilTests.py
test/CVS.py
test/LIBS.py
test/build-errors.py
test/option-c.py

index a570a716daa5b9a297dd7a1f27273e029e23b899..47aa37e911c7e8bc2da704e35d2945524605b4a6 100644 (file)
@@ -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):
index 5f0eaa8c35ef63b17b81f8804379eca2e4b6d3b2..b7aa4786d32fcd45a0beb6ede994ccf534340d7a 100644 (file)
@@ -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 = ""
index 1296c5e13c7339213633f2f6cceb03117880e2f7..33fbe0fb0f23c42bd362a5fce96300a12383af18 100644 (file)
@@ -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')
 """)
index 7a99f6883a407a3135a44403452fdd766f66e1b4..c9bcecdd41b5be7552bfe4aad654070d14975897 100644 (file)
@@ -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')
index 2cec416e349b390b16b316be38a999ff2d5fba1f..ac6e066a67c4c35f226fb955266b37c73e763016 100644 (file)
@@ -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
index 6501d757327470b7b7c5e081ca9f17054e394235..d545b102795626890e3a65210e88c8e69ee647ef 100644 (file)
@@ -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')))