diff options
-rw-r--r-- | src/engine/SCons/Node/FS.py | 9 | ||||
-rw-r--r-- | src/engine/SCons/SConfTests.py | 26 | ||||
-rw-r--r-- | src/engine/SCons/Tool/link.py | 4 | ||||
-rw-r--r-- | test/Fortran/link-with-cxx.py | 17 | ||||
-rw-r--r-- | test/VariantDir/reflect.py | 4 | ||||
-rw-r--r-- | test/Win32/bad-drive.py | 15 |
6 files changed, 50 insertions, 25 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 9da9d8e..3742f34 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1601,9 +1601,12 @@ class Dir(Base): if parent.exists(): break listDirs.append(parent) - parent = parent.up() - else: - raise SCons.Errors.StopError, parent.path + p = parent.up() + if p is None: + # Don't use while: - else: for this condition because + # if so, then parent is None and has no .path attribute. + raise SCons.Errors.StopError, parent.path + parent = p listDirs.reverse() for dirnode in listDirs: try: diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py index 4fc657e..f5b53f1 100644 --- a/src/engine/SCons/SConfTests.py +++ b/src/engine/SCons/SConfTests.py @@ -334,7 +334,7 @@ int main() { # Check that Check* does fail if CFLAGS is buggy self.scons_env[comp] = oldcomp - self.scons_env['%sFLAGS' % comp] = 'qwertyuiop' + self.scons_env['%sFLAGS' % comp] = '/WX qwertyuiop.c' r = func() assert not r, "%s worked with %sFLAGS = qwertyuiop ?" % (name, comp) @@ -346,7 +346,11 @@ int main() { conf_dir=self.test.workpath('config.tests'), log_file=self.test.workpath('config.log')) try: - self._test_check_compilers('CC', sconf.CheckCC, 'CheckCC') + try: + self._test_check_compilers('CC', sconf.CheckCC, 'CheckCC') + except AssertionError: + sys.stderr.write(self.test.read('config.log')) + raise finally: sconf.Finish() @@ -358,7 +362,11 @@ int main() { conf_dir=self.test.workpath('config.tests'), log_file=self.test.workpath('config.log')) try: - self._test_check_compilers('SHCC', sconf.CheckSHCC, 'CheckSHCC') + try: + self._test_check_compilers('SHCC', sconf.CheckSHCC, 'CheckSHCC') + except AssertionError: + sys.stderr.write(self.test.read('config.log')) + raise finally: sconf.Finish() @@ -370,7 +378,11 @@ int main() { conf_dir=self.test.workpath('config.tests'), log_file=self.test.workpath('config.log')) try: - self._test_check_compilers('CXX', sconf.CheckCXX, 'CheckCXX') + try: + self._test_check_compilers('CXX', sconf.CheckCXX, 'CheckCXX') + except AssertionError: + sys.stderr.write(self.test.read('config.log')) + raise finally: sconf.Finish() @@ -382,7 +394,11 @@ int main() { conf_dir=self.test.workpath('config.tests'), log_file=self.test.workpath('config.log')) try: - self._test_check_compilers('SHCXX', sconf.CheckSHCXX, 'CheckSHCXX') + try: + self._test_check_compilers('SHCXX', sconf.CheckSHCXX, 'CheckSHCXX') + except AssertionError: + sys.stderr.write(self.test.read('config.log')) + raise finally: sconf.Finish() diff --git a/src/engine/SCons/Tool/link.py b/src/engine/SCons/Tool/link.py index b11be76..d0fe86c 100644 --- a/src/engine/SCons/Tool/link.py +++ b/src/engine/SCons/Tool/link.py @@ -51,10 +51,10 @@ def smart_link(source, target, env, for_signature): global issued_mixed_link_warning if not issued_mixed_link_warning: msg = "Using $CXX to link Fortran and C++ code together.\n\t" + \ - "This may generate a buggy executable if the %s\n\t" + \ + "This may generate a buggy executable if the '%s'\n\t" + \ "compiler does not know how to deal with Fortran runtimes." SCons.Warnings.warn(SCons.Warnings.FortranCxxMixWarning, - msg % repr(env.subst('$CXX'))) + msg % env.subst('$CXX')) issued_mixed_link_warning = True return '$CXX' elif has_fortran: diff --git a/test/Fortran/link-with-cxx.py b/test/Fortran/link-with-cxx.py index 6c05ae1..ae0ff67 100644 --- a/test/Fortran/link-with-cxx.py +++ b/test/Fortran/link-with-cxx.py @@ -25,8 +25,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Verify the warnings message used when attempting to link C++ and -Fortran object files, and the ability to suppress them with the +Verify the smart_link() warning messages used when attempting to link +C++ and Fortran object files, and the ability to suppress them with the right --warn= options. """ @@ -41,8 +41,13 @@ test = TestSCons.TestSCons(match = TestSCons.match_re) test.write('test_linker.py', r""" import sys -outfile = open(sys.argv[2], 'wb') -for infile in sys.argv[3:]: +if sys.argv[1] == '-o': + outfile = open(sys.argv[2], 'wb') + infiles = sys.argv[3:] +elif sys.argv[1][:5] == '/OUT:': + outfile = open(sys.argv[1][5:], 'wb') + infiles = sys.argv[2:] +for infile in infiles: outfile.write(open(infile, 'rb').read()) outfile.close() sys.exit(0) @@ -60,12 +65,16 @@ sys.exit(0) test.write('SConstruct', """ +import SCons.Tool.link def copier(target, source, env): s = str(source[0]) t = str(target[0]) open(t, 'wb').write(open(s, 'rb').read()) env = Environment(CXX = r'%(_python_)s test_linker.py', CXXCOM = Action(copier), + SMARTLINK = SCons.Tool.link.smart_link, + LINK = r'$SMARTLINK', + LINKFLAGS = '', # We want to re-define this as follows (so as to # not rely on a real Fortran compiler) but can't # because $FORTRANCOM is defined with an extra space diff --git a/test/VariantDir/reflect.py b/test/VariantDir/reflect.py index 8fcca56..d231fa9 100644 --- a/test/VariantDir/reflect.py +++ b/test/VariantDir/reflect.py @@ -90,7 +90,7 @@ INC_CNI = re.escape(os.path.join('INC_dir1', 'dir2', 'dir1', 'dir2_CNI')) # The .+ after mycc\\.py below handles /nologo flags from Visual C/C++. expect = test.wrap_stdout("""\ scons: building associated VariantDir targets: %(targets)s -"%(re_python)s" mycc\\.py.* %(INC_CNI)s .+ +"%(re_python)s" mycc\\.py.* %(INC_CNI)s.* Compile "%(re_python)s" mylink\\.py .+ Link @@ -120,7 +120,7 @@ INC_CNI = re.escape(os.path.join('INC_dir1', 'dir2_CNI')) test.run(arguments = '', stdout=test.wrap_stdout("""\ scons: building associated VariantDir targets: %(targets)s -"%(re_python)s" mycc\\.py.* %(INC_CNI)s .+ +"%(re_python)s" mycc\\.py.* %(INC_CNI)s.* Compile "%(re_python)s" mylink\\.py .+ Link diff --git a/test/Win32/bad-drive.py b/test/Win32/bad-drive.py index f07da2b..4961386 100644 --- a/test/Win32/bad-drive.py +++ b/test/Win32/bad-drive.py @@ -96,16 +96,13 @@ test.run(arguments = bad_drive + 'not_mentioned', stderr = "scons: *** Do not know how to make target `%snot_mentioned'. Stop.\n" % (bad_drive), status = 2) -test.run(arguments = bad_drive + 'no_target_1', - stderr = "scons: *** No drive `%s' for target `%sno_target_1'. Stop.\n" % (bad_drive, bad_drive), - status = 2) +expect = "scons: *** [%sno_target_1] No drive `%s' for target `%sno_target_1'.\n" % (bad_drive, bad_drive, bad_drive) +test.run(arguments=bad_drive + 'no_target_1', stderr=expect, status=2) -test.run(arguments = bad_drive + 'no_target_2', - stderr = "scons: *** Source `ccc.does_not_exist' not found, needed by target `%sno_target_2'. Stop.\n" % bad_drive, - status = 2) +expect = "scons: *** [%sno_target_2] Source `ccc.does_not_exist' not found, needed by target `%sno_target_2'.\n" % (bad_drive, bad_drive) +test.run(arguments=bad_drive + 'no_target_2', stderr=expect, status=2) -test.run(arguments = 'ddd.out', - stderr = "scons: *** Source `%sno_source' not found, needed by target `ddd.out'. Stop.\n" % bad_drive, - status = 2) +expect = "scons: *** [ddd.out] Source `%sno_source' not found, needed by target `ddd.out'.\n" % bad_drive +test.run(arguments='ddd.out', stderr=expect, status=2) test.pass_test() |