diff options
| author | William Deegan <bill@baddogconsulting.com> | 2015-09-21 17:03:12 (GMT) |
|---|---|---|
| committer | William Deegan <bill@baddogconsulting.com> | 2015-09-21 17:03:12 (GMT) |
| commit | 0941093e0e5a030faa49968457638a3a6aee7ad8 (patch) | |
| tree | 6d33513c14eb6eac0531dd050de0ecca4c39bd79 /test/scons-time/obj | |
| download | SCons-2.4.0.zip SCons-2.4.0.tar.gz SCons-2.4.0.tar.bz2 | |
release 2.4.02.4.0
Diffstat (limited to 'test/scons-time/obj')
| -rw-r--r-- | test/scons-time/obj/chdir.py | 63 | ||||
| -rw-r--r-- | test/scons-time/obj/file.py | 84 | ||||
| -rw-r--r-- | test/scons-time/obj/format-gnuplot.py | 82 | ||||
| -rw-r--r-- | test/scons-time/obj/help.py | 63 | ||||
| -rw-r--r-- | test/scons-time/obj/no-args.py | 48 | ||||
| -rw-r--r-- | test/scons-time/obj/no-files.py | 50 | ||||
| -rw-r--r-- | test/scons-time/obj/objglob.py | 58 | ||||
| -rw-r--r-- | test/scons-time/obj/prefix.py | 68 | ||||
| -rw-r--r-- | test/scons-time/obj/stage.py | 94 | ||||
| -rw-r--r-- | test/scons-time/obj/tail.py | 61 |
10 files changed, 671 insertions, 0 deletions
diff --git a/test/scons-time/obj/chdir.py b/test/scons-time/obj/chdir.py new file mode 100644 index 0000000..4b77f8a --- /dev/null +++ b/test/scons-time/obj/chdir.py @@ -0,0 +1,63 @@ +#!/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__" + +""" +Verify that the obj -C and --chdir options change directory before +globbing for files. +""" + +import os.path + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.subdir('logs') + +lines = [ + ' pre-read post-read pre-build post-build\n' +] + +line_fmt = ' 1101%(i)s 1102%(i)s 1103%(i)s 1104%(i)s %(logfile_name)s\n' + +for i in range(9): + logfile_name = os.path.join('logs', 'foo-%s.log' % i) + test.fake_logfile(logfile_name, i) + lines.append(line_fmt % locals()) + +expect = ''.join(lines) + +test.run(arguments = 'obj -C logs Environment.Base foo-*.log', stdout = expect) + +test.run(arguments = 'obj --chdir logs Environment.Base foo-?.log', stdout = expect) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/obj/file.py b/test/scons-time/obj/file.py new file mode 100644 index 0000000..5076d7f --- /dev/null +++ b/test/scons-time/obj/file.py @@ -0,0 +1,84 @@ +#!/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__" + +""" +Verify that config files specified with the -f and --file options +affect how the obj subcommand processes things. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.fake_logfile('foo-001-0.log') + +test.fake_logfile('foo-002-0.log') + + +test.write('st1.conf', """\ +prefix = 'foo-001' +""") + +expect1 = """\ + pre-read post-read pre-build post-build + 16010 16020 16030 16040 foo-001-0.log +""" + +test.run(arguments = 'obj -f st1.conf Node.FS.Base', stdout = expect1) + + +test.write('st2.conf', """\ +prefix = 'foo' +title = 'ST2.CONF TITLE' +vertical_bars = ( + ( 1.5, 7, None ), +) +""") + +expect2 = \ +r"""set title "ST2.CONF TITLE" +set key bottom left +plot '-' title "Startup" with lines lt 1, \ + '-' notitle with lines lt 7 +# Startup +1 16040.000 +2 16040.000 +e +1.5 0 +1.5 18000 +e +""" + +test.run(arguments = 'obj --file st2.conf --fmt gnuplot Node.FS.Base', stdout = expect2) + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/obj/format-gnuplot.py b/test/scons-time/obj/format-gnuplot.py new file mode 100644 index 0000000..cdded16 --- /dev/null +++ b/test/scons-time/obj/format-gnuplot.py @@ -0,0 +1,82 @@ +#!/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__" + +""" +Verify the obj --format=gnuplot option. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.fake_logfile('foo-000-0.log', 0) +test.fake_logfile('foo-000-1.log', 0) +test.fake_logfile('foo-000-2.log', 0) + +test.fake_logfile('foo-001-0.log', 1) +test.fake_logfile('foo-001-1.log', 1) +test.fake_logfile('foo-001-2.log', 1) + +expect_notitle = """\ +set key bottom left +plot '-' title "Startup" with lines lt 1, \\ + '-' title "Full build" with lines lt 2, \\ + '-' title "Up-to-date build" with lines lt 3 +# Startup +0 20040.000 +1 20041.000 +e +# Full build +0 20040.000 +1 20041.000 +e +# Up-to-date build +0 20040.000 +1 20041.000 +e +""" + +expect_title = 'set title "TITLE"\n' + expect_notitle + +test.run(arguments = 'obj --fmt gnuplot Node.Node', + stdout=expect_notitle) + +test.run(arguments = 'obj --fmt=gnuplot --title TITLE Node.Node', + stdout=expect_title) + +test.run(arguments = 'obj --format gnuplot --title TITLE Node.Node', + stdout=expect_title) + +test.run(arguments = 'obj --format=gnuplot Node.Node', + stdout=expect_notitle) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/obj/help.py b/test/scons-time/obj/help.py new file mode 100644 index 0000000..d4cc1bd --- /dev/null +++ b/test/scons-time/obj/help.py @@ -0,0 +1,63 @@ +#!/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__" + +""" +Verify the "obj" subcommand help. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +expect = [ + "Usage: scons-time obj [OPTIONS] OBJECT FILE [...]\n", + " -C DIR, --chdir=DIR Change to DIR before looking for files\n", + " -h, --help Print this help and exit\n", +] + +test.run(arguments = 'obj -h') + +test.must_contain_all_lines(test.stdout(), expect) + +test.run(arguments = 'obj -?') + +test.must_contain_all_lines(test.stdout(), expect) + +test.run(arguments = 'obj --help') + +test.must_contain_all_lines(test.stdout(), expect) + +test.run(arguments = 'help obj') + +test.must_contain_all_lines(test.stdout(), expect) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/obj/no-args.py b/test/scons-time/obj/no-args.py new file mode 100644 index 0000000..9350b79 --- /dev/null +++ b/test/scons-time/obj/no-args.py @@ -0,0 +1,48 @@ +#!/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__" + +""" +Verify the error when no arguments are specified to the obj subcommand. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +expect = """\ +scons-time: obj: Must specify an object name. + Type "scons-time help obj" for help. +""" + +test.run(arguments = 'obj', status = 1, stderr = expect) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/obj/no-files.py b/test/scons-time/obj/no-files.py new file mode 100644 index 0000000..50e5df1 --- /dev/null +++ b/test/scons-time/obj/no-files.py @@ -0,0 +1,50 @@ +#!/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__" + +""" +Verify the error when the obj subcommand is passed object argument but no +file arguments. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +expect = """\ +scons-time: obj: No arguments specified. + No *.log files found in "%s". + Type "scons-time help obj" for help. +""" % test.workpath() + +test.run(arguments = 'obj fake.object', status = 1, stderr = expect) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/obj/objglob.py b/test/scons-time/obj/objglob.py new file mode 100644 index 0000000..2105355 --- /dev/null +++ b/test/scons-time/obj/objglob.py @@ -0,0 +1,58 @@ +#!/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__" + +""" +Verify that the obj subcommand globs for files. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +lines = [ + ' pre-read post-read pre-build post-build\n' +] + +line_fmt = ' 601%(i)s 602%(i)s 603%(i)s 604%(i)s %(logfile_name)s\n' + +for i in range(9): + logfile_name = 'foo-%s.log' % i + test.fake_logfile(logfile_name, i) + lines.append(line_fmt % locals()) + +expect = ''.join(lines) + +test.run(arguments = 'obj Builder.BuilderBase foo-*.log', stdout = expect) + +test.run(arguments = 'obj Builder.BuilderBase foo-?.log', stdout = expect) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/obj/prefix.py b/test/scons-time/obj/prefix.py new file mode 100644 index 0000000..0bee5f7 --- /dev/null +++ b/test/scons-time/obj/prefix.py @@ -0,0 +1,68 @@ +#!/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__" + +""" +Verify that the obj -p and --prefix options specify what log files to use. +""" + +import os.path + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.subdir('logs') + +header = ' pre-read post-read pre-build post-build\n' + +line_fmt = ' 11010 11020 11030 11040 %s\n' + +foo_lines = [ header ] +bar_lines = [ header ] + +for i in range(3): + logfile_name = os.path.join('foo-%s.log' % i) + test.fake_logfile(logfile_name) + foo_lines.append(line_fmt % logfile_name) + + logfile_name = os.path.join('bar-%s.log' % i) + test.fake_logfile(logfile_name) + bar_lines.append(line_fmt % logfile_name) + +foo_expect = ''.join(foo_lines) +bar_expect = ''.join(bar_lines) + +test.run(arguments = 'obj -p bar Environment.Base', stdout = bar_expect) + +test.run(arguments = 'obj --prefix=foo Environment.Base', stdout = foo_expect) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/obj/stage.py b/test/scons-time/obj/stage.py new file mode 100644 index 0000000..7361f69 --- /dev/null +++ b/test/scons-time/obj/stage.py @@ -0,0 +1,94 @@ +#!/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__" + +""" +Verify the obj --stage option. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.fake_logfile('foo-000-0.log', 0) +test.fake_logfile('foo-000-1.log', 0) +test.fake_logfile('foo-000-2.log', 0) + +test.fake_logfile('foo-001-0.log', 1) +test.fake_logfile('foo-001-1.log', 1) +test.fake_logfile('foo-001-2.log', 1) + +expect = """\ +set key bottom left +plot '-' title "Startup" with lines lt 1, \\ + '-' title "Full build" with lines lt 2, \\ + '-' title "Up-to-date build" with lines lt 3 +# Startup +0 50%(index)s0.000 +1 50%(index)s1.000 +e +# Full build +0 50%(index)s0.000 +1 50%(index)s1.000 +e +# Up-to-date build +0 50%(index)s0.000 +1 50%(index)s1.000 +e +""" + +pre_read = expect % {'index' : 1} +post_read = expect % {'index' : 2} +pre_build = expect % {'index' : 3} +post_build = expect % {'index' : 4} + +test.run(arguments = 'obj --fmt gnuplot --stage pre-read Action.ListAction', + stdout=pre_read) + +test.run(arguments = 'obj --fmt gnuplot --stage=post-read Action.ListAction', + stdout=post_read) + +test.run(arguments = 'obj --fmt gnuplot --stage=pre-build Action.ListAction', + stdout=pre_build) + +test.run(arguments = 'obj --fmt gnuplot --stage post-build Action.ListAction', + stdout=post_build) + +expect = """\ +scons-time: obj: Unrecognized stage "unknown". + Type "scons-time help obj" for help. +""" + +test.run(arguments = 'obj --fmt gnuplot --stage unknown', + status = 1, + stderr = expect) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/obj/tail.py b/test/scons-time/obj/tail.py new file mode 100644 index 0000000..341a905 --- /dev/null +++ b/test/scons-time/obj/tail.py @@ -0,0 +1,61 @@ +#!/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__" + +""" +Verify that the obj subcommand only prints results for the last number +of files specified with the -t and --tail options. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + + +header = ' pre-read post-read pre-build post-build\n' + +lines = [] + +line_fmt = ' 1501%(i)s 1502%(i)s 1503%(i)s 1504%(i)s %(logfile_name)s\n' + +for i in range(9): + logfile_name = 'foo-%s.log' % i + test.fake_logfile(logfile_name, i) + lines.append(line_fmt % locals()) + +expect3 = ''.join([header] + lines[-3:]) +expect5 = ''.join([header] + lines[-5:]) + +test.run(arguments = 'obj -t 3 Node.FS foo-*.log', stdout = expect3) + +test.run(arguments = 'obj --tail 5 Node.FS foo-*.log', stdout = expect5) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: |
