diff options
author | Steven Knight <knight@baldmt.com> | 2006-12-16 01:43:01 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2006-12-16 01:43:01 (GMT) |
commit | c4d04b3b45e7b71a1b28053b90084bcf2fdf9c0e (patch) | |
tree | 8a0d07c078ac21bf1ab689eacf06577069bb9231 /test/scons-time/run | |
parent | b32cd624a5ad9526d28584b8e6c4a7958f436424 (diff) | |
download | SCons-c4d04b3b45e7b71a1b28053b90084bcf2fdf9c0e.zip SCons-c4d04b3b45e7b71a1b28053b90084bcf2fdf9c0e.tar.gz SCons-c4d04b3b45e7b71a1b28053b90084bcf2fdf9c0e.tar.bz2 |
Merged revisions 1675-1736 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core
........
r1689 | stevenknight | 2006-11-06 20:56:29 -0600 (Mon, 06 Nov 2006) | 1 line
0.96.D483 - Merge changes for 0.96.93 packaging from the subsidiary branch.
........
r1690 | stevenknight | 2006-11-06 20:59:30 -0600 (Mon, 06 Nov 2006) | 1 line
0.96.D484 - Update HOWTO for releases. Fix name type in src/CHANGES.txt.
........
r1691 | stevenknight | 2006-11-08 13:55:36 -0600 (Wed, 08 Nov 2006) | 1 line
0.96.D485 - Fix MergeFlags() handling of None values. (John Pye)
........
r1692 | stevenknight | 2006-11-08 17:15:05 -0600 (Wed, 08 Nov 2006) | 1 line
0.96.D486 - Directly execute commands on Windows when possible. (Jay Kint)
........
r1693 | stevenknight | 2006-11-08 18:54:49 -0600 (Wed, 08 Nov 2006) | 1 line
0.96.D487 - Remove the semi-colon from the list of characters that determine when we use cmd
........
r1694 | stevenknight | 2006-11-09 01:34:06 -0600 (Thu, 09 Nov 2006) | 1 line
0.96.D488 - Pick up latex/bibtex 'Rerun to get citations correct' messages. (Dmitry Mikhin)
........
r1695 | stevenknight | 2006-11-11 08:36:33 -0600 (Sat, 11 Nov 2006) | 1 line
0.96.D489 - Back out the direct-execution-on-Windows change until we solve a corner case.
........
r1696 | stevenknight | 2006-11-15 10:33:10 -0600 (Wed, 15 Nov 2006) | 1 line
0.96.D490 - Fix the sconsign script when the .sconsign.dblite file is specified with its suf
........
r1697 | stevenknight | 2006-11-18 10:45:50 -0600 (Sat, 18 Nov 2006) | 4 lines
Complete move of test/sconsign/script.py to underneath test/sconsign/script/.
(This got left out of the previous checkin due to an error in the
script that resubmits Aegis changes to Subversion.)
........
r1698 | stevenknight | 2006-11-18 11:05:26 -0600 (Sat, 18 Nov 2006) | 1 line
0.96.D491 - Allow an Options converter to take the construction environment as a parameter.
........
r1699 | stevenknight | 2006-11-30 15:34:37 -0600 (Thu, 30 Nov 2006) | 1 line
0.96.D492 - Reverse the order in which we try the arguments Options converters, first a sing
........
r1700 | stevenknight | 2006-11-30 16:03:09 -0600 (Thu, 30 Nov 2006) | 1 line
0.96.D493 - Speed up rel_path() by avoiding recomputation of intermediate directory relative
........
r1701 | stevenknight | 2006-11-30 16:14:16 -0600 (Thu, 30 Nov 2006) | 1 line
0.96.D494 - More efficient get_suffix(): compute it once when we set the name.
........
r1702 | stevenknight | 2006-11-30 16:22:55 -0600 (Thu, 30 Nov 2006) | 1 line
0.96.D495 - Fix missing XML end tags.
........
r1703 | stevenknight | 2006-11-30 17:15:25 -0600 (Thu, 30 Nov 2006) | 1 line
0.96.D496 - Turn Memoizer into a simple counter for --debug=memoizer, not something that doe
........
r1704 | stevenknight | 2006-11-30 20:30:50 -0600 (Thu, 30 Nov 2006) | 1 line
0.96.D497 - Add the scons-time script, with doc and tests.
........
r1705 | stevenknight | 2006-11-30 23:28:20 -0600 (Thu, 30 Nov 2006) | 1 line
0.96.D498 - Update the copyright years string.
........
r1706 | stevenknight | 2006-12-01 11:54:22 -0600 (Fri, 01 Dec 2006) | 1 line
0.96.D499 - Fix _do_Lookup => _doLookup value-caching misspellings. (Ben Leslie)
........
r1707 | stevenknight | 2006-12-01 12:03:46 -0600 (Fri, 01 Dec 2006) | 1 line
0.96.D500 - Fix copyright test against debian build. (Walter Franzini)
........
r1708 | stevenknight | 2006-12-01 14:23:29 -0600 (Fri, 01 Dec 2006) | 1 line
0.96.D501 - Add #include lines for test portability. (Gary Oberbrunner)
........
r1709 | stevenknight | 2006-12-01 14:51:12 -0600 (Fri, 01 Dec 2006) | 1 line
0.96.D502 - Fix tests under Python versions with no profiler (pstats module).
........
r1710 | stevenknight | 2006-12-01 20:04:49 -0600 (Fri, 01 Dec 2006) | 1 line
0.96.D503 - Remove unnecessary os.path.normpath() calls. (Gary Oberbrunner)
........
r1711 | stevenknight | 2006-12-01 20:34:31 -0600 (Fri, 01 Dec 2006) | 1 line
0.96.D504 - Accomodate arbitray white space after a SWIG %module keyword. (Anonymous)
........
r1712 | stevenknight | 2006-12-05 14:49:54 -0600 (Tue, 05 Dec 2006) | 1 line
0.96.D506 - Cache substitutions of of Builder source suffixes. Use a new PathList module, and a refactor Node.FS.Rfindalldirs() method, to cache calculations of values like CPPPATH.
........
r1713 | stevenknight | 2006-12-05 18:43:36 -0600 (Tue, 05 Dec 2006) | 1 line
0.96.D507 - Use cached stat() values in diskchecks.
........
r1714 | stevenknight | 2006-12-05 21:11:24 -0600 (Tue, 05 Dec 2006) | 1 line
0.96.D508 - Fix Memoizer hit counts for methods memoizing simple values. Clean up the code for memoizing return values in a dictionary. Fix comments.
........
r1715 | stevenknight | 2006-12-06 07:23:18 -0600 (Wed, 06 Dec 2006) | 1 line
0.96.D369 - More efficient Node.FS.Dir.current() check. Fix some Windows test portability issues.
........
r1716 | stevenknight | 2006-12-06 12:24:32 -0600 (Wed, 06 Dec 2006) | 2 lines
Undo previous checkin (distributed incorrect Aegis change number).
........
r1717 | stevenknight | 2006-12-06 12:34:53 -0600 (Wed, 06 Dec 2006) | 1 line
0.96.D505 - Update ae-{cvs,svn}-ci for newer versions of aetar, and to not truncate descriptions.
........
r1718 | stevenknight | 2006-12-07 23:01:41 -0600 (Thu, 07 Dec 2006) | 1 line
0.96.D509 - Only look for mslink on Windows systems. (Sohail Somani)
........
r1719 | stevenknight | 2006-12-07 23:18:33 -0600 (Thu, 07 Dec 2006) | 1 line
0.96.D510 - Have the D compiler Tool use the same logic for shared libraries, too. (Paolo Invernizzi)
........
r1720 | stevenknight | 2006-12-07 23:29:47 -0600 (Thu, 07 Dec 2006) | 1 line
0.96.D511 - Generalize a JobTests.py test so it doesn't assume a specific order in which the operating system executes the threads.
........
r1721 | stevenknight | 2006-12-07 23:39:37 -0600 (Thu, 07 Dec 2006) | 1 line
0.96.D512 - Back out the Tool/dmd.py change; it breaks shared library linking for other lanuages beside D in the construction environment.
........
r1722 | stevenknight | 2006-12-07 23:47:11 -0600 (Thu, 07 Dec 2006) | 1 line
0.96.D513 - Test fixes: Windows portability, handle changes to Python 2.5 messages.
........
r1723 | stevenknight | 2006-12-08 00:00:13 -0600 (Fri, 08 Dec 2006) | 1 line
0.96.D514 - Change how the 'as' Tool is imported to accomodate the Python 2.6 'as' keyword.
........
r1724 | stevenknight | 2006-12-08 11:19:27 -0600 (Fri, 08 Dec 2006) | 1 line
0.96.D515 - Cache both Node.FS.find_file() and Node.FS.Dri.srcdir_find_file().
........
r1725 | stevenknight | 2006-12-08 17:27:35 -0600 (Fri, 08 Dec 2006) | 1 line
0.96.D516 - Better error when we try to fetch contents from an Entry that doesn't exist. (Tom Parker)
........
r1726 | stevenknight | 2006-12-08 23:28:55 -0600 (Fri, 08 Dec 2006) | 1 line
0.96.D517 - Make sure we pick up the scons-local directory regardless of where we chdir internally.
........
r1727 | stevenknight | 2006-12-11 16:25:53 -0600 (Mon, 11 Dec 2006) | 1 line
0.96.D518 - Cache results of Executor.get_unignored_sources() and Executor.process_sources(). Eliminate some map() and disambiguate() calls when scanning for implicit dependencies.
........
r1728 | stevenknight | 2006-12-12 14:32:22 -0600 (Tue, 12 Dec 2006) | 1 line
0.96.D519 - Fix SideEffect() when -j is used.
........
r1729 | stevenknight | 2006-12-12 16:58:15 -0600 (Tue, 12 Dec 2006) | 1 line
0.96.D520 - Add a srcdir keyword to Builder calls.
........
r1730 | stevenknight | 2006-12-12 21:40:59 -0600 (Tue, 12 Dec 2006) | 1 line
0.96.D521 - TeX/LaTeX updates, including handling files in subdirectories. (Joel B. Mohler, Rob Managan, Dmitry Mikhin)
........
r1731 | stevenknight | 2006-12-14 15:01:02 -0600 (Thu, 14 Dec 2006) | 1 line
0.96.D522 - Propogate TypeErrors during variable substitution for display to the user.
........
r1732 | stevenknight | 2006-12-14 20:01:49 -0600 (Thu, 14 Dec 2006) | 1 line
0.96.D523 - Fix the os.path.join() calls in EnvironmentTests.py.
........
r1733 | stevenknight | 2006-12-15 07:48:22 -0600 (Fri, 15 Dec 2006) | 1 line
0.96.D524 - Fix source directories as dependencies of an Alias (0.96.93 problem found by LilyPond).
........
r1735 | stevenknight | 2006-12-15 12:43:45 -0600 (Fri, 15 Dec 2006) | 1 line
0.96.D525 - Allow printing Debug.caller() output (or other end-of-run debugging info) when using -h.
........
r1736 | stevenknight | 2006-12-15 16:30:08 -0600 (Fri, 15 Dec 2006) | 1 line
0.96.D526 - Add an option to debug IndexError and NameError exceptions during variable substitution.
........
Diffstat (limited to 'test/scons-time/run')
26 files changed, 1712 insertions, 0 deletions
diff --git a/test/scons-time/run/aegis.py b/test/scons-time/run/aegis.py new file mode 100644 index 0000000..8f378cb --- /dev/null +++ b/test/scons-time/run/aegis.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 the ability to "check out" an SCons delta from a fake +Aegis utility. +""" + +import re + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_sample_project('foo.tar') + +my_aegis_py = test.write_fake_aegis_py('my_aegis.py') + +test.write('config', """\ +aegis = r'%(my_aegis_py)s' +""" % locals()) + +test.run(arguments = 'run -f config --aegis xyzzy.0.1 --number 321,329 foo.tar') + +test.must_exist('foo-321-0.log', + 'foo-321-0.prof', + 'foo-321-1.log', + 'foo-321-1.prof', + 'foo-321-2.log', + 'foo-321-2.prof') + +test.must_exist('foo-329-0.log', + 'foo-329-0.prof', + 'foo-329-1.log', + 'foo-329-1.prof', + 'foo-329-2.log', + 'foo-329-2.prof') + +def tempdir_re(*args): + import os + import os.path + import string + import tempfile + + sep = re.escape(os.sep) + args = (tempfile.gettempdir(), 'scons-time-aegis-',) + args + x = apply(os.path.join, args) + x = re.escape(x) + x = string.replace(x, 'aegis\\-', 'aegis\\-[^%s]*' % sep) + return x + +expect = [ + tempdir_re('src', 'script', 'scons.py'), + 'SCONS_LIB_DIR = %s' % tempdir_re('src', 'engine'), +] + +content = test.read(test.workpath('foo-321-2.log')) + +test.must_contain_all_lines('foo-617-2.log', content, expect, re.search) + +test.pass_test() diff --git a/test/scons-time/run/archive/dir.py b/test/scons-time/run/archive/dir.py new file mode 100644 index 0000000..a6c48ec --- /dev/null +++ b/test/scons-time/run/archive/dir.py @@ -0,0 +1,49 @@ +#!/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 basic generation of timing information from an input fake-project +directory tree. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo') + +test.run(arguments = 'run foo') + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +test.pass_test() diff --git a/test/scons-time/run/archive/tar-gz.py b/test/scons-time/run/archive/tar-gz.py new file mode 100644 index 0000000..ac69e29 --- /dev/null +++ b/test/scons-time/run/archive/tar-gz.py @@ -0,0 +1,49 @@ +#!/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 basic generation of timing information from an input fake-project +.tar.gz file. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz') + +test.run(arguments = 'run foo.tar.gz') + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +test.pass_test() diff --git a/test/scons-time/run/archive/tar.py b/test/scons-time/run/archive/tar.py new file mode 100644 index 0000000..18823d7 --- /dev/null +++ b/test/scons-time/run/archive/tar.py @@ -0,0 +1,49 @@ +#!/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 basic generation of timing information from an input fake-project +.tar file. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar') + +test.run(arguments = 'run foo.tar') + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +test.pass_test() diff --git a/test/scons-time/run/archive/tgz.py b/test/scons-time/run/archive/tgz.py new file mode 100644 index 0000000..f7df9a0 --- /dev/null +++ b/test/scons-time/run/archive/tgz.py @@ -0,0 +1,49 @@ +#!/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 basic generation of timing information from an input fake-project +.tgz file. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.tgz') + +test.run(arguments = 'run foo.tgz') + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +test.pass_test() diff --git a/test/scons-time/run/archive/zip.py b/test/scons-time/run/archive/zip.py new file mode 100644 index 0000000..67cfc3a --- /dev/null +++ b/test/scons-time/run/archive/zip.py @@ -0,0 +1,49 @@ +#!/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 basic generation of timing information from an input fake-project +.zip file. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.zip') + +test.run(arguments = 'run foo.zip') + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +test.pass_test() diff --git a/test/scons-time/run/config/archive_list.py b/test/scons-time/run/config/archive_list.py new file mode 100644 index 0000000..8d48d26 --- /dev/null +++ b/test/scons-time/run/config/archive_list.py @@ -0,0 +1,73 @@ +#!/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 specifying a list of archives through the archive_list setting +in a config file. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz') + +test.write('config', """\ +archive_list = ['foo.tar.gz'] +""") + +test.run(arguments = 'run -f config') + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + + +test.write_sample_project('bar.tar.gz') + +test.run(arguments = 'run -f config bar.tar.gz') + +test.must_not_exist('foo-001-0.log', + 'foo-001-0.prof', + 'foo-001-1.log', + 'foo-001-1.prof', + 'foo-001-2.log', + 'foo-001-2.prof') + +test.must_exist('bar-000-0.log', + 'bar-000-0.prof', + 'bar-000-1.log', + 'bar-000-1.prof', + 'bar-000-2.log', + 'bar-000-2.prof') + + +test.pass_test() diff --git a/test/scons-time/run/config/initial_commands.py b/test/scons-time/run/config/initial_commands.py new file mode 100644 index 0000000..73328ef --- /dev/null +++ b/test/scons-time/run/config/initial_commands.py @@ -0,0 +1,56 @@ +#!/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 specifying a list of initial commands through a config file. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz') + +test.write('config', """\ +def touch(arg): + open(arg, 'w') +initial_commands = [(touch, 'touch %%%%s', r'%s')] +""" % test.workpath('INITIAL')) + +test.run(arguments = 'run -f config foo.tar.gz') + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +test.must_exist('INITIAL') + +test.pass_test() diff --git a/test/scons-time/run/config/prefix.py b/test/scons-time/run/config/prefix.py new file mode 100644 index 0000000..c04c9e7 --- /dev/null +++ b/test/scons-time/run/config/prefix.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 specifying an alternate file prefix through a config file. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz') + +test.write('config', """\ +prefix = 'bar' +""") + +test.run(arguments = 'run -f config foo.tar.gz') + +test.must_exist('bar-000-0.log', + 'bar-000-0.prof', + 'bar-000-1.log', + 'bar-000-1.prof', + 'bar-000-2.log', + 'bar-000-2.prof') + +test.pass_test() diff --git a/test/scons-time/run/config/python.py b/test/scons-time/run/config/python.py new file mode 100644 index 0000000..4aa85b4 --- /dev/null +++ b/test/scons-time/run/config/python.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 specifying an alternate Python executable in a config file. +""" + +import os + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_sample_project('foo.tar.gz') + +my_python_py = test.workpath('my_python.py') + +test.write('config', """\ +python = r'%(my_python_py)s' +""" % locals()) + +test.write(my_python_py, """\ +#!/usr/bin/env python +import sys +profile = '' +for arg in sys.argv[1:]: + if arg.startswith('--profile='): + profile = arg[10:] + break +print 'my_python.py: %s' % profile +""") + +os.chmod(my_python_py, 0755) + +test.run(arguments = 'run -f config foo.tar.gz') + +prof0 = test.workpath('foo-000-0.prof') +prof1 = test.workpath('foo-000-1.prof') +prof2 = test.workpath('foo-000-2.prof') + +test.must_match('foo-000-0.log', "my_python.py: %s\n" % prof0) +test.must_match('foo-000-1.log', "my_python.py: %s\n" % prof1) +test.must_match('foo-000-2.log', "my_python.py: %s\n" % prof2) + +test.pass_test() diff --git a/test/scons-time/run/config/scons.py b/test/scons-time/run/config/scons.py new file mode 100644 index 0000000..45ca369 --- /dev/null +++ b/test/scons-time/run/config/scons.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__" + +""" +Verify specifying an alternate SCons through a config file. +""" + +import os + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_sample_project('foo.tar.gz') + +my_scons_py = test.workpath('my_scons.py') + +test.write('config', """\ +scons = r'%(my_scons_py)s' +""" % locals()) + +test.write(my_scons_py, """\ +import sys +profile = '' +for arg in sys.argv[1:]: + if arg.startswith('--profile='): + profile = arg[10:] + break +print 'my_scons.py: %s' % profile +""") + +test.run(arguments = 'run -f config foo.tar.gz') + +prof0 = test.workpath('foo-000-0.prof') +prof1 = test.workpath('foo-000-1.prof') +prof2 = test.workpath('foo-000-2.prof') + +test.must_match('foo-000-0.log', "my_scons.py: %s\n" % prof0) +test.must_match('foo-000-1.log', "my_scons.py: %s\n" % prof1) +test.must_match('foo-000-2.log', "my_scons.py: %s\n" % prof2) + +test.pass_test() diff --git a/test/scons-time/run/config/subdir.py b/test/scons-time/run/config/subdir.py new file mode 100644 index 0000000..4d21318 --- /dev/null +++ b/test/scons-time/run/config/subdir.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 picking up the subdir value from a config file. +""" + +import os +import re + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz', 'subdir') + +test.write('config', """\ +subdir = 'subdir' +""") + +test.run(arguments = 'run -f config foo.tar.gz') + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +content = test.read(test.workpath('foo-000-0.log'), mode='r') + +expect = [ + 'SConstruct file directory: .*%ssubdir$' % re.escape(os.sep), +] + +test.must_contain_all_lines('foo-000-0.log', content, expect, re.search) + +test.pass_test() diff --git a/test/scons-time/run/config/targets.py b/test/scons-time/run/config/targets.py new file mode 100644 index 0000000..8d2abd1 --- /dev/null +++ b/test/scons-time/run/config/targets.py @@ -0,0 +1,86 @@ +#!/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 specifying a list of targets through a config file. +""" + +import os +import re + +import TestSCons_time + +test = TestSCons_time.TestSCons_time(match = TestSCons_time.match_re) + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz') + +test.write('config', """\ +targets = 'target1 target2' +""") + +test.run(arguments = 'run -f config foo.tar.gz') + +scons_py = re.escape(test.workpath('src', 'script', 'scons.py')) +src_engine = re.escape(test.workpath('src', 'engine')) + +prof1 = re.escape(test.workpath('foo-000-1.prof')) +prof2 = re.escape(test.workpath('foo-000-2.prof')) + +sep = re.escape(os.sep) + +expect = """\ +%(scons_py)s + --debug=count + --debug=memory + --debug=time + --debug=memoizer + --profile=%(prof1)s + target1 + target2 +SCONS_LIB_DIR = %(src_engine)s +SConstruct file directory: .*scons-time-.*%(sep)sfoo +""" % locals() + +test.must_match('foo-000-1.log', expect, mode='r') + +expect = """\ +%(scons_py)s + --debug=count + --debug=memory + --debug=time + --debug=memoizer + --profile=%(prof2)s + target1 + target2 +SCONS_LIB_DIR = %(src_engine)s +SConstruct file directory: .*scons-time-.*%(sep)sfoo +""" % locals() + +test.must_match('foo-000-2.log', expect, mode='r') + +test.pass_test() diff --git a/test/scons-time/run/option/help.py b/test/scons-time/run/option/help.py new file mode 100644 index 0000000..304992f --- /dev/null +++ b/test/scons-time/run/option/help.py @@ -0,0 +1,59 @@ +#!/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 run -h option (and variants) prints help. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +expect = [ + "Usage: scons-time run [OPTIONS] [FILE ...]\n", + " -h, --help Print this help and exit\n", + " -n, --no-exec No execute, just print command lines\n", + " -q, --quiet Don't print command lines\n", + " -v, --verbose Display output of commands\n", +] + +test.run(arguments = 'run -h') + +test.must_contain_all_lines('Standard output', test.stdout(), expect) + +test.run(arguments = 'run -?') + +test.must_contain_all_lines('Standard output', test.stdout(), expect) + +test.run(arguments = 'run --help') + +test.must_contain_all_lines('Standard output', test.stdout(), expect) + +test.run(arguments = 'help run') + +test.must_contain_all_lines('Standard output', test.stdout(), expect) + +test.pass_test() diff --git a/test/scons-time/run/option/next-run.py b/test/scons-time/run/option/next-run.py new file mode 100644 index 0000000..8a23939 --- /dev/null +++ b/test/scons-time/run/option/next-run.py @@ -0,0 +1,99 @@ +#!/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 script finds the next run number based on the +contents of the directory, even when specified with --outdir. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.subdir('sub') + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz') + +test.run(arguments = 'run foo.tar.gz') + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +test.must_not_exist('foo-001-0.log', + 'foo-001-0.prof', + 'foo-001-1.log', + 'foo-001-1.prof', + 'foo-001-2.log', + 'foo-001-2.prof') + +test.run(arguments = 'run foo.tar.gz') + +test.must_exist('foo-001-0.log', + 'foo-001-0.prof', + 'foo-001-1.log', + 'foo-001-1.prof', + 'foo-001-2.log', + 'foo-001-2.prof') + +test.must_not_exist('foo-002-0.log', + 'foo-002-0.prof', + 'foo-002-1.log', + 'foo-002-1.prof', + 'foo-002-2.log', + 'foo-002-2.prof') + +test.run(arguments = 'run foo.tar.gz') + +test.must_exist('foo-002-0.log', + 'foo-002-0.prof', + 'foo-002-1.log', + 'foo-002-1.prof', + 'foo-002-2.log', + 'foo-002-2.prof') + +test.run(arguments = 'run --outdir sub foo.tar.gz') + +test.must_exist(['sub', 'foo-000-0.log'], + ['sub', 'foo-000-0.prof'], + ['sub', 'foo-000-1.log'], + ['sub', 'foo-000-1.prof'], + ['sub', 'foo-000-2.log'], + ['sub', 'foo-000-2.prof']) + +test.must_not_exist('foo-003-0.log', + 'foo-003-0.prof', + 'foo-003-1.log', + 'foo-003-1.prof', + 'foo-003-2.log', + 'foo-003-2.prof') + +test.pass_test() diff --git a/test/scons-time/run/option/no-args.py b/test/scons-time/run/option/no-args.py new file mode 100644 index 0000000..520b27d --- /dev/null +++ b/test/scons-time/run/option/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 the run command is passed no arguments. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +expect = """\ +scons-time: run: No arguments or -f config file specified. + Type "scons-time help run" for help. +""" + +test.run(arguments = 'run', status = 1, stderr = expect) + +test.pass_test() diff --git a/test/scons-time/run/option/no-exec.py b/test/scons-time/run/option/no-exec.py new file mode 100644 index 0000000..a2eab74 --- /dev/null +++ b/test/scons-time/run/option/no-exec.py @@ -0,0 +1,49 @@ +#!/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 run -n and --no-exec options don't actually create the +expected output files. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_sample_project('foo.tar.gz') + +test.run(arguments = 'run -n foo.tar.gz') + +test.run(arguments = 'run --no-exec foo.tar.gz') + +test.must_not_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +test.pass_test() diff --git a/test/scons-time/run/option/number.py b/test/scons-time/run/option/number.py new file mode 100644 index 0000000..ddf2d86 --- /dev/null +++ b/test/scons-time/run/option/number.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 run --number option specifies the run number. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz') + +test.run(arguments = 'run --number 77 foo.tar.gz') + +test.must_exist('foo-077-0.log', + 'foo-077-0.prof', + 'foo-077-1.log', + 'foo-077-1.prof', + 'foo-077-2.log', + 'foo-077-2.prof') + +test.pass_test() diff --git a/test/scons-time/run/option/outdir.py b/test/scons-time/run/option/outdir.py new file mode 100644 index 0000000..f60eba0 --- /dev/null +++ b/test/scons-time/run/option/outdir.py @@ -0,0 +1,51 @@ + +#!/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 specifying an alternate output directory with the --outdir option. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.subdir('sub') + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz') + +test.run(arguments = 'run --outdir sub foo.tar.gz') + +test.must_exist(['sub', 'foo-000-0.log'], + ['sub', 'foo-000-0.prof'], + ['sub', 'foo-000-1.log'], + ['sub', 'foo-000-1.prof'], + ['sub', 'foo-000-2.log'], + ['sub', 'foo-000-2.prof']) + +test.pass_test() diff --git a/test/scons-time/run/option/prefix.py b/test/scons-time/run/option/prefix.py new file mode 100644 index 0000000..6bc9619 --- /dev/null +++ b/test/scons-time/run/option/prefix.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 specifying an alternate file prefix with the --prefix option. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz') + +test.run(arguments = 'run --prefix bar foo.tar.gz') + +test.must_exist('bar-000-0.log', + 'bar-000-0.prof', + 'bar-000-1.log', + 'bar-000-1.prof', + 'bar-000-2.log', + 'bar-000-2.prof') + +test.pass_test() diff --git a/test/scons-time/run/option/python.py b/test/scons-time/run/option/python.py new file mode 100644 index 0000000..bd12efe --- /dev/null +++ b/test/scons-time/run/option/python.py @@ -0,0 +1,64 @@ +#!/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 run --python option to specify an alternatie Python executable. +""" + +import os + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_sample_project('foo.tar.gz') + +my_python_py = test.workpath('my_python.py') + +test.write(my_python_py, """\ +#!/usr/bin/env python +import sys +profile = '' +for arg in sys.argv[1:]: + if arg.startswith('--profile='): + profile = arg[10:] + break +sys.stdout.write('my_python.py: %s\\n' % profile) +""") + +os.chmod(my_python_py, 0755) + +test.run(arguments = 'run --python %s foo.tar.gz' % my_python_py) + +prof0 = test.workpath('foo-000-0.prof') +prof1 = test.workpath('foo-000-1.prof') +prof2 = test.workpath('foo-000-2.prof') + +test.must_match('foo-000-0.log', "my_python.py: %s\n" % prof0) +test.must_match('foo-000-1.log', "my_python.py: %s\n" % prof1) +test.must_match('foo-000-2.log', "my_python.py: %s\n" % prof2) + +test.pass_test() diff --git a/test/scons-time/run/option/quiet.py b/test/scons-time/run/option/quiet.py new file mode 100644 index 0000000..5d5d7cf --- /dev/null +++ b/test/scons-time/run/option/quiet.py @@ -0,0 +1,96 @@ +#!/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 run -q and --quiet options suppress build output. +""" + +import re + +import TestSCons_time + +python = TestSCons_time.python + +test = TestSCons_time.TestSCons_time(match = TestSCons_time.match_re) +test.diff_function = TestSCons_time.diff_re + + +def tempdir_re(*args): + import os + import os.path + import string + import tempfile + + sep = re.escape(os.sep) + args = (tempfile.gettempdir(), 'scons-time-',) + args + x = apply(os.path.join, args) + x = re.escape(x) + x = string.replace(x, 'time\\-', 'time\\-[^%s]*' % sep) + return x + +scons_py = re.escape(test.workpath('src', 'script', 'scons.py')) +src_engine = re.escape(test.workpath('src', 'engine')) + +tmp_scons_time = tempdir_re() +tmp_scons_time_foo = tempdir_re('foo') + + +test.write_fake_scons_py() + +foo_tar_gz = test.write_sample_project('foo.tar.gz') + +expect = """\ +%(scons_py)s + --version +SCONS_LIB_DIR = %(src_engine)s +SConstruct file directory: %(tmp_scons_time_foo)s +""" % locals() + +test.run(arguments = 'run -q foo.tar.gz', stdout = expect) + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +scons_py = test.workpath('src/script/scons.py') + +src_engine = test.workpath('src/engine') + +test.run(arguments = 'run -q foo.tar.gz', stdout = expect) + +test.must_exist('foo-001-0.log', + 'foo-001-0.prof', + 'foo-001-1.log', + 'foo-001-1.prof', + 'foo-001-2.log', + 'foo-001-2.prof') + +test.run(arguments = 'run --quiet foo.tar.gz', stdout = expect) + +test.pass_test() diff --git a/test/scons-time/run/option/scons.py b/test/scons-time/run/option/scons.py new file mode 100644 index 0000000..14ac18d --- /dev/null +++ b/test/scons-time/run/option/scons.py @@ -0,0 +1,59 @@ +#!/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 run --scons option to specify an alternatie SCons script. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_sample_project('foo.tar.gz') + +my_scons_py = test.workpath('my_scons.py') + +test.write(my_scons_py, """\ +import sys +profile = '' +for arg in sys.argv[1:]: + if arg.startswith('--profile='): + profile = arg[10:] + break +print 'my_scons.py: %s' % profile +""") + +test.run(arguments = 'run --scons %s foo.tar.gz' % my_scons_py) + +prof0 = test.workpath('foo-000-0.prof') +prof1 = test.workpath('foo-000-1.prof') +prof2 = test.workpath('foo-000-2.prof') + +test.must_match('foo-000-0.log', "my_scons.py: %s\n" % prof0) +test.must_match('foo-000-1.log', "my_scons.py: %s\n" % prof1) +test.must_match('foo-000-2.log', "my_scons.py: %s\n" % prof2) + +test.pass_test() diff --git a/test/scons-time/run/option/subdir.py b/test/scons-time/run/option/subdir.py new file mode 100644 index 0000000..b96d0e6 --- /dev/null +++ b/test/scons-time/run/option/subdir.py @@ -0,0 +1,59 @@ +#!/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 we change to a subdirectory before building if asked to do so. +""" + +import os +import re + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz', 'subdir') + +test.run(arguments = 'run --subdir subdir foo.tar.gz') + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +expect = [ + 'SConstruct file directory: .*%ssubdir$' % re.escape(os.sep), +] + +content = test.read(test.workpath('foo-000-0.log'), mode='r') + +test.must_contain_all_lines('foo-000-0.log', content, expect, re.search) + +test.pass_test() diff --git a/test/scons-time/run/option/verbose.py b/test/scons-time/run/option/verbose.py new file mode 100644 index 0000000..cdf5b5a --- /dev/null +++ b/test/scons-time/run/option/verbose.py @@ -0,0 +1,161 @@ +#!/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 run -v and --verbose options display command output. +""" + +import re + +import TestSCons_time + +_python_ = re.escape(TestSCons_time._python_) + + +test = TestSCons_time.TestSCons_time(match = TestSCons_time.match_re) +test.diff_function = TestSCons_time.diff_re + + +def tempdir_re(*args): + import os + import os.path + import string + import tempfile + + sep = re.escape(os.sep) + args = (tempfile.gettempdir(), 'scons-time-',) + args + x = apply(os.path.join, args) + x = re.escape(x) + x = string.replace(x, 'time\\-', 'time\\-[^%s]*' % sep) + return x + +scons_py = re.escape(test.workpath('src', 'script', 'scons.py')) +src_engine = re.escape(test.workpath('src', 'engine')) + +tmp_scons_time = tempdir_re() +tmp_scons_time_foo = tempdir_re('foo') + + +test.write_fake_scons_py() + +foo_tar_gz = test.write_sample_project('foo.tar.gz') + +expect = """\ +%(scons_py)s + --version +SCONS_LIB_DIR = %(src_engine)s +SConstruct file directory: %(tmp_scons_time_foo)s +""" % locals() + +test.run(arguments = 'run -q foo.tar.gz', stdout = expect) + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +time_re = r'\[\d\d:\d\d:\d\d\]' + +scons_flags = '--debug=count --debug=memory --debug=time --debug=memoizer' + + +expect = """\ +scons-time%(time_re)s: mkdir %(tmp_scons_time)s +scons-time%(time_re)s: cd %(tmp_scons_time)s +scons-time%(time_re)s: tar xzf %(foo_tar_gz)s +scons-time%(time_re)s: cd foo +scons-time%(time_re)s: find \\* -type f | xargs cat > /dev/null +scons-time%(time_re)s: export SCONS_LIB_DIR=%(src_engine)s +scons-time%(time_re)s: %(_python_)s %(scons_py)s --version +%(scons_py)s + --version +SCONS_LIB_DIR = %(src_engine)s +SConstruct file directory: %(tmp_scons_time_foo)s +scons-time%(time_re)s: %(_python_)s %(scons_py)s %(scons_flags)s --profile=%(prof0)s --help 2>&1 \\| tee %(log0)s +%(scons_py)s + --debug=count + --debug=memory + --debug=time + --debug=memoizer + --profile=%(prof0)s + --help +SCONS_LIB_DIR = %(src_engine)s +SConstruct file directory: %(tmp_scons_time_foo)s +scons-time%(time_re)s: %(_python_)s %(scons_py)s %(scons_flags)s --profile=%(prof1)s 2>&1 \\| tee %(log1)s +%(scons_py)s + --debug=count + --debug=memory + --debug=time + --debug=memoizer + --profile=%(prof1)s +SCONS_LIB_DIR = %(src_engine)s +SConstruct file directory: %(tmp_scons_time_foo)s +scons-time%(time_re)s: %(_python_)s %(scons_py)s %(scons_flags)s --profile=%(prof2)s 2>&1 \\| tee %(log2)s +%(scons_py)s + --debug=count + --debug=memory + --debug=time + --debug=memoizer + --profile=%(prof2)s +SCONS_LIB_DIR = %(src_engine)s +SConstruct file directory: %(tmp_scons_time_foo)s +scons-time%(time_re)s: cd .* +scons-time%(time_re)s: rm -rf %(tmp_scons_time)s +""" + +foo_tar_gz = re.escape(foo_tar_gz) + +log0 = re.escape(test.workpath('foo-001-0.log')) +log1 = re.escape(test.workpath('foo-001-1.log')) +log2 = re.escape(test.workpath('foo-001-2.log')) + +prof0 = re.escape(test.workpath('foo-001-0.prof')) +prof1 = re.escape(test.workpath('foo-001-1.prof')) +prof2 = re.escape(test.workpath('foo-001-2.prof')) + +test.run(arguments = 'run -v foo.tar.gz', stdout = expect % locals()) + +test.must_exist('foo-001-0.log', + 'foo-001-0.prof', + 'foo-001-1.log', + 'foo-001-1.prof', + 'foo-001-2.log', + 'foo-001-2.prof') + +log0 = re.escape(test.workpath('foo-002-0.log')) +log1 = re.escape(test.workpath('foo-002-1.log')) +log2 = re.escape(test.workpath('foo-002-2.log')) + +prof0 = re.escape(test.workpath('foo-002-0.prof')) +prof1 = re.escape(test.workpath('foo-002-1.prof')) +prof2 = re.escape(test.workpath('foo-002-2.prof')) + +test.run(arguments = 'run --verbose foo.tar.gz', stdout = expect % locals()) + + +test.pass_test() diff --git a/test/scons-time/run/subversion.py b/test/scons-time/run/subversion.py new file mode 100644 index 0000000..3839999 --- /dev/null +++ b/test/scons-time/run/subversion.py @@ -0,0 +1,85 @@ +#!/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 ability to "check out" an SCons revision from a fake +Subversion utility. +""" + +import re +import tempfile + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_sample_project('foo.tar') + +my_svn_py = test.write_fake_svn_py('my_svn.py') + +test.write('config', """\ +svn = r'%(my_svn_py)s' +""" % locals()) + +test.run(arguments = 'run -f config --svn http://xyzzy --number 617,716 foo.tar') + +test.must_exist('foo-617-0.log', + 'foo-617-0.prof', + 'foo-617-1.log', + 'foo-617-1.prof', + 'foo-617-2.log', + 'foo-617-2.prof') + +test.must_exist('foo-716-0.log', + 'foo-716-0.prof', + 'foo-716-1.log', + 'foo-716-1.prof', + 'foo-716-2.log', + 'foo-716-2.prof') + +def tempdir_re(*args): + import os + import os.path + import string + import tempfile + + sep = re.escape(os.sep) + args = (tempfile.gettempdir(), 'scons-time-svn-',) + args + x = apply(os.path.join, args) + x = re.escape(x) + x = string.replace(x, 'svn\\-', 'svn\\-[^%s]*' % sep) + return x + +expect = [ + tempdir_re('src', 'script', 'scons.py'), + 'SCONS_LIB_DIR = %s' % tempdir_re('src', 'engine'), +] + +content = test.read(test.workpath('foo-617-2.log'), mode='r') + +test.must_contain_all_lines('foo-617-2.log', content, expect, re.search) + +test.pass_test() |