summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-04-10 05:35:38 (GMT)
committerSteven Knight <knight@baldmt.com>2003-04-10 05:35:38 (GMT)
commit2f8be7360679ad5e0260f4965ea5dd9506c7b033 (patch)
tree1379c046e82985011c5ab2d7604adf055e3140b9 /test
parent81e5793a07783b29a13004f834b7579a0e1605bb (diff)
downloadSCons-2f8be7360679ad5e0260f4965ea5dd9506c7b033.zip
SCons-2f8be7360679ad5e0260f4965ea5dd9506c7b033.tar.gz
SCons-2f8be7360679ad5e0260f4965ea5dd9506c7b033.tar.bz2
Implement Tool refactoring. (Chad Austin + Steve Leblanc)
Diffstat (limited to 'test')
-rw-r--r--test/AS.py6
-rw-r--r--test/ASFLAGS.py1
-rw-r--r--test/BuildDir.py14
-rw-r--r--test/CC.py4
-rw-r--r--test/CPPFLAGS.py17
-rw-r--r--test/CPPPATH.py5
-rw-r--r--test/CVS.py8
-rw-r--r--test/CXX.py8
-rw-r--r--test/DVIPDF.py6
-rw-r--r--test/JAR.py3
-rw-r--r--test/JARFLAGS.py4
-rw-r--r--test/JAVAC.py3
-rw-r--r--test/JAVACFLAGS.py4
-rw-r--r--test/Options.py2
14 files changed, 66 insertions, 19 deletions
diff --git a/test/AS.py b/test/AS.py
index 932883d..22eb17c 100644
--- a/test/AS.py
+++ b/test/AS.py
@@ -112,6 +112,7 @@ sys.exit(0)
test.write('SConstruct', """
env = Environment(LINK = r'%s mylink.py',
+ LINKFLAGS = [],
AS = r'%s myas.py',
CC = r'%s myas.py')
env.Program(target = 'test1', source = 'test1.s')
@@ -168,8 +169,9 @@ test.fail_test(test.read('test6' + _exe) != "This is a .SPP file.\n")
as = test.detect('AS', 'as')
+x86 = (sys.platform == 'win32' or string.find(sys.platform, 'linux') != -1)
-if as:
+if as and x86:
test.write("wrapper.py",
"""import os
@@ -248,7 +250,7 @@ main(int argc, char *argv[])
ml = test.where_is('ml')
-if ml:
+if ml and sys.platform == 'win32':
test.write("wrapper.py",
"""import os
diff --git a/test/ASFLAGS.py b/test/ASFLAGS.py
index 229a27a..0331aed 100644
--- a/test/ASFLAGS.py
+++ b/test/ASFLAGS.py
@@ -130,6 +130,7 @@ sys.exit(0)
test.write('SConstruct', """
env = Environment(LINK = r'%s mylink.py',
+ LINKFLAGS = [],
AS = r'%s myas.py', ASFLAGS = '-x',
CC = r'%s myas.py')
env.Program(target = 'test1', source = 'test1.s')
diff --git a/test/BuildDir.py b/test/BuildDir.py
index c7c8dd4..f0e889a 100644
--- a/test/BuildDir.py
+++ b/test/BuildDir.py
@@ -25,6 +25,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
+import string
import sys
import time
import TestSCons
@@ -97,7 +98,12 @@ SConscript(File('SConscript', var4), "env")
env = Environment(CPPPATH='.', F77PATH='.')
SConscript('../build/var5/SConscript', "env")
SConscript('../build/var6/SConscript', "env")
-""")
+""")
+
+if string.find(sys.platform, 'irix') != -1:
+ fortran_runtime = 'ftn'
+else:
+ fortran_runtime = 'g2c'
test.subdir(['test', 'src'])
test.write(['test', 'src', 'SConscript'], """
@@ -132,9 +138,9 @@ except:
if f77 and WhereIs(env['F77']):
env.Command(target='b2.f', source='b2.in', action=buildIt)
- env.Copy(LIBS = ['g2c']).Program(target='bar2', source='b2.f')
- env.Copy(LIBS = ['g2c']).Program(target='bar1', source='b1.f')
-""")
+ env.Copy(LIBS = [r'%s']).Program(target='bar2', source='b2.f')
+ env.Copy(LIBS = [r'%s']).Program(target='bar1', source='b1.f')
+""" % (fortran_runtime, fortran_runtime))
test.write('test/src/f1.c', r"""
#include "f1.h"
diff --git a/test/CC.py b/test/CC.py
index 94dd6f6..93b0ed5 100644
--- a/test/CC.py
+++ b/test/CC.py
@@ -113,8 +113,10 @@ sys.exit(0)
test.write('SConstruct', """
cc = Environment().Dictionary('CC')
env = Environment(LINK = r'%s mylink.py',
+ LINKFLAGS = [],
CC = r'%s mycc.py',
- CXX = cc)
+ CXX = cc,
+ CXXFLAGS = [])
env.Program(target = 'test1', source = 'test1.c')
""" % (python, python))
diff --git a/test/CPPFLAGS.py b/test/CPPFLAGS.py
index da4ff13..352ed7d 100644
--- a/test/CPPFLAGS.py
+++ b/test/CPPFLAGS.py
@@ -34,9 +34,11 @@ python = TestSCons.python
if sys.platform == 'win32':
_exe = '.exe'
_obj = '.obj'
+ _shobj = '.obj'
else:
_exe = ''
_obj = '.o'
+ _shobj = '.os'
test = TestSCons.TestSCons()
@@ -107,8 +109,10 @@ sys.exit(0)
test.write('SConstruct', """
env = Environment(CPPFLAGS = '-x',
LINK = r'%s mylink.py',
+ LINKFLAGS = [],
CC = r'%s mygcc.py cc',
CXX = r'%s mygcc.py c++',
+ CXXFLAGS = [],
F77 = r'%s mygcc.py g77')
env.Program(target = 'foo', source = Split('test1.c test2.cpp test3.F'))
""" % (python, python, python, python))
@@ -128,7 +132,7 @@ test.write('test3.F', r"""test3.F
#link
""")
-test.run(arguments = '.', stderr = None)
+test.run(arguments = '.', stderr=None)
test.fail_test(test.read('test1' + _obj) != "test1.c\n#link\n")
@@ -143,8 +147,10 @@ test.fail_test(test.read('mygcc.out') != "cc\nc++\ng77\n")
test.write('SConstruct', """
env = Environment(CPPFLAGS = '-x',
SHLINK = r'%s mylink.py',
+ SHLINKFLAGS = [],
CC = r'%s mygcc.py cc',
CXX = r'%s mygcc.py c++',
+ CXXFLAGS = [],
F77 = r'%s mygcc.py g77')
env.SharedLibrary(target = File('foo.bar'),
source = Split('test1.c test2.cpp test3.F'))
@@ -166,14 +172,17 @@ test.write('test3.F', r"""test3.F
""")
test.unlink('mygcc.out')
+test.unlink('test1' + _obj)
+test.unlink('test2' + _obj)
+test.unlink('test3' + _obj)
test.run(arguments = '.', stderr = None)
-test.fail_test(test.read('test1' + _obj) != "test1.c\n#link\n")
+test.fail_test(test.read('test1' + _shobj) != "test1.c\n#link\n")
-test.fail_test(test.read('test2' + _obj) != "test2.cpp\n#link\n")
+test.fail_test(test.read('test2' + _shobj) != "test2.cpp\n#link\n")
-test.fail_test(test.read('test3' + _obj) != "test3.F\n#link\n")
+test.fail_test(test.read('test3' + _shobj) != "test3.F\n#link\n")
test.fail_test(test.read('foo.bar') != "test1.c\ntest2.cpp\ntest3.F\n")
diff --git a/test/CPPPATH.py b/test/CPPPATH.py
index 06e6933..cb650fa 100644
--- a/test/CPPPATH.py
+++ b/test/CPPPATH.py
@@ -200,7 +200,10 @@ test.up_to_date(arguments = args)
# Check that a null-string CPPPATH doesn't blow up.
test.write('SConstruct', """
env = Environment(CPPPATH = '')
-env.Library('foo', source = '')
+env.Library('foo', source = 'empty.c')
+""")
+
+test.write('empty.c', """
""")
test.run(arguments = '.')
diff --git a/test/CVS.py b/test/CVS.py
index d8d9da5..1296c5e 100644
--- a/test/CVS.py
+++ b/test/CVS.py
@@ -95,6 +95,7 @@ test.run(chdir = 'import',
# Test the most straightforward CVS checkouts, using the module name.
test.write(['work1', 'SConstruct'], """
+import os
def cat(env, source, target):
target = str(target[0])
source = map(str, source)
@@ -102,7 +103,8 @@ def cat(env, source, target):
for src in source:
f.write(open(src, "rb").read())
f.close()
-env = Environment(BUILDERS={'Cat':Builder(action=cat)})
+env = Environment(ENV = { 'PATH' : os.environ['PATH'] },
+ BUILDERS={'Cat':Builder(action=cat)})
env.Prepend(CVSFLAGS='-Q ')
env.Cat('aaa.out', 'foo/aaa.in')
env.Cat('bbb.out', 'foo/bbb.in')
@@ -163,6 +165,7 @@ test.fail_test(not is_writable(test.workpath('work1', 'foo', 'sub', 'fff.in')))
# Test CVS checkouts when the module name is specified.
test.write(['work2', 'SConstruct'], """
+import os
def cat(env, source, target):
target = str(target[0])
source = map(str, source)
@@ -170,7 +173,8 @@ def cat(env, source, target):
for src in source:
f.write(open(src, "rb").read())
f.close()
-env = Environment(BUILDERS={'Cat':Builder(action=cat)})
+env = Environment(ENV = { 'PATH' : os.environ['PATH'] },
+ BUILDERS={'Cat':Builder(action=cat)})
env.Prepend(CVSFLAGS='-q ')
env.Cat('aaa.out', 'aaa.in')
env.Cat('bbb.out', 'bbb.in')
diff --git a/test/CXX.py b/test/CXX.py
index f2b3368..cd2c7a9 100644
--- a/test/CXX.py
+++ b/test/CXX.py
@@ -112,7 +112,9 @@ sys.exit(0)
test.write('SConstruct', """
env = Environment(LINK = r'%s mylink.py',
- CXX = r'%s myc++.py')
+ LINKFLAGS = [],
+ CXX = r'%s myc++.py',
+ CXXFLAGS = [])
env.Program(target = 'test1', source = 'test1.cc')
env.Program(target = 'test2', source = 'test2.cpp')
env.Program(target = 'test3', source = 'test3.cxx')
@@ -161,7 +163,9 @@ if os.path.normcase('.c') != os.path.normcase('.C'):
test.write('SConstruct', """
env = Environment(LINK = r'%s mylink.py',
- CXX = r'%s myc++.py')
+ LINKFLAGS = [],
+ CXX = r'%s myc++.py',
+ CXXFLAGS = [])
env.Program(target = 'test6', source = 'test6.C')
""" % (python, python))
diff --git a/test/DVIPDF.py b/test/DVIPDF.py
index 4d0428a..a140c3a 100644
--- a/test/DVIPDF.py
+++ b/test/DVIPDF.py
@@ -114,9 +114,11 @@ os.system(cmd)
""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
test.write('SConstruct', """
-foo = Environment()
+import os
+foo = Environment(ENV = { 'PATH' : os.environ['PATH'] })
dvipdf = foo.Dictionary('DVIPDF')
-bar = Environment(DVIPDF = r'%s wrapper.py ' + dvipdf)
+bar = Environment(ENV = { 'PATH' : os.environ['PATH'] },
+ DVIPDF = r'%s wrapper.py ' + dvipdf)
foo.PDF(target = 'foo.pdf',
source = foo.DVI(target = 'foo.dvi', source = 'foo.tex'))
bar.PDF(target = 'bar.pdf',
diff --git a/test/JAR.py b/test/JAR.py
index f5b3048..9fdf20e 100644
--- a/test/JAR.py
+++ b/test/JAR.py
@@ -89,6 +89,9 @@ line 3
test.fail_test(test.read('test2' + _exe) != "test2.CLASS\nline 3\n")
+if not os.path.exists('/usr/local/j2sdk1.3.1/bin/javac'):
+ print "Could not find Java, skipping test(s)."
+ test.pass_test(1)
test.write("wrapper.py", """\
diff --git a/test/JARFLAGS.py b/test/JARFLAGS.py
index af5b89d..539806f 100644
--- a/test/JARFLAGS.py
+++ b/test/JARFLAGS.py
@@ -56,6 +56,10 @@ public class Example1
}
""")
+if not os.path.exists('/usr/local/j2sdk1.3.1/bin/javac'):
+ print "Could not find Java, skipping test(s)."
+ test.pass_test(1)
+
test.run(arguments = '.',
stdout = test.wrap_stdout("""\
/usr/local/j2sdk1.3.1/bin/javac -d classes -sourcepath src src/Example1.java
diff --git a/test/JAVAC.py b/test/JAVAC.py
index 9526259..f2910a4 100644
--- a/test/JAVAC.py
+++ b/test/JAVAC.py
@@ -91,6 +91,9 @@ line 3
test.fail_test(test.read('test2.class') != "test2.JAVA\nline3\n")
+if not os.path.exists('/usr/local/j2sdk1.3.1/bin/javac'):
+ print "Could not find Java, skipping test(s)."
+ test.pass_test(1)
test.write("wrapper.py", """\
diff --git a/test/JAVACFLAGS.py b/test/JAVACFLAGS.py
index 1a05e2c..6e02bb6 100644
--- a/test/JAVACFLAGS.py
+++ b/test/JAVACFLAGS.py
@@ -30,6 +30,10 @@ import TestSCons
test = TestSCons.TestSCons()
+if not os.path.exists('/usr/local/j2sdk1.3.1/bin/javac'):
+ print "Could not find Java, skipping test(s)."
+ test.pass_test(1)
+
test.subdir('src')
test.write('SConstruct', """
diff --git a/test/Options.py b/test/Options.py
index 4f979df..9c817ba 100644
--- a/test/Options.py
+++ b/test/Options.py
@@ -58,7 +58,7 @@ opts.Add('CC',
opts.Add('UNSPECIFIED',
'An option with no value')
-def test_tool(env, platform):
+def test_tool(env):
if env['RELEASE_BUILD']:
env['CCFLAGS'] = env['CCFLAGS'] + ' -O'
if env['DEBUG_BUILD']: