summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-11-21 00:41:12 (GMT)
committerSteven Knight <knight@baldmt.com>2004-11-21 00:41:12 (GMT)
commitffc625f8cf332399ba754bf2ebe9e700e5122eac (patch)
tree9c21395a4d49fd3aba7a22fe8e93b041445b00b3 /test
parent376cfbfee0d52e867f2c6b955b6e218d788284ba (diff)
downloadSCons-ffc625f8cf332399ba754bf2ebe9e700e5122eac.zip
SCons-ffc625f8cf332399ba754bf2ebe9e700e5122eac.tar.gz
SCons-ffc625f8cf332399ba754bf2ebe9e700e5122eac.tar.bz2
Miscellaneous fixes: portability and version fixes, missing , better CXXCOM tests, ATL include directories, intelc Tool import.
Diffstat (limited to 'test')
-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
10 files changed, 127 insertions, 84 deletions
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)