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/sconsign/script | |
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/sconsign/script')
-rw-r--r-- | test/sconsign/script/SConsignFile.py | 260 | ||||
-rw-r--r-- | test/sconsign/script/Signatures.py | 109 | ||||
-rw-r--r-- | test/sconsign/script/bad.py | 61 | ||||
-rw-r--r-- | test/sconsign/script/dblite.py | 122 | ||||
-rw-r--r-- | test/sconsign/script/no-SConsignFile.py | 205 |
5 files changed, 757 insertions, 0 deletions
diff --git a/test/sconsign/script/SConsignFile.py b/test/sconsign/script/SConsignFile.py new file mode 100644 index 0000000..2f5ddf3 --- /dev/null +++ b/test/sconsign/script/SConsignFile.py @@ -0,0 +1,260 @@ +#!/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 sconsign script works with files generated when +using the signatures in an SConsignFile(). +""" + +import TestSConsign + +test = TestSConsign.TestSConsign(match = TestSConsign.match_re) + +test.subdir('sub1', 'sub2') + +test.write(['SConstruct'], """\ +SConsignFile() +env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj') +env1.Program('sub1/hello.c') +env2 = env1.Clone(CPPPATH = ['sub2']) +env2.Program('sub2/hello.c') +""") + +test.write(['sub1', 'hello.c'], r"""\ +#include <stdio.h> +#include <stdlib.h> +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf("sub1/hello.c\n"); + exit (0); +} +""") + +test.write(['sub2', 'hello.c'], r"""\ +#include <stdio.h> +#include <stdlib.h> +#include <inc1.h> +#include <inc2.h> +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf("sub2/goodbye.c\n"); + exit (0); +} +""") + +test.write(['sub2', 'inc1.h'], r"""\ +#define STRING1 "inc1.h" +""") + +test.write(['sub2', 'inc2.h'], r"""\ +#define STRING2 "inc2.h" +""") + +test.run(arguments = '--implicit-cache .') + +test.run_sconsign(arguments = ".sconsign", + stdout = """\ +=== sub1: +hello.exe: \S+ None \d+ \d+ + hello.obj: \S+ +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ +=== sub2: +hello.exe: \S+ None \d+ \d+ + hello.obj: \S+ +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ + inc1.h: \S+ + inc2.h: \S+ +""") + +test.run_sconsign(arguments = "--raw .sconsign", + stdout = """\ +=== sub1: +hello.exe: {'bsig': '\S+', 'size': \d+L?, 'timestamp': \d+} + hello.obj: \S+ +hello.obj: {'bsig': '\S+', 'size': \d+L?, 'timestamp': \d+} + hello.c: \S+ +=== sub2: +hello.exe: {'bsig': '\S+', 'size': \d+L?, 'timestamp': \d+} + hello.obj: \S+ +hello.obj: {'bsig': '\S+', 'size': \d+L?, 'timestamp': \d+} + hello.c: \S+ + inc1.h: \S+ + inc2.h: \S+ +""") + +test.run_sconsign(arguments = "-v .sconsign", + stdout = """\ +=== sub1: +hello.exe: + bsig: \S+ + csig: None + timestamp: \d+ + size: \d+ + implicit: + hello.obj: \S+ +hello.obj: + bsig: \S+ + csig: None + timestamp: \d+ + size: \d+ + implicit: + hello.c: \S+ +=== sub2: +hello.exe: + bsig: \S+ + csig: None + timestamp: \d+ + size: \d+ + implicit: + hello.obj: \S+ +hello.obj: + bsig: \S+ + csig: None + timestamp: \d+ + size: \d+ + implicit: + hello.c: \S+ + inc1.h: \S+ + inc2.h: \S+ +""") + +test.run_sconsign(arguments = "-b -v .sconsign", + stdout = """\ +=== sub1: +hello.exe: + bsig: \S+ +hello.obj: + bsig: \S+ +=== sub2: +hello.exe: + bsig: \S+ +hello.obj: + bsig: \S+ +""") + +test.run_sconsign(arguments = "-c -v .sconsign", + stdout = """\ +=== sub1: +hello.exe: + csig: None +hello.obj: + csig: None +=== sub2: +hello.exe: + csig: None +hello.obj: + csig: None +""") + +test.run_sconsign(arguments = "-s -v .sconsign", + stdout = """\ +=== sub1: +hello.exe: + size: \d+ +hello.obj: + size: \d+ +=== sub2: +hello.exe: + size: \d+ +hello.obj: + size: \d+ +""") + +test.run_sconsign(arguments = "-t -v .sconsign", + stdout = """\ +=== sub1: +hello.exe: + timestamp: \d+ +hello.obj: + timestamp: \d+ +=== sub2: +hello.exe: + timestamp: \d+ +hello.obj: + timestamp: \d+ +""") + +test.run_sconsign(arguments = "-e hello.obj .sconsign", + stdout = """\ +=== sub1: +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ +=== sub2: +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ + inc1.h: \S+ + inc2.h: \S+ +""") + +test.run_sconsign(arguments = "-e hello.obj -e hello.exe -e hello.obj .sconsign", + stdout = """\ +=== sub1: +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ +hello.exe: \S+ None \d+ \d+ + hello.obj: \S+ +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ +=== sub2: +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ + inc1.h: \S+ + inc2.h: \S+ +hello.exe: \S+ None \d+ \d+ + hello.obj: \S+ +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ + inc1.h: \S+ + inc2.h: \S+ +""") + +#test.run_sconsign(arguments = "-i -v .sconsign", +# stdout = """\ +#=== sub1: +#hello.exe: +# implicit: +# hello.obj: \S+ +#hello.obj: +# implicit: +# hello.c: \S+ +#=== sub2: +#hello.exe: +# implicit: +# hello.obj: \S+ +#hello.obj: +# implicit: +# hello.c: \S+ +# inc1.h: \S+ +# inc2.h: \S+ +#""") + +test.pass_test() diff --git a/test/sconsign/script/Signatures.py b/test/sconsign/script/Signatures.py new file mode 100644 index 0000000..9a3ce62 --- /dev/null +++ b/test/sconsign/script/Signatures.py @@ -0,0 +1,109 @@ +#!/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 sconsign script works when using a .sconsign file in +each subdirectory (SConsignFile(None)) written with the non-default +SourceSignatures() and TargetSignatures() values (timestamp and content, +respectively). +""" + +import TestSConsign + +test = TestSConsign.TestSConsign(match = TestSConsign.match_re) + +def re_sep(*args): + import os.path + import re + return re.escape(apply(os.path.join, args)) + +test.subdir('sub1', 'sub2') + +test.write('SConstruct', """ +SConsignFile(None) +SourceSignatures('timestamp') +TargetSignatures('content') +env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj') +env1.Program('sub1/hello.c') +env2 = env1.Clone(CPPPATH = ['sub2']) +env2.Program('sub2/hello.c') +""") + +test.write(['sub1', 'hello.c'], r"""\ +#include <stdio.h> +#include <stdlib.h> +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf("sub1/hello.c\n"); + exit (0); +} +""") + +test.write(['sub2', 'hello.c'], r"""\ +#include <stdio.h> +#include <stdlib.h> +#include <inc1.h> +#include <inc2.h> +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf("sub2/goodbye.c\n"); + exit (0); +} +""") + +test.write(['sub2', 'inc1.h'], r"""\ +#define STRING1 "inc1.h" +""") + +test.write(['sub2', 'inc2.h'], r"""\ +#define STRING2 "inc2.h" +""") + +test.sleep() + +test.run(arguments = '. --max-drift=1') + +test.run_sconsign(arguments = "-e hello.exe -e hello.obj sub1/.sconsign", + stdout = """\ +hello.exe: \S+ None \d+ \d+ + hello.obj: \S+ +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ +""") + +test.run_sconsign(arguments = "-e hello.exe -e hello.obj -r sub1/.sconsign", + stdout = """\ +hello.exe: \S+ None '\S+ \S+ [ \d]\d \d\d:\d\d:\d\d \d\d\d\d' \d+ + hello.obj: \S+ +hello.obj: \S+ None '\S+ \S+ [ \d]\d \d\d:\d\d:\d\d \d\d\d\d' \d+ + hello.c: \S+ +""") + +test.pass_test() diff --git a/test/sconsign/script/bad.py b/test/sconsign/script/bad.py new file mode 100644 index 0000000..3ada44c --- /dev/null +++ b/test/sconsign/script/bad.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 sconsign script generates appropriate error messages when +passed various non-existent or bad sconsign files as arguments. +""" + +import TestSConsign + +test = TestSConsign.TestSConsign(match = TestSConsign.match_re) + +test.write('bad1', "bad1\n") +test.write('bad2.dblite', "bad2.dblite\n") +test.write('bad3', "bad3\n") + +test.run_sconsign(arguments = "-f dblite no_sconsign", + stderr = "sconsign: \[Errno 2\] No such file or directory: 'no_sconsign'\n") + +test.run_sconsign(arguments = "-f dblite bad1", + stderr = "sconsign: \[Errno 2\] No such file or directory: 'bad1.dblite'\n") + +test.run_sconsign(arguments = "-f dblite bad1.dblite", + stderr = "sconsign: \[Errno 2\] No such file or directory: 'bad1.dblite'\n") + +test.run_sconsign(arguments = "-f dblite bad2", + stderr = "sconsign: ignoring invalid `dblite' file `bad2'\n") + +test.run_sconsign(arguments = "-f dblite bad2.dblite", + stderr = "sconsign: ignoring invalid `dblite' file `bad2.dblite'\n") + +test.run_sconsign(arguments = "-f sconsign no_sconsign", + stderr = "sconsign: \[Errno 2\] No such file or directory: 'no_sconsign'\n") + +test.run_sconsign(arguments = "-f sconsign bad3", + stderr = "sconsign: ignoring invalid .sconsign file `bad3'\n") + +test.pass_test() diff --git a/test/sconsign/script/dblite.py b/test/sconsign/script/dblite.py new file mode 100644 index 0000000..fe49df6 --- /dev/null +++ b/test/sconsign/script/dblite.py @@ -0,0 +1,122 @@ +#!/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 various ways of getting at a an sconsign file written with +the default dblite module and default .dblite suffix work correctly. +""" + +import TestSConsign + +test = TestSConsign.TestSConsign(match = TestSConsign.match_re) + +test.subdir('sub1', 'sub2') + +test.write('SConstruct', """ +SConsignFile('my_sconsign') +SourceSignatures('timestamp') +TargetSignatures('content') +env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj') +env1.Program('sub1/hello.c') +env2 = env1.Clone(CPPPATH = ['sub2']) +env2.Program('sub2/hello.c') +""") + +test.write(['sub1', 'hello.c'], r"""\ +#include <stdio.h> +#include <stdlib.h> +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf("sub1/hello.c\n"); + exit (0); +} +""") + +test.write(['sub2', 'hello.c'], r"""\ +#include <stdio.h> +#include <stdlib.h> +#include <inc1.h> +#include <inc2.h> +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf("sub2/goodbye.c\n"); + exit (0); +} +""") + +test.write(['sub2', 'inc1.h'], r"""\ +#define STRING1 "inc1.h" +""") + +test.write(['sub2', 'inc2.h'], r"""\ +#define STRING2 "inc2.h" +""") + +test.sleep() + +test.run(arguments = '. --max-drift=1') + +expect = """\ +=== sub1: +hello.exe: \d+ None \d+ \d+ + hello.obj: \d+ +hello.obj: \d+ None \d+ \d+ + hello.c: \d+ +""" + +expect_r = """\ +=== sub1: +hello.exe: \d+ None '\S+ \S+ [ \d]\d \d\d:\d\d:\d\d \d\d\d\d' \d+ + hello.obj: \d+ +hello.obj: \d+ None '\S+ \S+ [ \d]\d \d\d:\d\d:\d\d \d\d\d\d' \d+ + hello.c: \d+ +""" + +common_flags = '-e hello.exe -e hello.obj -d sub1' + +test.run_sconsign(arguments = "%s my_sconsign" % common_flags, + stdout = expect) + +test.run_sconsign(arguments = "%s my_sconsign.dblite" % common_flags, + stdout = expect) + +test.run_sconsign(arguments = "%s -f dblite my_sconsign" % common_flags, + stdout = expect) + +test.run_sconsign(arguments = "%s -f dblite my_sconsign.dblite" % common_flags, + stdout = expect) + +test.run_sconsign(arguments = "%s -r -f dblite my_sconsign" % common_flags, + stdout = expect_r) + +test.run_sconsign(arguments = "%s -r -f dblite my_sconsign.dblite" % common_flags, + stdout = expect_r) + +test.pass_test() diff --git a/test/sconsign/script/no-SConsignFile.py b/test/sconsign/script/no-SConsignFile.py new file mode 100644 index 0000000..b860770 --- /dev/null +++ b/test/sconsign/script/no-SConsignFile.py @@ -0,0 +1,205 @@ +#!/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 sconsign script works when using an individual +.sconsign file in each directory (SConsignFile(None)). +""" + +import TestSConsign + +test = TestSConsign.TestSConsign(match = TestSConsign.match_re) + +def re_sep(*args): + import os.path + import re + return re.escape(apply(os.path.join, args)) + +test.subdir('sub1', 'sub2') + +test.write(['SConstruct'], """ +SConsignFile(None) +env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj') +env1.Program('sub1/hello.c') +env2 = env1.Clone(CPPPATH = ['sub2']) +env2.Program('sub2/hello.c') +""") + +test.write(['sub1', 'hello.c'], r"""\ +#include <stdio.h> +#include <stdlib.h> +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf("sub1/hello.c\n"); + exit (0); +} +""") + +test.write(['sub2', 'hello.c'], r"""\ +#include <stdio.h> +#include <stdlib.h> +#include <inc1.h> +#include <inc2.h> +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf("sub2/goodbye.c\n"); + exit (0); +} +""") + +test.write(['sub2', 'inc1.h'], r"""\ +#define STRING1 "inc1.h" +""") + +test.write(['sub2', 'inc2.h'], r"""\ +#define STRING2 "inc2.h" +""") + +test.run(arguments = '--implicit-cache .') + +test.run_sconsign(arguments = "sub1/.sconsign", + stdout = """\ +hello.exe: \S+ None \d+ \d+ + hello.obj: \S+ +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ +""") + +test.run_sconsign(arguments = "--raw sub1/.sconsign", + stdout = """\ +hello.exe: {'bsig': '\S+', 'size': \d+L?, 'timestamp': \d+} + hello.obj: \S+ +hello.obj: {'bsig': '\S+', 'size': \d+L?, 'timestamp': \d+} + hello.c: \S+ +""") + +test.run_sconsign(arguments = "-v sub1/.sconsign", + stdout = """\ +hello.exe: + bsig: \S+ + csig: None + timestamp: \d+ + size: \d+ + implicit: + hello.obj: \S+ +hello.obj: + bsig: \S+ + csig: None + timestamp: \d+ + size: \d+ + implicit: + hello.c: \S+ +""") + +test.run_sconsign(arguments = "-b -v sub1/.sconsign", + stdout = """\ +hello.exe: + bsig: \S+ +hello.obj: + bsig: \S+ +""") + +test.run_sconsign(arguments = "-c -v sub1/.sconsign", + stdout = """\ +hello.exe: + csig: None +hello.obj: + csig: None +""") + +test.run_sconsign(arguments = "-s -v sub1/.sconsign", + stdout = """\ +hello.exe: + size: \d+ +hello.obj: + size: \d+ +""") + +test.run_sconsign(arguments = "-t -v sub1/.sconsign", + stdout = """\ +hello.exe: + timestamp: \d+ +hello.obj: + timestamp: \d+ +""") + +test.run_sconsign(arguments = "-e hello.obj sub1/.sconsign", + stdout = """\ +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ +""") + +test.run_sconsign(arguments = "-e hello.obj -e hello.exe -e hello.obj sub1/.sconsign", + stdout = """\ +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ +hello.exe: \S+ None \d+ \d+ + hello.obj: \S+ +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ +""") + +# XXX NOT SURE IF THIS IS RIGHT! +sub2_inc1_h = re_sep('sub2', 'inc1.h') +sub2_inc2_h = re_sep('sub2', 'inc2.h') + +test.run_sconsign(arguments = "sub2/.sconsign", + stdout = """\ +hello.exe: \S+ None \d+ \d+ + hello.obj: \S+ +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ + inc1.h: \S+ + inc2.h: \S+ +""") + +#test.run_sconsign(arguments = "-i -v sub2/.sconsign", +# stdout = """\ +#hello.exe: +# implicit: +# hello.obj: \S+ None \d+ \d+ +#hello.obj: +# implicit: +# hello.c: None \S+ \d+ \d+ +# inc1.h: None \S+ \d+ \d+ +# inc2.h: None \S+ \d+ \d+ +#""") + +test.run_sconsign(arguments = "-e hello.obj sub2/.sconsign sub1/.sconsign", + stdout = """\ +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ + inc1.h: \S+ + inc2.h: \S+ +hello.obj: \S+ None \d+ \d+ + hello.c: \S+ +""") + +test.pass_test() |