summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/engine/SCons/Node/NodeTests.py2
-rw-r--r--src/engine/SCons/Tool/386asm.py3
-rw-r--r--src/engine/SCons/Tool/intelc.py9
-rw-r--r--src/engine/SCons/Tool/masm.py3
-rw-r--r--src/engine/SCons/Tool/nasm.py3
-rw-r--r--test/CXX/CXXCOM.py35
-rw-r--r--test/CXX/CXXCOMSTR.py45
-rw-r--r--test/CXX/SHCXXCOM.py36
-rw-r--r--test/CXX/SHCXXCOMSTR.py45
-rw-r--r--test/M4.py6
-rw-r--r--test/builddir-reflect.py23
-rw-r--r--test/builder-wrappers.py4
-rw-r--r--test/import.py9
-rw-r--r--test/midl.py4
-rw-r--r--test/pre-post-actions.py4
15 files changed, 140 insertions, 91 deletions
diff --git a/src/engine/SCons/Node/NodeTests.py b/src/engine/SCons/Node/NodeTests.py
index e0956e1..d85be8b 100644
--- a/src/engine/SCons/Node/NodeTests.py
+++ b/src/engine/SCons/Node/NodeTests.py
@@ -1155,7 +1155,7 @@ class NodeListTestCase(unittest.TestCase):
assert s == "['n3', 'n2', 'n1']", s
r = repr(nl)
- r = re.sub('at (0x)?[0-9a-z]+', 'at 0x', repr(nl))
+ r = re.sub('at (0x)?[0-9A-Fa-f]+', 'at 0x', repr(nl))
l = string.join(["<__main__.MyNode instance at 0x>"]*3, ", ")
assert r == '[%s]' % l, r
diff --git a/src/engine/SCons/Tool/386asm.py b/src/engine/SCons/Tool/386asm.py
index bb8b780..f2a221b 100644
--- a/src/engine/SCons/Tool/386asm.py
+++ b/src/engine/SCons/Tool/386asm.py
@@ -45,8 +45,9 @@ def generate(env):
env['AS'] = '386asm'
env['ASFLAGS'] = SCons.Util.CLVar('')
+ env['ASPPFLAGS'] = '$ASFLAGS'
env['ASCOM'] = '$AS $ASFLAGS $SOURCES -o $TARGET'
- env['ASPPCOM'] = '$CC $ASFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $SOURCES -o $TARGET'
+ env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $SOURCES -o $TARGET'
addPharLapPaths(env)
diff --git a/src/engine/SCons/Tool/intelc.py b/src/engine/SCons/Tool/intelc.py
index f979700..ded33e9 100644
--- a/src/engine/SCons/Tool/intelc.py
+++ b/src/engine/SCons/Tool/intelc.py
@@ -80,8 +80,11 @@ def get_all_compiler_versions():
versions=[]
if is_win32:
keyname = 'Software\\Intel\\Compilers\\C++'
- k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE,
- keyname)
+ try:
+ k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE,
+ keyname)
+ except WindowsError:
+ return []
i = 0
versions = []
try:
@@ -158,7 +161,7 @@ def generate(env, version=None, abi=None, topdir=None, verbose=1):
if abi is None:
abi = "ia32" # or ia64, I believe
- if topdir is None:
+ if topdir is None and version:
try:
topdir = get_intel_compiler_top(version, abi)
except (SCons.Util.RegError, SCons.Errors.InternalError):
diff --git a/src/engine/SCons/Tool/masm.py b/src/engine/SCons/Tool/masm.py
index 6841815..a0c03d9 100644
--- a/src/engine/SCons/Tool/masm.py
+++ b/src/engine/SCons/Tool/masm.py
@@ -62,8 +62,9 @@ def generate(env):
env['AS'] = 'ml'
env['ASFLAGS'] = SCons.Util.CLVar('/nologo')
+ env['ASPPFLAGS'] = '$ASFLAGS'
env['ASCOM'] = '$AS $ASFLAGS /c /Fo$TARGET $SOURCES'
- env['ASPPCOM'] = '$CC $ASFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c /Fo$TARGET $SOURCES'
+ env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c /Fo$TARGET $SOURCES'
env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
def exists(env):
diff --git a/src/engine/SCons/Tool/nasm.py b/src/engine/SCons/Tool/nasm.py
index 7dd3b63..6d0f078 100644
--- a/src/engine/SCons/Tool/nasm.py
+++ b/src/engine/SCons/Tool/nasm.py
@@ -58,8 +58,9 @@ def generate(env):
env['AS'] = 'nasm'
env['ASFLAGS'] = SCons.Util.CLVar('')
+ env['ASPPFLAGS'] = '$ASFLAGS'
env['ASCOM'] = '$AS $ASFLAGS -o $TARGET $SOURCES'
- env['ASPPCOM'] = '$CC $ASFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES'
+ env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES'
def exists(env):
return env.Detect('nasm')
diff --git a/test/CXX/CXXCOM.py b/test/CXX/CXXCOM.py
index 4641473..c4c419d 100644
--- a/test/CXX/CXXCOM.py
+++ b/test/CXX/CXXCOM.py
@@ -50,31 +50,36 @@ sys.exit(0)
""")
if os.path.normcase('.c') == os.path.normcase('.C'):
- alt_cc_suffix = '.CC'
+ alt_cpp_suffix = '.cpp'
else:
- alt_cc_suffix = '.cc'
+ alt_cpp_suffix = '.C'
test.write('SConstruct', """
env = Environment(CXXCOM = r'%(python)s mycc.py $TARGET $SOURCE',
OBJSUFFIX='.obj')
-env.Object(target = 'test1', source = 'test1.cc')
-env.Object(target = 'test2', source = 'test2%(alt_cc_suffix)s')
+env.Object(target = 'test1', source = 'test1.cpp')
+env.Object(target = 'test2', source = 'test2.cc')
+env.Object(target = 'test3', source = 'test3.cxx')
+env.Object(target = 'test4', source = 'test4.c++')
+env.Object(target = 'test5', source = 'test5.C++')
+env.Object(target = 'test6', source = 'test6%(alt_cpp_suffix)s')
""" % locals())
-test.write('test1.cc', """\
-test1.cc
-/*c++*/
-""")
-
-test.write('test2'+alt_cc_suffix, """\
-test2.CC
-/*c++*/
-""")
+test.write('test1.cpp', "test1.cpp\n/*c++*/\n")
+test.write('test2.cc', "test2.cc\n/*c++*/\n")
+test.write('test3.cxx', "test3.cxx\n/*c++*/\n")
+test.write('test4.c++', "test4.c++\n/*c++*/\n")
+test.write('test5.C++', "test5.C++\n/*c++*/\n")
+test.write('test6'+alt_cpp_suffix, "test6.C\n/*c++*/\n")
test.run()
-test.must_match('test1.obj', "test1.cc\n")
-test.must_match('test2.obj', "test2.CC\n")
+test.must_match('test1.obj', "test1.cpp\n")
+test.must_match('test2.obj', "test2.cc\n")
+test.must_match('test3.obj', "test3.cxx\n")
+test.must_match('test4.obj', "test4.c++\n")
+test.must_match('test5.obj', "test5.C++\n")
+test.must_match('test6.obj', "test6.C\n")
diff --git a/test/CXX/CXXCOMSTR.py b/test/CXX/CXXCOMSTR.py
index 0a2dce6..82f7ace 100644
--- a/test/CXX/CXXCOMSTR.py
+++ b/test/CXX/CXXCOMSTR.py
@@ -45,41 +45,50 @@ test.write('mycc.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l[:6] != '/*cc*/', infile.readlines()):
+for l in filter(lambda l: l != '/*c++*/\n', infile.readlines()):
outfile.write(l)
sys.exit(0)
""")
if os.path.normcase('.c') == os.path.normcase('.C'):
- alt_cc_suffix = '.CC'
+ alt_cpp_suffix = '.cpp'
else:
- alt_cc_suffix = '.cc'
+ alt_cpp_suffix = '.C'
test.write('SConstruct', """
env = Environment(CXXCOM = r'%(python)s mycc.py $TARGET $SOURCE',
CXXCOMSTR = 'Building $TARGET from $SOURCE',
OBJSUFFIX='.obj')
-env.Object(target = 'test1', source = 'test1.cc')
-env.Object(target = 'test2', source = 'test2%(alt_cc_suffix)s')
+env.Object(target = 'test1', source = 'test1.cpp')
+env.Object(target = 'test2', source = 'test2.cc')
+env.Object(target = 'test3', source = 'test3.cxx')
+env.Object(target = 'test4', source = 'test4.c++')
+env.Object(target = 'test5', source = 'test5.C++')
+env.Object(target = 'test6', source = 'test6%(alt_cpp_suffix)s')
""" % locals())
-test.write('test1.cc', """\
-test1.cc
-/*cc*/
-""")
-
-test.write('test2'+alt_cc_suffix, """\
-test2.CC
-/*cc*/
-""")
+test.write('test1.cpp', "test1.cpp\n/*c++*/\n")
+test.write('test2.cc', "test2.cc\n/*c++*/\n")
+test.write('test3.cxx', "test3.cxx\n/*c++*/\n")
+test.write('test4.c++', "test4.c++\n/*c++*/\n")
+test.write('test5.C++', "test5.C++\n/*c++*/\n")
+test.write('test6'+alt_cpp_suffix, "test6.C\n/*c++*/\n")
test.run(stdout = test.wrap_stdout("""\
-Building test1.obj from test1.cc
-Building test2.obj from test2%(alt_cc_suffix)s
+Building test1.obj from test1.cpp
+Building test2.obj from test2.cc
+Building test3.obj from test3.cxx
+Building test4.obj from test4.c++
+Building test5.obj from test5.C++
+Building test6.obj from test6%(alt_cpp_suffix)s
""" % locals()))
-test.must_match('test1.obj', "test1.cc\n")
-test.must_match('test2.obj', "test2.CC\n")
+test.must_match('test1.obj', "test1.cpp\n")
+test.must_match('test2.obj', "test2.cc\n")
+test.must_match('test3.obj', "test3.cxx\n")
+test.must_match('test4.obj', "test4.c++\n")
+test.must_match('test5.obj', "test5.C++\n")
+test.must_match('test6.obj', "test6.C\n")
diff --git a/test/CXX/SHCXXCOM.py b/test/CXX/SHCXXCOM.py
index 1a38d71..54ef0d5 100644
--- a/test/CXX/SHCXXCOM.py
+++ b/test/CXX/SHCXXCOM.py
@@ -50,32 +50,36 @@ sys.exit(0)
""")
if os.path.normcase('.c') == os.path.normcase('.C'):
- alt_cc_suffix = '.CC'
+ alt_cpp_suffix = '.cpp'
else:
- alt_cc_suffix = '.cc'
+ alt_cpp_suffix = '.C'
test.write('SConstruct', """
env = Environment(SHCXXCOM = r'%(python)s mycc.py $TARGET $SOURCE',
SHOBJSUFFIX='.obj')
-env.SharedObject(target = 'test1', source = 'test1.cc')
-env.SharedObject(target = 'test2', source = 'test2%(alt_cc_suffix)s')
+env.SharedObject(target = 'test1', source = 'test1.cpp')
+env.SharedObject(target = 'test2', source = 'test2.cc')
+env.SharedObject(target = 'test3', source = 'test3.cxx')
+env.SharedObject(target = 'test4', source = 'test4.c++')
+env.SharedObject(target = 'test5', source = 'test5.C++')
+env.SharedObject(target = 'test6', source = 'test6%(alt_cpp_suffix)s')
""" % locals())
-test.write('test1.cc', """\
-test1.cc
-/*c++*/
-""")
-
-test.write('test2'+alt_cc_suffix, """\
-test2.CC
-/*c++*/
-""")
+test.write('test1.cpp', "test1.cpp\n/*c++*/\n")
+test.write('test2.cc', "test2.cc\n/*c++*/\n")
+test.write('test3.cxx', "test3.cxx\n/*c++*/\n")
+test.write('test4.c++', "test4.c++\n/*c++*/\n")
+test.write('test5.C++', "test5.C++\n/*c++*/\n")
+test.write('test6'+alt_cpp_suffix, "test6.C\n/*c++*/\n")
test.run()
-test.must_match('test1.obj', "test1.cc\n")
-test.must_match('test2.obj', "test2.CC\n")
-
+test.must_match('test1.obj', "test1.cpp\n")
+test.must_match('test2.obj', "test2.cc\n")
+test.must_match('test3.obj', "test3.cxx\n")
+test.must_match('test4.obj', "test4.c++\n")
+test.must_match('test5.obj', "test5.C++\n")
+test.must_match('test6.obj', "test6.C\n")
test.pass_test()
diff --git a/test/CXX/SHCXXCOMSTR.py b/test/CXX/SHCXXCOMSTR.py
index 2c43393..ad3a907 100644
--- a/test/CXX/SHCXXCOMSTR.py
+++ b/test/CXX/SHCXXCOMSTR.py
@@ -45,41 +45,50 @@ test.write('mycc.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l[:6] != '/*cc*/', infile.readlines()):
+for l in filter(lambda l: l != '/*c++*/\n', infile.readlines()):
outfile.write(l)
sys.exit(0)
""")
if os.path.normcase('.c') == os.path.normcase('.C'):
- alt_cc_suffix = '.CC'
+ alt_cpp_suffix = '.cpp'
else:
- alt_cc_suffix = '.cc'
+ alt_cpp_suffix = '.C'
test.write('SConstruct', """
env = Environment(SHCXXCOM = r'%(python)s mycc.py $TARGET $SOURCE',
SHCXXCOMSTR = 'Building shared object $TARGET from $SOURCE',
SHOBJSUFFIX='.obj')
-env.SharedObject(target = 'test1', source = 'test1.cc')
-env.SharedObject(target = 'test2', source = 'test2%(alt_cc_suffix)s')
+env.SharedObject(target = 'test1', source = 'test1.cpp')
+env.SharedObject(target = 'test2', source = 'test2.cc')
+env.SharedObject(target = 'test3', source = 'test3.cxx')
+env.SharedObject(target = 'test4', source = 'test4.c++')
+env.SharedObject(target = 'test5', source = 'test5.C++')
+env.SharedObject(target = 'test6', source = 'test6%(alt_cpp_suffix)s')
""" % locals())
-test.write('test1.cc', """\
-test1.cc
-/*cc*/
-""")
-
-test.write('test2'+alt_cc_suffix, """\
-test2.CC
-/*cc*/
-""")
+test.write('test1.cpp', "test1.cpp\n/*c++*/\n")
+test.write('test2.cc', "test2.cc\n/*c++*/\n")
+test.write('test3.cxx', "test3.cxx\n/*c++*/\n")
+test.write('test4.c++', "test4.c++\n/*c++*/\n")
+test.write('test5.C++', "test5.C++\n/*c++*/\n")
+test.write('test6'+alt_cpp_suffix, "test6.C\n/*c++*/\n")
test.run(stdout = test.wrap_stdout("""\
-Building shared object test1.obj from test1.cc
-Building shared object test2.obj from test2%(alt_cc_suffix)s
+Building shared object test1.obj from test1.cpp
+Building shared object test2.obj from test2.cc
+Building shared object test3.obj from test3.cxx
+Building shared object test4.obj from test4.c++
+Building shared object test5.obj from test5.C++
+Building shared object test6.obj from test6%(alt_cpp_suffix)s
""" % locals()))
-test.must_match('test1.obj', "test1.cc\n")
-test.must_match('test2.obj', "test2.CC\n")
+test.must_match('test1.obj', "test1.cpp\n")
+test.must_match('test2.obj', "test2.cc\n")
+test.must_match('test3.obj', "test3.cxx\n")
+test.must_match('test4.obj', "test4.c++\n")
+test.must_match('test5.obj', "test5.C++\n")
+test.must_match('test6.obj', "test6.C\n")
diff --git a/test/M4.py b/test/M4.py
index cc35540..bf56e74 100644
--- a/test/M4.py
+++ b/test/M4.py
@@ -78,12 +78,12 @@ os.system(string.join(sys.argv[1:], " "))
""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
test.write('SConstruct', """
-foo = Environment(M4FLAGS='-DFFF=fff')
+foo = Environment(M4=r'%(m4)s', M4FLAGS='-DFFF=fff')
m4 = foo.Dictionary('M4')
-bar = Environment(M4 = r'%s wrapper.py ' + m4, M4FLAGS='-DBBB=bbb')
+bar = Environment(M4 = r'%(python)s wrapper.py ' + m4, M4FLAGS='-DBBB=bbb')
foo.M4(target = 'foo.x', source = 'foo.x.m4')
bar.M4(target = 'bar', source = 'bar.m4')
-""" % python)
+""" % locals())
test.write('foo.x.m4', "line 1\n"
"FFF\n"
diff --git a/test/builddir-reflect.py b/test/builddir-reflect.py
index 0adc45e..7ce2a5b 100644
--- a/test/builddir-reflect.py
+++ b/test/builddir-reflect.py
@@ -33,10 +33,14 @@ in the build_dir as sources for that same build dir.
Test based on bug #1055521 filed by Gary Oberbrunner.
"""
+import os.path
+import re
+
import TestSCons
test = TestSCons.TestSCons()
python = TestSCons.python
+re_python = re.escape(python)
test.write("mycc.py", """
print 'Compile'
@@ -79,12 +83,16 @@ main() { printf(HI_STR);}
cpppath = 'dir1/dir2' # note, no leading '#'
test.write('SConstruct', sconstruct % locals() )
+targets = re.escape(os.path.join('dir1', 'dir2'))
+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++.
test.run(arguments = '',
stdout=test.wrap_stdout("""\
-scons: building associated BuildDir targets: dir1/dir2
-%(python)s mycc.py INC_dir1/dir2/dir1/dir2_CNI .+
+scons: building associated BuildDir targets: %(targets)s
+%(re_python)s mycc\\.py.* %(INC_CNI)s .+
Compile
-%(python)s mylink.py .+
+%(re_python)s mylink\\.py .+
Link
""" % locals()),
match=TestSCons.match_re,
@@ -103,12 +111,15 @@ test.must_not_exist('dir1')
cpppath = '#dir1/dir2' # note leading '#'
test.write('SConstruct', sconstruct % locals() )
+INC_CNI = re.escape(os.path.join('INC_dir1', 'dir2_CNI'))
+
+# The .* after mycc\\.py below handles /nologo flags from Visual C/C++.
test.run(arguments = '',
stdout=test.wrap_stdout("""\
-scons: building associated BuildDir targets: dir1/dir2
-%(python)s mycc.py INC_dir1/dir2_CNI .+
+scons: building associated BuildDir targets: %(targets)s
+%(re_python)s mycc\\.py.* %(INC_CNI)s .+
Compile
-%(python)s mylink.py .+
+%(re_python)s mylink\\.py .+
Link
""" % locals()),
match=TestSCons.match_re,
diff --git a/test/builder-wrappers.py b/test/builder-wrappers.py
index dbde302..d463cce 100644
--- a/test/builder-wrappers.py
+++ b/test/builder-wrappers.py
@@ -37,9 +37,9 @@ test.write('SConstruct', """
import os.path
import string
def cat(target, source, env):
- fp = open(str(target[0]), 'w')
+ fp = open(str(target[0]), 'wb')
for s in map(str, source):
- fp.write(open(s).read())
+ fp.write(open(s, 'rb').read())
Cat = Builder(action=cat)
def Wrapper(env, target, source):
if not target:
diff --git a/test/import.py b/test/import.py
index cfe72e6..a8a86bf 100644
--- a/test/import.py
+++ b/test/import.py
@@ -134,11 +134,14 @@ tools = [
'zip',
]
-error_output = {
- 'icl' : """
+intel_license_warning = """
scons: warning: Intel license dir was not found. Tried using the INTEL_LICENSE_FILE environment variable (), the registry () and the default path (C:\Program Files\Common Files\Intel\Licenses). Using the default path as a last resort.
File "SConstruct", line 1, in ?
-""",
+"""
+
+error_output = {
+ 'icl' : intel_license_warning,
+ 'intelc' : intel_license_warning,
'qt' : """
scons: warning: Could not detect qt, using empty QTDIR
File "SConstruct", line 1, in ?
diff --git a/test/midl.py b/test/midl.py
index cf80044..a41ac01 100644
--- a/test/midl.py
+++ b/test/midl.py
@@ -43,7 +43,9 @@ test.write('SConstruct',"""
import os.path
import os
-env = Environment(CCFLAGS = ' -nologo ', CPPPATH='${TARGET.dir}')
+env = Environment(CCFLAGS = ' -nologo ',
+ CPPPATH = '${TARGET.dir}',
+ MSVS_USE_MFC_DIRS = 1)
Export('env')
BuildDir('build', 'src')
diff --git a/test/pre-post-actions.py b/test/pre-post-actions.py
index db5d5be..d0e8084 100644
--- a/test/pre-post-actions.py
+++ b/test/pre-post-actions.py
@@ -56,7 +56,7 @@ def before(env, target, source):
def after(env, target, source):
t = str(target[0])
- a = "after_" + os.path.splitext(t)[0]
+ a = "after_" + t
fin = open(t, "rb")
fout = open(a, "wb")
fout.write(fin.read())
@@ -111,7 +111,7 @@ test.run(program=after_bar_exe, stdout="bar.c\n")
test.write(['work2', 'SConstruct'], """\
def b(target, source, env):
- open(str(target[0]), 'w').write(env['X'] + '\\n')
+ open(str(target[0]), 'wb').write(env['X'] + '\\n')
env1 = Environment(X='111')
env2 = Environment(X='222')
B = Builder(action = b, env = env1, multi=1)