diff options
Diffstat (limited to 'test/scons-time/obj')
-rw-r--r-- | test/scons-time/obj/chdir.py | 57 | ||||
-rw-r--r-- | test/scons-time/obj/file.py | 71 | ||||
-rw-r--r-- | test/scons-time/obj/format-gnuplot.py | 76 | ||||
-rw-r--r-- | test/scons-time/obj/glob.py | 52 | ||||
-rw-r--r-- | test/scons-time/obj/help.py | 57 | ||||
-rw-r--r-- | test/scons-time/obj/no-args.py | 42 | ||||
-rw-r--r-- | test/scons-time/obj/no-files.py | 44 | ||||
-rw-r--r-- | test/scons-time/obj/prefix.py | 62 | ||||
-rw-r--r-- | test/scons-time/obj/stage.py | 88 | ||||
-rw-r--r-- | test/scons-time/obj/tail.py | 55 |
10 files changed, 604 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..5e7df89 --- /dev/null +++ b/test/scons-time/obj/chdir.py @@ -0,0 +1,57 @@ +#!/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 xrange(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() diff --git a/test/scons-time/obj/file.py b/test/scons-time/obj/file.py new file mode 100644 index 0000000..c881397 --- /dev/null +++ b/test/scons-time/obj/file.py @@ -0,0 +1,71 @@ +#!/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' +""") + +expect2 = \ +r"""set title "ST2.CONF TITLE" +set key bottom left +plot '-' title "Startup" with lines lt 1 +# Startup +1 16040.000 +2 16040.000 +e +""" + +test.run(arguments = 'obj --file st2.conf --fmt gnuplot Node.FS.Base', stdout = expect2) + + +test.pass_test() diff --git a/test/scons-time/obj/format-gnuplot.py b/test/scons-time/obj/format-gnuplot.py new file mode 100644 index 0000000..b47d843 --- /dev/null +++ b/test/scons-time/obj/format-gnuplot.py @@ -0,0 +1,76 @@ +#!/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() diff --git a/test/scons-time/obj/glob.py b/test/scons-time/obj/glob.py new file mode 100644 index 0000000..4af2854 --- /dev/null +++ b/test/scons-time/obj/glob.py @@ -0,0 +1,52 @@ +#!/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 xrange(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() diff --git a/test/scons-time/obj/help.py b/test/scons-time/obj/help.py new file mode 100644 index 0000000..95abad6 --- /dev/null +++ b/test/scons-time/obj/help.py @@ -0,0 +1,57 @@ +#!/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('Standard output', test.stdout(), expect) + +test.run(arguments = 'obj -?') + +test.must_contain_all_lines('Standard output', test.stdout(), expect) + +test.run(arguments = 'obj --help') + +test.must_contain_all_lines('Standard output', test.stdout(), expect) + +test.run(arguments = 'help obj') + +test.must_contain_all_lines('Standard output', test.stdout(), expect) + +test.pass_test() diff --git a/test/scons-time/obj/no-args.py b/test/scons-time/obj/no-args.py new file mode 100644 index 0000000..a4d3f84 --- /dev/null +++ b/test/scons-time/obj/no-args.py @@ -0,0 +1,42 @@ +#!/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() diff --git a/test/scons-time/obj/no-files.py b/test/scons-time/obj/no-files.py new file mode 100644 index 0000000..cd91ceb --- /dev/null +++ b/test/scons-time/obj/no-files.py @@ -0,0 +1,44 @@ +#!/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() diff --git a/test/scons-time/obj/prefix.py b/test/scons-time/obj/prefix.py new file mode 100644 index 0000000..8005dc4 --- /dev/null +++ b/test/scons-time/obj/prefix.py @@ -0,0 +1,62 @@ +#!/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 xrange(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() diff --git a/test/scons-time/obj/stage.py b/test/scons-time/obj/stage.py new file mode 100644 index 0000000..5dbd15b --- /dev/null +++ b/test/scons-time/obj/stage.py @@ -0,0 +1,88 @@ +#!/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() diff --git a/test/scons-time/obj/tail.py b/test/scons-time/obj/tail.py new file mode 100644 index 0000000..0483d89 --- /dev/null +++ b/test/scons-time/obj/tail.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__" + +""" +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 xrange(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() |