diff options
author | Steven Knight <knight@baldmt.com> | 2007-05-18 05:40:31 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2007-05-18 05:40:31 (GMT) |
commit | 691da3ed8ba25b0e776d83b4404993925a876071 (patch) | |
tree | 4d532be0f91384214c930e1150d7e6becd44a92d /test | |
parent | f020c85e62e3e5c53c2b09a803baac67c06ff14a (diff) | |
download | SCons-691da3ed8ba25b0e776d83b4404993925a876071.zip SCons-691da3ed8ba25b0e776d83b4404993925a876071.tar.gz SCons-691da3ed8ba25b0e776d83b4404993925a876071.tar.bz2 |
Merged revisions 1884-1905 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core
........
r1891 | stevenknight | 2007-04-24 08:57:03 -0500 (Tue, 24 Apr 2007) | 1 line
0.96.D632 - Fix 0.96.96 reference count regression during parallel builds.
........
r1892 | stevenknight | 2007-04-24 12:51:05 -0500 (Tue, 24 Apr 2007) | 1 line
0.96.D633 - Fix documented default value(s) of $MSVS_USE_MFC_DIRS.
........
r1893 | stevenknight | 2007-04-24 16:12:14 -0500 (Tue, 24 Apr 2007) | 1 line
0.96.D634 - Make the DirEntryScanner tolerant of non-Dir nodes.
........
r1898 | stevenknight | 2007-05-09 15:07:15 -0500 (Wed, 09 May 2007) | 1 line
0.96.D635 - Portability fixes in test scripts.
........
r1899 | stevenknight | 2007-05-12 08:19:13 -0500 (Sat, 12 May 2007) | 1 line
0.96.D636 - Update documentation with rudimentary Tool module descriptions.
........
r1901 | stevenknight | 2007-05-17 14:32:14 -0500 (Thu, 17 May 2007) | 1 line
0.97.D001 - Initialize 0.97 for release.
........
Diffstat (limited to 'test')
-rw-r--r-- | test/Dir/Dir.py (renamed from test/Dir.py) | 0 | ||||
-rw-r--r-- | test/Dir/mixed-targets.py | 70 | ||||
-rw-r--r-- | test/Dir/source.py (renamed from test/DirSource.py) | 0 | ||||
-rw-r--r-- | test/Parallel/ref_count.py | 153 | ||||
-rw-r--r-- | test/Perforce/Perforce.py | 12 | ||||
-rw-r--r-- | test/TEX/bibtex-latex-rerun.py | 8 | ||||
-rw-r--r-- | test/import.py | 11 |
7 files changed, 247 insertions, 7 deletions
diff --git a/test/Dir.py b/test/Dir/Dir.py index d7ec9ae..d7ec9ae 100644 --- a/test/Dir.py +++ b/test/Dir/Dir.py diff --git a/test/Dir/mixed-targets.py b/test/Dir/mixed-targets.py new file mode 100644 index 0000000..52f9f0a --- /dev/null +++ b/test/Dir/mixed-targets.py @@ -0,0 +1,70 @@ +#!/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__" + +""" +Make sure that target lists of intermixed Node.FS.Dir and Node.FS.File +Nodes work with a DirEntryScanner. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.subdir('src', ['src', 'dir']) + +test.write('SConstruct', """\ +import os +import shutil + +import SCons.Defaults + +def copier(target, source, env): + os.rmdir('build') + shutil.copytree(str(source[0]), 'build') + return 0 + +Copier = Builder(action = copier, + target_scanner = SCons.Defaults.DirEntryScanner, + target_factory = Entry, + source_factory = Entry) + +env = Environment(BUILDERS = {'Copier': Copier}) +env.Copier(['build/dir', 'build/file1'], ['src']) +""") + +test.write(['src', 'file1'], "src/file1\n") + +test.write(['src', 'dir', 'file2'], "src/dir/file2\n") +test.write(['src', 'dir', 'file3'], "src/dir/file3\n") + +test.run(arguments = '.') + +test.must_match(['build', 'file1'], "src/file1\n") + +test.must_match(['build', 'dir', 'file2'], "src/dir/file2\n") +test.must_match(['build', 'dir', 'file3'], "src/dir/file3\n") + +test.pass_test() diff --git a/test/DirSource.py b/test/Dir/source.py index fa07a88..fa07a88 100644 --- a/test/DirSource.py +++ b/test/Dir/source.py diff --git a/test/Parallel/ref_count.py b/test/Parallel/ref_count.py new file mode 100644 index 0000000..93b6142 --- /dev/null +++ b/test/Parallel/ref_count.py @@ -0,0 +1,153 @@ +#!/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__" + +""" +Test for a specific race condition that used to stop a build cold when +a Node's ref_count would get decremented past 0 and "disappear" from +the Taskmaster's walk of the dependency graph. + +Note that this test does not fail every time, but would at least fail +more than 60%-70% of the time on the system(s) I tested. + +The rather complicated set up here creates a condition where, +after building four "object files" simultaneously while running with +-j4, sets up a race condition amongst the three dependencies of the +c6146/cpumanf.out file, where two of the dependencies are built at the +same time (that is, by the same command) and one is built separately. + +We used to detect Nodes that had been started but not finished building +and just set the waiting ref_count to the number of Nodes. In this case, +if we got unlucky, we'd re-visit the Nodes for the two files first and +set the ref_count to two *before* the command that built individual node +completed and decremented the ref_count from two to one. Then when the +two files completed, we'd update the ref_count to 1 - 2 = -1, which would +cause the Taskmaster to *not* "wake up" the Node because it's ref_count +hadn't actually reached 0. + +(The solution was to not set the ref_count, but to add to it only the +Nodes that were, in fact, added to the waiting_parents lists of various +child Nodes.) +""" + +import TestSCons + +_python_ = TestSCons._python_ + +test = TestSCons.TestSCons() + +test.write('build.py', """\ +import string +import sys +import time +args = sys.argv[1:] +outputs = [] +while args: + if args[0][0] != '-': + break + arg = args.pop(0) + if arg == '-o': + outputs.append(args.pop(0)) + continue + if arg == '-s': + time.sleep(int(args.pop(0))) +contents = '' +for ifile in args: + contents = contents + open(ifile, 'rb').read() +for ofile in outputs: + ofp = open(ofile, 'wb') + ofp.write('%s: building from %s\\n' % (ofile, string.join(args))) + ofp.write(contents) + ofp.close() +""") + +# +# +# + +test.write('SConstruct', """\ +env = Environment() +cmd = r'%(_python_)s build.py -o $TARGET $SOURCES' +f1 = env.Command('c6416/cpumanf/file1.obj', 'file1.c', cmd) +f2 = env.Command('c6416/cpumanf/file2.obj', 'file2.c', cmd) +f3 = env.Command('c6416/cpumanf/file3.obj', 'file3.c', cmd) +f4 = env.Command('c6416/cpumanf/file4.obj', 'file4.c', cmd) +f5 = env.Command('c6416/cpumanf/file5.obj', 'file5.c', cmd) +f6 = env.Command('c6416/cpumanf/file6.obj', 'file6.c', cmd) + +objs = f1 + f2 + f3 + f4 + f5 + f6 + +btc = env.Command('build/target/cpumanf.out', 'c6416/cpumanf.out', cmd) + +addcheck_obj = env.Command('addcheck.obj', 'addcheck.c', cmd) + +addcheck_exe = env.Command('addcheck.exe', addcheck_obj, cmd) + +cmd2 = r'%(_python_)s build.py -s 2 -o ${TARGETS[0]} -o ${TARGETS[1]} $SOURCES' + +cksums = env.Command(['c6416/cpumanf_pre_cksum.out', + 'c6416/cpumanf_pre_cksum.map'], + objs, + cmd2) + +cpumanf_out = env.Command('c6416/cpumanf.out', + cksums + addcheck_exe, + cmd) + +cpumanf = env.Alias('cpumanf', objs + btc) + +env.Command('after.out', cpumanf, r'%(_python_)s build.py -o $TARGET after.in') +""" % locals()) + +test.write('file1.c', "file1.c\n") +test.write('file2.c', "file2.c\n") +test.write('file3.c', "file3.c\n") +test.write('file4.c', "file4.c\n") +test.write('file5.c', "file5.c\n") +test.write('file6.c', "file6.c\n") + +test.write('addcheck.c', "addcheck.c\n") + +test.write('after.in', "after.in\n") + +test.run(arguments = '-j4 after.out') + +test.must_match('after.out', """\ +after.out: building from after.in +after.in +""") + +test.write('file5.c', "file5.c modified\n") + +test.write('after.in', "after.in modified\n") + +test.run(arguments = '-j4 after.out') + +test.must_match('after.out', """\ +after.out: building from after.in +after.in modified +""") + +test.pass_test() diff --git a/test/Perforce/Perforce.py b/test/Perforce/Perforce.py index 0133ced..a24c65d 100644 --- a/test/Perforce/Perforce.py +++ b/test/Perforce/Perforce.py @@ -81,7 +81,17 @@ class TestPerforce(TestSCons.TestSCons): spawnv(os.P_NOWAIT, self.p4d, args) self.sleep(2) else: - self.p4portflags = ['-p', self.host + ':1666'] + import socket + s = socket.socket() + host_port = (self.host, 1666) + try: + s.connect(host_port) + except socket.error: + self.skip_test("No Perforce server found; skipping test(s).\n") + else: + s.close() + + self.p4portflags = ['-p', '%s:%s' % host_port] try: self.p4('obliterate -y //%s/...' % self.depot) self.p4('depot -d %s' % self.depot) diff --git a/test/TEX/bibtex-latex-rerun.py b/test/TEX/bibtex-latex-rerun.py index 2293216..353d9a4 100644 --- a/test/TEX/bibtex-latex-rerun.py +++ b/test/TEX/bibtex-latex-rerun.py @@ -36,8 +36,14 @@ import TestSCons test = TestSCons.TestSCons() +pdflatex = test.where_is('pdflatex') + +if not pdflatex: + test.skip_test("Could not find pdflatex; skipping test(s).\n") + test.write(['SConstruct'], """\ -PDF( 'bibtest.tex' ) +env = Environment(tools=['pdflatex', 'tex']) +env.PDF( 'bibtest.tex' ) """) test.write(['bibtest.tex'], r""" diff --git a/test/import.py b/test/import.py index d267f00..7debffc 100644 --- a/test/import.py +++ b/test/import.py @@ -143,11 +143,12 @@ tools = [ 'zip', ] -if sys.platform == 'win32': - tools.extend([ - '386asm', - 'linkloc', - ]) +#if sys.platform == 'win32': +# Just comment out (for now?) due to registry dependency. +# tools.extend([ +# '386asm', +# 'linkloc', +# ]) # Intel no compiler warning.. intel_no_compiler_warning = """ |