summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGary Oberbrunner <garyo@oberbrunner.com>2013-11-02 20:27:42 (GMT)
committerGary Oberbrunner <garyo@oberbrunner.com>2013-11-02 20:27:42 (GMT)
commitcc202cdc15cd156c458ad9a2f94b2e9145be3ec2 (patch)
tree69c4681b26c8c9d2e94d7c7d24bbe764ec19e4ad /test
parent6660a1b75c021994ccf352bb5314935d533b7994 (diff)
parent54eaf41e5eadd05c73b0ad21223f73c4ed47684f (diff)
downloadSCons-cc202cdc15cd156c458ad9a2f94b2e9145be3ec2.zip
SCons-cc202cdc15cd156c458ad9a2f94b2e9145be3ec2.tar.gz
SCons-cc202cdc15cd156c458ad9a2f94b2e9145be3ec2.tar.bz2
Merge pull request #88: various usability enhancements
* Allow multiple --debug= values * Add support for a readonly cache (--cache-readonly) * Always print stats if requested * Generally try harder to print out a message on build errors
Diffstat (limited to 'test')
-rw-r--r--test/Pseudo.py65
-rw-r--r--test/option/warn-dependency.py1
-rw-r--r--test/warning-TargetNotBuiltWarning.py55
3 files changed, 121 insertions, 0 deletions
diff --git a/test/Pseudo.py b/test/Pseudo.py
new file mode 100644
index 0000000..db3c30c
--- /dev/null
+++ b/test/Pseudo.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+# Firstly, build a pseudo target and make sure we get no warnings it
+# doesn't exist under any circumstances
+test.write('SConstruct', """
+env = Environment()
+env.Pseudo(env.Command('foo.out', [], '@echo boo'))
+""")
+
+test.run(arguments='-Q', stdout = 'boo\n')
+
+test.run(arguments='-Q --warning=target-not-built', stdout = "boo\n")
+
+# Now do the same thing again but create the target and check we get an
+# error if it exists after the build
+test.write('SConstruct', """
+env = Environment()
+env.Pseudo(env.Command('foo.out', [], Touch('$TARGET')))
+""")
+
+test.run(arguments='-Q', stdout = 'Touch("foo.out")\n', stderr = None,
+ status = 2)
+test.must_contain_all_lines(test.stderr(),
+ 'scons: *** Pseudo target foo.out must not exist')
+test.run(arguments='-Q --warning=target-not-built',
+ stdout = 'Touch("foo.out")\n',
+ stderr = None, status = 2)
+test.must_contain_all_lines(test.stderr(),
+ 'scons: *** Pseudo target foo.out must not exist')
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/option/warn-dependency.py b/test/option/warn-dependency.py
index 95d8fed..ca0c2aa 100644
--- a/test/option/warn-dependency.py
+++ b/test/option/warn-dependency.py
@@ -43,6 +43,7 @@ env=Environment()
env['BUILDERS']['test'] = Builder(action=build,
source_scanner=SCons.Defaults.ObjSourceScan)
env.test(target='foo', source='foo.c')
+env.Pseudo('foo')
""")
test.write("foo.c","""
diff --git a/test/warning-TargetNotBuiltWarning.py b/test/warning-TargetNotBuiltWarning.py
new file mode 100644
index 0000000..76fdc5c
--- /dev/null
+++ b/test/warning-TargetNotBuiltWarning.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+foo = Command('foo.out', [], '@echo boo')
+bill = Command('bill.out', [], Touch('$TARGET'))
+Depends(bill, foo)
+Alias('jim', bill)
+""")
+
+test.run(arguments='-Q jim', stdout = 'boo\nTouch("bill.out")\n')
+
+test.run(arguments='-Q jim --warning=target-not-built',
+ stdout = "boo\nscons: `jim' is up to date.\n",
+ stderr = None)
+test.must_contain_all_lines(test.stderr(),
+ 'scons: warning: Cannot find target foo.out after building')
+
+test.run(arguments='-Q jim --warning=target-not-built -n',
+ stdout = "scons: `jim' is up to date.\n")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: