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
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')
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')
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')
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", """\
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'],
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")
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')
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')
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")
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'))
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")
###############################################################################
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")
###############################################################################
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")
###############################################################################