summaryrefslogtreecommitdiffstats
path: root/test/option
diff options
context:
space:
mode:
Diffstat (limited to 'test/option')
-rw-r--r--test/option/debug-dtree.py2
-rw-r--r--test/option/debug-findlibs.py13
-rw-r--r--test/option/debug-includes.py2
-rw-r--r--test/option/debug-stacktrace.py21
-rw-r--r--test/option/debug-stree.py2
-rw-r--r--test/option/debug-time.py2
-rw-r--r--test/option/debug-tree.py2
-rw-r--r--test/option/profile.py24
8 files changed, 53 insertions, 15 deletions
diff --git a/test/option/debug-dtree.py b/test/option/debug-dtree.py
index 0a7f4d2..06296b9 100644
--- a/test/option/debug-dtree.py
+++ b/test/option/debug-dtree.py
@@ -43,6 +43,8 @@ env.Program('foo', Split('foo.c bar.c'))
""")
test.write('foo.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
#include "foo.h"
int main(int argc, char *argv[])
{
diff --git a/test/option/debug-findlibs.py b/test/option/debug-findlibs.py
index b18841b..4220402 100644
--- a/test/option/debug-findlibs.py
+++ b/test/option/debug-findlibs.py
@@ -24,12 +24,15 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import TestSCons
import sys
import string
import re
import time
+import TestSCons
+
+_python_ = TestSCons._python_
+
test = TestSCons.TestSCons()
test.subdir('sub1', 'sub2')
@@ -49,9 +52,9 @@ env = Environment(OBJSUFFIX = '.ooo', PROGSUFFIX = '.xxx',
LIBS = ['iii', 'jjj', 'kkk', 'lll', 'mmm'],
LIBPREFIXES = ['a-', 'b-', 'c-'],
LIBSUFFIXES = ['.aaa', '.bbb', '.ccc'],
- LINKCOM = '%(python)s cat.py $TARGET $SOURCES')
+ LINKCOM = '%(_python_)s cat.py $TARGET $SOURCES')
env.Program('foo', 'a.ooo',)
-""" % {'python' : TestSCons.python})
+""" % locals())
test.write('a.ooo', "a.ooo\n")
@@ -198,8 +201,8 @@ test.run(arguments = "--debug=findlibs foo.xxx",
findlibs: looking for 'c-mmm.ccc' in 'sub1' ...
findlibs: looking for 'c-mmm.ccc' in 'sub2' ...
findlibs: looking for 'c-mmm.ccc' in '.' ...
-%(python)s cat.py foo.xxx a.ooo
-""" % {'python' : TestSCons.python}))
+%(_python_)s cat.py foo.xxx a.ooo
+""" % locals()))
test.must_match('foo.xxx', "a.ooo\n")
diff --git a/test/option/debug-includes.py b/test/option/debug-includes.py
index eb7f818..52d64a9 100644
--- a/test/option/debug-includes.py
+++ b/test/option/debug-includes.py
@@ -43,6 +43,8 @@ env.Program('foo', Split('foo.c bar.c'))
""")
test.write('foo.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
#include "foo.h"
int main(int argc, char *argv[])
{
diff --git a/test/option/debug-stacktrace.py b/test/option/debug-stacktrace.py
index 1a3052a..aff25f2 100644
--- a/test/option/debug-stacktrace.py
+++ b/test/option/debug-stacktrace.py
@@ -114,4 +114,25 @@ if err and must_contain_all_lines(test.stderr(), inner_lines):
+# Test that full path names to SConscript files show up in stack traces.
+
+test.write('SConstruct', """\
+1/0
+""")
+
+test.run(arguments = '--debug=stacktrace',
+ status = 2,
+ stderr = None)
+
+lines = [
+ ' File "%s", line 1:' % test.workpath('SConstruct'),
+]
+
+err = must_contain_all_lines(test.stderr(), lines)
+if err:
+ print string.join(err, '')
+ test.fail_test(1)
+
+
+
test.pass_test()
diff --git a/test/option/debug-stree.py b/test/option/debug-stree.py
index 69aab06..8ffadc6 100644
--- a/test/option/debug-stree.py
+++ b/test/option/debug-stree.py
@@ -43,6 +43,8 @@ env.Program('foo', Split('foo.c bar.c'))
""")
test.write('foo.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
#include "foo.h"
int main(int argc, char *argv[])
{
diff --git a/test/option/debug-time.py b/test/option/debug-time.py
index 5766cff..b1471ba 100644
--- a/test/option/debug-time.py
+++ b/test/option/debug-time.py
@@ -38,6 +38,8 @@ env.Program('foo', Split('foo.c bar.c'))
""")
test.write('foo.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
#include "foo.h"
int main(int argc, char *argv[])
{
diff --git a/test/option/debug-tree.py b/test/option/debug-tree.py
index faf85d9..4f025c2 100644
--- a/test/option/debug-tree.py
+++ b/test/option/debug-tree.py
@@ -47,6 +47,8 @@ env.Program('Foo', Split('Foo.c Bar.c'))
# (UNIX/Linux) and case-insensitive (Windows) systems.
test.write('Foo.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
#include "Foo.h"
int main(int argc, char *argv[])
{
diff --git a/test/option/profile.py b/test/option/profile.py
index b6a0027..9207066 100644
--- a/test/option/profile.py
+++ b/test/option/profile.py
@@ -33,7 +33,11 @@ import TestSCons
test = TestSCons.TestSCons()
-test.write('SConstruct', "\n")
+test.write('SConstruct', """\
+Command('file.out', 'file.in', Copy("$TARGET", "$SOURCE"))
+""")
+
+test.write('file.in', "file.in\n")
scons_prof = test.workpath('scons.prof')
@@ -63,30 +67,30 @@ test.fail_test(string.find(s, 'option_parser.py') == -1)
scons_prof = test.workpath('scons2.prof')
-test.run(arguments = "--profile %s -h" % scons_prof)
-test.fail_test(string.find(test.stdout(), 'usage: scons [OPTION]') == -1)
-test.fail_test(string.find(test.stdout(), 'Options:') == -1)
+test.run(arguments = "--profile %s" % scons_prof)
stats = pstats.Stats(scons_prof)
stats.sort_stats('time')
-sys.stdout = StringIO.StringIO()
+try:
+ save_stdout = sys.stdout
+ sys.stdout = StringIO.StringIO()
-stats.strip_dirs().print_stats()
+ stats.strip_dirs().print_stats()
-s = sys.stdout.getvalue()
+ s = sys.stdout.getvalue()
+finally:
+ sys.stdout = save_stdout
test.fail_test(string.find(s, 'Main.py') == -1)
-test.fail_test(string.find(s, 'print_help') == -1)
test.fail_test(string.find(s, '_main') == -1)
-test.fail_test(string.find(s, 'option_parser.py') == -1)
+test.fail_test(string.find(s, 'FS.py') == -1)
scons_prof = test.workpath('scons3.prof')
test.run(arguments = "--profile %s --debug=memory -h" % scons_prof)
-print test.stdout()
test.fail_test(string.find(test.stdout(), 'usage: scons [OPTION]') == -1)
test.fail_test(string.find(test.stdout(), 'Options:') == -1)