summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-08-27 02:56:22 (GMT)
committerSteven Knight <knight@baldmt.com>2003-08-27 02:56:22 (GMT)
commit4bc06f73db7d3edafabf4dc5677d8172b0e2e5f3 (patch)
tree0fc93b1daf62dcdd7893bbcc977cb73e8718693e
parentb9dfe8b36cfaed3823ddfaef5c89f83da80c7273 (diff)
downloadSCons-4bc06f73db7d3edafabf4dc5677d8172b0e2e5f3.zip
SCons-4bc06f73db7d3edafabf4dc5677d8172b0e2e5f3.tar.gz
SCons-4bc06f73db7d3edafabf4dc5677d8172b0e2e5f3.tar.bz2
Re-synchronize the CVS tree after a SourceForge file system catastrophe.
-rw-r--r--runtest.py7
-rw-r--r--src/engine/SCons/Node/FSTests.py4
-rw-r--r--test/AS.py17
-rw-r--r--test/BuildDir.py25
-rw-r--r--test/SConscript-build_dir.py2
-rw-r--r--test/build-errors.py99
6 files changed, 120 insertions, 34 deletions
diff --git a/runtest.py b/runtest.py
index 6508999..fd421ef 100644
--- a/runtest.py
+++ b/runtest.py
@@ -234,6 +234,13 @@ elif all:
keys = tdict.keys()
keys.sort()
tests = map(tdict.get, keys)
+else:
+ sys.stderr.write("""\
+runtest.py: No tests were specified on the command line.
+ List one or more tests, or use the -a option
+ to find and run all tests.
+""")
+
if package:
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index 17d037d..ded5e9a 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -476,7 +476,7 @@ class BuildDirTestCase(unittest.TestCase):
SCons.Node.FS.Link(fs.File(test.workpath('build/foo')),
fs.File(test.workpath('src/foo')),
None)
- os.chmod(test.workpath('src/foo'), ~stat.S_IRUSR)
+ os.chmod(test.workpath('src/foo'), stat.S_IRUSR | stat.S_IWRITE)
finally:
test.unlink( "src/foo" )
test.unlink( "build/foo" )
@@ -1080,7 +1080,7 @@ class FSTestCase(unittest.TestCase):
y = fs.File('dir/y')
t = y.target_from_source('pre-', '-suf')
- assert str(t) == 'dir/pre-y-suf', str(t)
+ assert str(t) == os.path.join('dir', 'pre-y-suf'), str(t)
z = fs.File('zz')
t = z.target_from_source('pre-', '-suf', lambda x: x[:-1])
diff --git a/test/AS.py b/test/AS.py
index 0bafdc1..1fdb964 100644
--- a/test/AS.py
+++ b/test/AS.py
@@ -330,6 +330,19 @@ nasm = test.where_is('nasm')
if nasm:
+ # Allow flexibility about the type of object/executable format
+ # needed on different systems. Format_map is a dict that maps
+ # sys.platform substrings to the correct argument for the nasm -f
+ # option. The default is "elf," which seems to be a reasonable
+ # lowest common denominator (works on both Linux and FreeBSD,
+ # anyway...).
+ nasm_format = 'elf'
+ format_map = {}
+ for k, v in format_map.items():
+ if string.find(sys.platform, k) != -1:
+ nasm_format = v
+ break
+
test.write("wrapper.py",
"""import os
import string
@@ -340,11 +353,11 @@ os.system(string.join(sys.argv[1:], " "))
test.write('SConstruct', """
eee = Environment(tools = ['gcc', 'gnulink', 'nasm'],
- ASFLAGS = '-f aout')
+ ASFLAGS = '-f %s')
fff = eee.Copy(AS = r'%s wrapper.py ' + WhereIs('nasm'))
eee.Program(target = 'eee', source = ['eee.asm', 'eee_main.c'])
fff.Program(target = 'fff', source = ['fff.asm', 'fff_main.c'])
-""" % python)
+""" % (nasm_format, python))
test.write('eee.asm',
"""
diff --git a/test/BuildDir.py b/test/BuildDir.py
index 63ecf6e..bca4104 100644
--- a/test/BuildDir.py
+++ b/test/BuildDir.py
@@ -213,7 +213,21 @@ test.write(['work1', 'src', 'b2.for'], r"""
PRINT *, 'b2.for'
""")
-test.run(chdir='work1', arguments = '. ../build')
+# Some releases of freeBSD seem to have library complaints about
+# tempnam(). Filter out these annoying messages before checking for
+# error output.
+def blank_output(err):
+ if not err:
+ return 1
+ stderrlines = filter(lambda l: l, string.split(err, '\n'))
+ msg = "warning: tempnam() possibly used unsafely"
+ stderrlines = filter(lambda l, msg=msg: string.find(l, msg) == -1,
+ stderrlines)
+ return len(stderrlines) == 0
+
+test.run(chdir='work1', arguments = '. ../build', stderr=None)
+
+test.fail_test(not blank_output(test.stderr()))
test.run(program = foo11, stdout = "f1.c\n")
test.run(program = foo12, stdout = "f2.c\n")
@@ -289,7 +303,9 @@ test.write(['work1', 'src', 'f4h.in'], r"""
#define F4_STR "f4.c 2\n"
""")
-test.run(chdir='work1', arguments = '../build/var5')
+test.run(chdir='work1', arguments = '../build/var5', stderr=None)
+
+test.fail_test(not blank_output(test.stderr()))
test.run(program = foo51, stdout = "f1.c 2\n")
test.run(program = test.workpath('build', 'var5', 'foo3' + _exe),
@@ -334,7 +350,9 @@ Import('env')
env.Program('prog.c')
""")
-test.run(chdir='work2', arguments='.')
+test.run(chdir='work2', arguments='.', stderr=None)
+
+test.fail_test(not blank_output(test.stderr()))
test.up_to_date(chdir='work2', arguments='.')
@@ -365,4 +383,3 @@ non_existing.h:
""")
test.pass_test()
-
diff --git a/test/SConscript-build_dir.py b/test/SConscript-build_dir.py
index d67fdac..0ae3583 100644
--- a/test/SConscript-build_dir.py
+++ b/test/SConscript-build_dir.py
@@ -217,7 +217,7 @@ bar(void) {
}
""")
-test.write(['test2', 'foo.c'], """\
+test.write(['test2', 'foo.c'], r"""
int
main(int argc, char *argv[]) {
bar();
diff --git a/test/build-errors.py b/test/build-errors.py
index e4e1666..9acbefb 100644
--- a/test/build-errors.py
+++ b/test/build-errors.py
@@ -52,18 +52,57 @@ test.run(arguments='-f SConstruct1 .',
stderr = None,
status = 2)
-bad_command = "Bad command or file name\n"
+bad_command = """\
+Bad command or file name
+"""
-unrecognized = """'%s' is not recognized as an internal or external command,
+unrecognized = """\
+'%s' is not recognized as an internal or external command,
operable program or batch file.
scons: *** [%s] Error 1
"""
-unspecified = """The name specified is not recognized as an
+unspecified = """\
+The name specified is not recognized as an
internal or external command, operable program or batch file.
scons: *** [%s] Error 1
"""
+not_found_1 = """
+sh: %s: not found
+scons: *** [%s] Error 1
+"""
+
+not_found_2 = """
+sh: %s: not found
+scons: *** [%s] Error 1
+"""
+
+No_such = """\
+%s: No such file or directory
+scons: *** [%s] Error 127
+"""
+
+cannot_execute = """\
+%s: cannot execute
+scons *** [%s] Error 126
+"""
+
+Permission_denied = """\
+%s: Permission denied
+scons: *** [%s] Error 126
+"""
+
+permission_denied = """\
+%s: permission denied
+scons: *** [%s] Error 126
+"""
+
+is_a_directory = """\
+%s: is a directory
+scons: *** [%s] Error 126
+"""
+
test.description_set("Incorrect STDERR:\n%s\n" % test.stderr())
if os.name == 'nt':
errs = [
@@ -72,15 +111,18 @@ 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(string.find(test.stderr(), """%s: No such file or directory
-scons: *** [f1] Error 127
-""" % no_such_file) == -1)
-
+ errs = [
+ not_found_1 % (no_such_file, 'f1'),
+ not_found_2 % (no_such_file, 'f1'),
+ No_such % (no_such_file, 'f1'),
+ ]
+ error_message_not_found = 1
+ for err in errs:
+ if string.find(test.stderr(), err) != -1:
+ error_message_not_found = None
+ break
+ test.fail_test(error_message_not_found)
test.write('SConstruct2', r"""
bld = Builder(action = '%s $SOURCES $TARGET')
@@ -101,14 +143,18 @@ 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(string.find(test.stderr(), """%s: Permission denied
-scons: *** [f2] Error 126
-""" % not_executable) == -1)
+ errs = [
+ cannot_execute % (not_executable, 'f2'),
+ Permission_denied % (not_executable, 'f2'),
+ permission_denied % (not_executable, 'f2'),
+ ]
+ error_message_not_found = 1
+ for err in errs:
+ if string.find(test.stderr(), err) != -1:
+ error_message_not_found = None
+ break
+ test.fail_test(error_message_not_found)
test.write('SConstruct3', r"""
bld = Builder(action = '%s $SOURCES $TARGET')
@@ -129,13 +175,16 @@ 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(string.find(test.stderr(), """%s: is a directory
-scons: *** [f3] Error 126
-""" % test.workdir) == -1)
+ errs = [
+ cannot_execute % (not_executable, 'f3'),
+ is_a_directory % (test.workdir, 'f3'),
+ ]
+ error_message_not_found = 1
+ for err in errs:
+ if string.find(test.stderr(), err) != -1:
+ error_message_not_found = None
+ break
+ test.fail_test(error_message_not_found)
test.pass_test()