summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-02-05 22:06:52 (GMT)
committerSteven Knight <knight@baldmt.com>2003-02-05 22:06:52 (GMT)
commit1321ef0af677827deb274d698d06ffa8b73010b0 (patch)
tree12db09379f94382c56b55b9050e5e59950344867 /test
parent15e31b8bda9f093971af3c3b0136b043ebb02746 (diff)
downloadSCons-1321ef0af677827deb274d698d06ffa8b73010b0.zip
SCons-1321ef0af677827deb274d698d06ffa8b73010b0.tar.gz
SCons-1321ef0af677827deb274d698d06ffa8b73010b0.tar.bz2
Change the default behavior when no arguments are specified to building everything in (or below) the current directory.
Diffstat (limited to 'test')
-rw-r--r--test/Default.py59
-rw-r--r--test/no-arguments.py12
-rw-r--r--test/option-u.py2
3 files changed, 58 insertions, 15 deletions
diff --git a/test/Default.py b/test/Default.py
index 1c7a638..d2c438f 100644
--- a/test/Default.py
+++ b/test/Default.py
@@ -24,6 +24,10 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""
+Verify various combinations of arguments to Default() work properly.
+"""
+
import os
import sys
import TestSCons
@@ -32,7 +36,13 @@ python = TestSCons.python
test = TestSCons.TestSCons()
-test.subdir('one', 'two', 'three', 'four', 'five')
+for dir in ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight']:
+
+ test.subdir(dir)
+
+ test.write(os.path.join(dir, 'foo.in'), dir + "/foo.in\n");
+
+ test.write(os.path.join(dir, 'bar.in'), dir + "/bar.in\n");
test.write('build.py', r"""
import sys
@@ -42,6 +52,7 @@ file.write(contents)
file.close()
""")
+#
test.write(['one', 'SConstruct'], """
B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
env = Environment(BUILDERS = { 'B' : B })
@@ -85,13 +96,6 @@ Default(env.B(target = 'bar.out', source = 'bar.in'))
for dir in ['one', 'two', 'three', 'four', 'five']:
- foo_in = os.path.join(dir, 'foo.in')
- bar_in = os.path.join(dir, 'bar.in')
-
- test.write(foo_in, dir + "/foo.in\n");
-
- test.write(bar_in, dir + "/bar.in\n");
-
test.run(chdir = dir) # no arguments, use the Default
test.fail_test(test.read(test.workpath('one', 'foo.out')) != "one/foo.in\n")
@@ -112,6 +116,45 @@ test.fail_test(test.read(test.workpath('five', 'bar.out')) != "five/bar.in\n")
+# Test how a None Default() argument works to disable/reset default targets.
+test.write(['six', 'SConstruct'], """\
+B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+env = Environment(BUILDERS = { 'B' : B })
+foo = env.B(target = 'foo.out', source = 'foo.in')
+bar = env.B(target = 'bar.out', source = 'bar.in')
+Default(None)
+""" % python)
+
+test.run(chdir = 'six', status = 2, stderr =
+"scons: *** No targets specified and no Default() targets found. Stop.\n")
+
+test.write(['seven', 'SConstruct'], """\
+B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+env = Environment(BUILDERS = { 'B' : B })
+foo = env.B(target = 'foo.out', source = 'foo.in')
+bar = env.B(target = 'bar.out', source = 'bar.in')
+Default(foo, bar, None)
+""" % python)
+
+test.run(chdir = 'seven', status = 2, stderr =
+"scons: *** No targets specified and no Default() targets found. Stop.\n")
+
+test.write(['eight', 'SConstruct'], """\
+B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+env = Environment(BUILDERS = { 'B' : B })
+foo = env.B(target = 'foo.out', source = 'foo.in')
+bar = env.B(target = 'bar.out', source = 'bar.in')
+Default(foo, None, bar)
+""" % python)
+
+test.run(chdir = 'eight') # no arguments, use the Default
+
+test.fail_test(os.path.exists(test.workpath('eight', 'foo.out')))
+test.fail_test(test.read(test.workpath('eight', 'bar.out')) != "eight/bar.in\n")
+
+
+
+
test.subdir('sub1')
test.write('SConstruct', """
diff --git a/test/no-arguments.py b/test/no-arguments.py
index acd590a..602ef80 100644
--- a/test/no-arguments.py
+++ b/test/no-arguments.py
@@ -24,6 +24,12 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""
+Verify that we use a default target of the current directory when there
+are no command-line arguments (and, implicitly, no Default() in the
+SConstruct).
+"""
+
import os.path
import TestSCons
@@ -47,13 +53,9 @@ env.Build('aaa.out', 'aaa.in')
test.write('aaa.in', "aaa.in\n")
#
-test.run(arguments = '.')
+test.run()
test.fail_test(test.read('aaa.out') != "aaa.in\n")
#
-test.run(status = 2, stderr =
-"scons: *** No targets specified and no Default() targets found. Stop.\n")
-
-#
test.pass_test()
diff --git a/test/option-u.py b/test/option-u.py
index f90e258..1f7df7a 100644
--- a/test/option-u.py
+++ b/test/option-u.py
@@ -44,11 +44,9 @@ file.close()
""")
test.write('SConstruct', """
-import SCons.Defaults
env = Environment()
env['BUILDERS']['B'] = Builder(action=r'%s build.py $TARGET $SOURCES')
env.B(target = 'sub1/foo.out', source = 'sub1/foo.in')
-Default('.')
Export('env')
SConscript('sub2/SConscript')
env.Alias('baz', env.B(target = 'sub3/baz.out', source = 'sub3/baz.in'))