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):
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 = ""
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')
""")
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')
import os
import string
+import sys
import TestCmd
import TestSCons
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
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
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
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
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')))