From b7dade1fe373bb02c2bdbb1b28228778bc8d8912 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Fri, 11 Jan 2002 03:17:45 +0000 Subject: [PATCH] Check for the existence of lex and yacc in those tests and bail with NO RESULT if they're not present.. git-svn-id: http://scons.tigris.org/svn/scons/trunk@200 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- runtest.py | 38 ++++++++++++++++++++++++------------ src/engine/SCons/Defaults.py | 5 +++-- test/LEX.py | 10 ++++++++++ test/LEXFLAGS.py | 10 ++++++++++ test/YACC.py | 10 ++++++++++ test/YACCFLAGS.py | 10 ++++++++++ 6 files changed, 69 insertions(+), 14 deletions(-) diff --git a/runtest.py b/runtest.py index 6ac8a6e7..4535064a 100644 --- a/runtest.py +++ b/runtest.py @@ -139,6 +139,7 @@ else: os.chdir(scons_dir) fail = [] +no_result = [] for path in tests: if os.path.isabs(path): @@ -148,15 +149,28 @@ for path in tests: cmd = string.join(["python", debug, abs], " ") if printcmd: print cmd - if os.system(cmd): - fail.append(path) - -if fail and len(tests) != 1: - if len(fail) == 1: - str = "test" - else: - str = "%d tests" % len(fail) - print "\nFailed the following %s:" % str - print "\t", string.join(fail, "\n\t") - -sys.exit(len(fail)) + s = os.system(cmd) + if s == 1: + fail.append(path) + elif s == 2: + no_result.append(path) + elif s != 0: + print "Unexpected exit status %d" % s + +if len(tests) != 1: + if fail: + if len(fail) == 1: + str = "test" + else: + str = "%d tests" % len(fail) + print "\nFailed the following %s:" % str + print "\t", string.join(fail, "\n\t") + if no_result: + if len(no_result) == 1: + str = "test" + else: + str = "%d tests" % len(no_result) + print "\nNO RESULT from the following %s:" % str + print "\t", string.join(no_result, "\n\t") + +sys.exit(len(fail) + len(no_result)) diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 056b1f30..450575c2 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -129,7 +129,7 @@ def get_msvc_path (path, version, platform='x86'): access the registry or appropriate registry keys not found. """ - if not _can_read_reg: + if not SCons.Util.can_read_reg: raise InternalError, "No Windows registry module was found" if path=='lib': @@ -272,8 +272,9 @@ elif os.name == 'nt': # so fall back to a reasonable default: MVSdir = r'C:\Program Files\Microsoft Visual Studio' MVSVCdir = r'%s\VC98' % MVSdir + MVSCommondir = r'%s\Common' % MVSdir ConstructionEnvironment = make_win32_env_from_paths( r'%s\atl\include;%s\mfc\include;%s\include' % (MVSVCdir, MVSVCdir, MVSVCdir), r'%s\mvc\lib;%s\lib' % (MVSVCdir, MVSVCdir), - os.environ["PATH"]) + (r'%s\MSDev98\Bin' % MVSCommondir) + os.pathsep + os.environ["PATH"]) diff --git a/test/LEX.py b/test/LEX.py index 9bf37d71..38bee992 100644 --- a/test/LEX.py +++ b/test/LEX.py @@ -25,6 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os +import os.path import string import sys import TestSCons @@ -36,8 +37,17 @@ if sys.platform == 'win32': else: _exe = '' +lex = None +for dir in string.split(os.environ['PATH'], os.pathsep): + l = os.path.join(dir, 'lex' + _exe) + if os.path.exists(l): + lex = l + break + test = TestSCons.TestSCons() +test.no_result(not lex) + test.write("wrapper.py", """import os import string diff --git a/test/LEXFLAGS.py b/test/LEXFLAGS.py index 06facb81..2625c29b 100644 --- a/test/LEXFLAGS.py +++ b/test/LEXFLAGS.py @@ -25,6 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os +import os.path import string import sys import TestSCons @@ -36,8 +37,17 @@ if sys.platform == 'win32': else: _exe = '' +lex = None +for dir in string.split(os.environ['PATH'], os.pathsep): + l = os.path.join(dir, 'lex' + _exe) + if os.path.exists(l): + lex = l + break + test = TestSCons.TestSCons() +test.no_result(not lex) + test.write('SConstruct', """ foo = Environment() bar = Environment(LEXFLAGS = '-b') diff --git a/test/YACC.py b/test/YACC.py index f497c692..a4059856 100644 --- a/test/YACC.py +++ b/test/YACC.py @@ -25,6 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os +import os.path import string import sys import TestSCons @@ -36,8 +37,17 @@ if sys.platform == 'win32': else: _exe = '' +yacc = None +for dir in string.split(os.environ['PATH'], os.pathsep): + y = os.path.join(dir, 'yacc' + _exe) + if os.path.exists(y): + yacc = y + break + test = TestSCons.TestSCons() +test.no_result(not yacc) + test.write("wrapper.py", """import os import string diff --git a/test/YACCFLAGS.py b/test/YACCFLAGS.py index dc127ad7..82b38cb4 100644 --- a/test/YACCFLAGS.py +++ b/test/YACCFLAGS.py @@ -25,6 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os +import os.path import string import sys import TestSCons @@ -36,8 +37,17 @@ if sys.platform == 'win32': else: _exe = '' +yacc = None +for dir in string.split(os.environ['PATH'], os.pathsep): + y = os.path.join(dir, 'yacc' + _exe) + if os.path.exists(y): + yacc = y + break + test = TestSCons.TestSCons() +test.no_result(not yacc) + test.write('SConstruct', """ foo = Environment() bar = Environment(YACCFLAGS = '-v') -- 2.26.2