summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2005-08-13 05:42:18 (GMT)
committerSteven Knight <knight@baldmt.com>2005-08-13 05:42:18 (GMT)
commit52fcda2435759339de636e5d5abad71b0f5372ad (patch)
tree7b99184d14e042b4f58b1f2186cbf70f4f05cfc8
parent90376f36df71401df8e7cf71fead9b7869153159 (diff)
downloadSCons-52fcda2435759339de636e5d5abad71b0f5372ad.zip
SCons-52fcda2435759339de636e5d5abad71b0f5372ad.tar.gz
SCons-52fcda2435759339de636e5d5abad71b0f5372ad.tar.bz2
Add a skip_test() method to the infrastructure and use it for test scripts that skip all or part of their tests based on tool availability or test platform.
-rw-r--r--etc/TestSCons.py27
-rw-r--r--test/Fortran/F77PATH.py2
-rw-r--r--test/Fortran/F90PATH.py23
-rw-r--r--test/Fortran/FORTRANPATH.py2
-rw-r--r--test/Java/JAR.py6
-rw-r--r--test/Java/JARFLAGS.py6
-rw-r--r--test/Java/JAVAC.py3
-rw-r--r--test/Java/JAVACFLAGS.py3
-rw-r--r--test/Java/JAVAH.py6
-rw-r--r--test/PharLap.py2
-rw-r--r--test/Repository/Java.py3
-rw-r--r--test/Repository/JavaH.py6
-rw-r--r--test/Repository/RMIC.py6
13 files changed, 58 insertions, 37 deletions
diff --git a/etc/TestSCons.py b/etc/TestSCons.py
index 791415d..fec51a4 100644
--- a/etc/TestSCons.py
+++ b/etc/TestSCons.py
@@ -242,6 +242,33 @@ class TestSCons(TestCommon):
kw['match'] = self.match_re_dotall
apply(self.run, [], kw)
+ def skip_test(self, message="Skipping test.\n"):
+ """Skips a test.
+
+ Proper test-skipping behavior is dependent on whether we're being
+ executed as part of development of a change under Aegis.
+
+ Technically, skipping a test is a NO RESULT, but Aegis will
+ treat that as a test failure and prevent the change from going
+ to the next step. We don't want to force anyone using Aegis
+ to have to install absolutely every tool used by the tests,
+ so we actually report to Aegis that a skipped test has PASSED
+ so that the workflow isn't held up.
+ """
+ if message:
+ sys.stdout.write(message)
+ sys.stdout.flush()
+ devdir = os.popen("aesub '$dd' 2>/dev/null", "r").read()[:-1]
+ intdir = os.popen("aesub '$intd' 2>/dev/null", "r").read()[:-1]
+ if devdir and self._cwd[:len(devdir)] == devdir or \
+ intdir and self._cwd[:len(intdir)] == intdir:
+ # We're under the development directory for this change,
+ # so this is an Aegis invocation; pass the test (exit 0).
+ self.pass_test()
+ else:
+ self.no_result()
+
+
def java_ENV(self):
"""
Return a default external environment that uses a local Java SDK
diff --git a/test/Fortran/F77PATH.py b/test/Fortran/F77PATH.py
index e88cdc7..4308bed 100644
--- a/test/Fortran/F77PATH.py
+++ b/test/Fortran/F77PATH.py
@@ -39,7 +39,7 @@ args = prog + ' ' + subdir_prog + ' ' + variant_prog
test = TestSCons.TestSCons()
if not test.detect('F77', 'g77'):
- test.pass_test()
+ test.skip_test('Found no $F77 tool; skipping test.\n')
test.subdir('include', 'subdir', ['subdir', 'include'], 'inc2')
diff --git a/test/Fortran/F90PATH.py b/test/Fortran/F90PATH.py
index 7dbbf2b..c1b6f49 100644
--- a/test/Fortran/F90PATH.py
+++ b/test/Fortran/F90PATH.py
@@ -39,16 +39,23 @@ args = prog + ' ' + subdir_prog + ' ' + variant_prog
test = TestSCons.TestSCons()
-#if not test.detect('F90', 'g90'):
-# test.pass_test()
-base = '/opt/intel_fc_80'
-F90 = os.path.join(base, 'bin', 'ifort')
+baselist = [
+ '/opt/intel_fc_80',
+ '/opt/intel/fc/9.0',
+]
+
+F90 = None
+for base in baselist:
+ ifort = os.path.join(base, 'bin', 'ifort')
+ if os.path.exists(ifort):
+ F90 = ifort
+
+if not F90:
+ l = string.join(baselist, '\n\t')
+ test.skip_test('No (hard-coded) F90 compiler under:' + l + '\n')
+
LIBPATH = os.path.join(base, 'lib')
LIBS = ['irc']
-if not os.path.exists(F90):
- sys.stderr.write('No (hard-coded) F90 compiler %s\n' % F90)
- test.no_result(1)
-
os.environ['LD_LIBRARY_PATH'] = LIBPATH
test.subdir('include', 'subdir', ['subdir', 'include'], 'inc2')
diff --git a/test/Fortran/FORTRANPATH.py b/test/Fortran/FORTRANPATH.py
index ec1b13e..fc40bf1 100644
--- a/test/Fortran/FORTRANPATH.py
+++ b/test/Fortran/FORTRANPATH.py
@@ -39,7 +39,7 @@ args = prog + ' ' + subdir_prog + ' ' + variant_prog
test = TestSCons.TestSCons()
if not test.detect('F77', 'g77'):
- test.pass_test()
+ test.skip_test('Found no $F77 tool; skipping test.\n')
test.subdir('include', 'subdir', ['subdir', 'include'], 'inc2')
diff --git a/test/Java/JAR.py b/test/Java/JAR.py
index 42f2c5a..f0e3b3a 100644
--- a/test/Java/JAR.py
+++ b/test/Java/JAR.py
@@ -126,16 +126,14 @@ if test.detect_tool('javac', ENV=ENV):
else:
where_javac = test.where_is('javac')
if not where_javac:
- print "Could not find Java javac, skipping test(s)."
- test.pass_test(1)
+ test.skip_test("Could not find Java javac, skipping test(s).\n")
if test.detect_tool('jar', ENV=ENV):
where_jar = test.detect('JAR', 'jar', ENV=ENV)
else:
where_jar = test.where_is('jar')
if not where_jar:
- print "Could not find Java jar, skipping test(s)."
- test.pass_test(1)
+ test.skip_test("Could not find Java jar, skipping test(s).\n")
test.write("wrapper.py", """\
diff --git a/test/Java/JARFLAGS.py b/test/Java/JARFLAGS.py
index 9a846ec..64eb1a4 100644
--- a/test/Java/JARFLAGS.py
+++ b/test/Java/JARFLAGS.py
@@ -39,16 +39,14 @@ if test.detect_tool('javac', ENV=ENV):
else:
where_javac = test.where_is('javac')
if not where_javac:
- print "Could not find Java javac, skipping test(s)."
- test.pass_test(1)
+ test.skip_test("Could not find Java javac, skipping test(s).\n")
if test.detect_tool('jar', ENV=ENV):
where_jar = test.detect('JAR', 'jar', ENV=ENV)
else:
where_javac = test.where_is('jar')
if not where_jar:
- print "Could not find Java jar, skipping test(s)."
- test.pass_test(1)
+ test.skip_test("Could not find Java jar, skipping test(s).\n")
test.write('SConstruct', """
env = Environment(tools = ['javac', 'jar'],
diff --git a/test/Java/JAVAC.py b/test/Java/JAVAC.py
index a89ed52..dd09e35 100644
--- a/test/Java/JAVAC.py
+++ b/test/Java/JAVAC.py
@@ -99,8 +99,7 @@ if test.detect_tool('javac', ENV=ENV):
else:
where_javac = test.where_is('javac')
if not where_javac:
- print "Could not find Java javac, skipping test(s)."
- test.pass_test(1)
+ test.skip_test("Could not find Java javac, skipping test(s).\n")
diff --git a/test/Java/JAVACFLAGS.py b/test/Java/JAVACFLAGS.py
index d0ab847..a237e91 100644
--- a/test/Java/JAVACFLAGS.py
+++ b/test/Java/JAVACFLAGS.py
@@ -37,8 +37,7 @@ if test.detect_tool('javac', ENV=ENV):
else:
where_javac = test.where_is('javac')
if not where_javac:
- print "Could not find Java javac, skipping test(s)."
- test.pass_test(1)
+ test.skip_test("Could not find Java javac, skipping test(s).\n")
test.subdir('src')
diff --git a/test/Java/JAVAH.py b/test/Java/JAVAH.py
index b70fde0..f9a052e 100644
--- a/test/Java/JAVAH.py
+++ b/test/Java/JAVAH.py
@@ -103,8 +103,7 @@ else:
if not where_javac:
where_javac = env.WhereIs('javac', '/usr/local/j2sdk1.3.1/bin')
if not where_javac:
- print "Could not find Java javac, skipping test(s)."
- test.pass_test(1)
+ test.skip_test("Could not find Java javac, skipping test(s).\n")
if test.detect_tool('javah'):
where_javah = test.detect('JAVAH', 'javah')
@@ -115,8 +114,7 @@ else:
if not where_javah:
where_javah = env.WhereIs('javah', '/usr/local/j2sdk1.3.1/bin')
if not where_javah:
- print "Could not find Java javah, skipping test(s)."
- test.pass_test(1)
+ test.skip_test("Could not find Java javah, skipping test(s).\n")
diff --git a/test/PharLap.py b/test/PharLap.py
index d9f8993..9652598 100644
--- a/test/PharLap.py
+++ b/test/PharLap.py
@@ -34,7 +34,7 @@ import time
test = TestSCons.TestSCons()
if sys.platform != 'win32':
- test.pass_test()
+ test.skip_test('PharLap is only available on win32; skipping test.\n')
test.no_result(not test.detect_tool('linkloc'))
test.no_result(not test.detect_tool('386asm'))
diff --git a/test/Repository/Java.py b/test/Repository/Java.py
index fd2986e..6a45dff 100644
--- a/test/Repository/Java.py
+++ b/test/Repository/Java.py
@@ -41,8 +41,7 @@ java = '/usr/local/j2sdk1.3.1/bin/java'
javac = '/usr/local/j2sdk1.3.1/bin/javac'
if not os.path.exists(javac):
- print "Could not find Java, skipping test(s)."
- test.pass_test(1)
+ test.skip_test("Could not find Java, skipping test(s).\n")
###############################################################################
diff --git a/test/Repository/JavaH.py b/test/Repository/JavaH.py
index c11ad2b..0420ca3 100644
--- a/test/Repository/JavaH.py
+++ b/test/Repository/JavaH.py
@@ -42,12 +42,10 @@ javac = '/usr/local/j2sdk1.3.1/bin/javac'
javah = '/usr/local/j2sdk1.3.1/bin/javah'
if not os.path.exists(javac):
- print "Could not find Java (javac), skipping test(s)."
- test.pass_test(1)
+ test.skip_test("Could not find Java (javac), skipping test(s).\n")
if not os.path.exists(javah):
- print "Could not find Java (javah), skipping test(s)."
- test.pass_test(1)
+ test.skip_test("Could not find Java (javah), skipping test(s).\n")
###############################################################################
diff --git a/test/Repository/RMIC.py b/test/Repository/RMIC.py
index 9282835..011006d 100644
--- a/test/Repository/RMIC.py
+++ b/test/Repository/RMIC.py
@@ -42,12 +42,10 @@ javac = '/usr/local/j2sdk1.3.1/bin/javac'
rmic = '/usr/local/j2sdk1.3.1/bin/rmic'
if not os.path.exists(javac):
- print "Could not find Java (javac), skipping test(s)."
- test.pass_test(1)
+ test.skip_test("Could not find Java (javac), skipping test(s).\n")
if not os.path.exists(rmic):
- print "Could not find Java (rmic), skipping test(s)."
- test.pass_test(1)
+ test.skip_test("Could not find Java (rmic), skipping test(s).\n")
###############################################################################