From 155f566daf0f457e0708e06705d7a0541a5d3f7e Mon Sep 17 00:00:00 2001 From: anthonyroach Date: Wed, 29 Aug 2001 23:27:48 +0000 Subject: [PATCH] Change runtest.py so it executes locally by default. git-svn-id: http://scons.tigris.org/svn/scons/trunk@26 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- config | 2 +- runtest.py | 88 ++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 56 insertions(+), 34 deletions(-) diff --git a/config b/config index bad5168f..d653bb2d 100644 --- a/config +++ b/config @@ -242,7 +242,7 @@ diff_command = * written to conform to Perl conventions) and Aegis' expectations. * See the comments in the test.pl script itself for details. */ -test_command = "python runtest.py -v ${VERsion} ${File_Name}"; +test_command = "python runtest.py -b aegis -v ${VERsion} ${File_Name}"; new_test_filename = "test/CHANGETHIS.py"; diff --git a/runtest.py b/runtest.py index 5c7b8de8..9e51d765 100644 --- a/runtest.py +++ b/runtest.py @@ -1,51 +1,73 @@ #!/usr/bin/env python -import getopt, os, os.path, re, string, sys - -opts, tests = getopt.getopt(sys.argv[1:], "dv:") - +import getopt +import os +import os.path +import re +import string +import sys + +build = None debug = '' version = None +opts, tests = getopt.getopt(sys.argv[1:], "b:dv:", + ['build=','debug','version=']) + for o, a in opts: - if o == '-d': debug = "/usr/lib/python1.5/pdb.py" - if o == '-v': version = a + if o == '-b' or o == '-build': build = a + elif o == '-d' or o == '--debug': debug = "/usr/lib/python1.5/pdb.py" + elif o == '-v' or o == '--version': version = a -if not version: - version = os.popen("aesub '$version'").read()[:-1] +cwd = os.getcwd() -match = re.compile(r'^[CD]0*') +map(os.path.abspath, tests) -def aegis_to_version(aever): - arr = string.split(aever, '.') - end = max(len(arr) - 1, 2) - arr = map(lambda e: match.sub('', e), arr[:end]) - def rep(e): - if len(e) == 1: - e = '0' + e - return e - arr[1:] = map(rep, arr[1:]) - return string.join(arr, '.') +if build == 'aegis': + if not version: + version = os.popen("aesub '$version'").read()[:-1] -version = aegis_to_version(version) + match = re.compile(r'^[CD]0*') -cwd = os.getcwd() + def aegis_to_version(aever): + arr = string.split(aever, '.') + end = max(len(arr) - 1, 2) + arr = map(lambda e: match.sub('', e), arr[:end]) + def rep(e): + if len(e) == 1: + e = '0' + e + return e + arr[1:] = map(rep, arr[1:]) + return string.join(arr, '.') -map(os.path.abspath, tests) + version = aegis_to_version(version) -build_test = os.path.join(cwd, "build", "test") -scons_ver = os.path.join(build_test, "scons-" + version) + build_test = os.path.join(cwd, "build", "test") + scons_dir = os.path.join(build_test, "scons-" + version) -os.chdir(scons_ver) + os.environ['PYTHONPATH'] = string.join([scons_dir, + build_test], + os.pathsep) -os.environ['PYTHONPATH'] = scons_ver + ':' + build_test +else: -exit = 0 + scons_dir = os.path.join(cwd, 'src') -for path in tests: - if not os.path.isabs(path): - path = os.path.join(cwd, path) - if os.system("python " + debug + " " + path): - exit = 1 + os.environ['PYTHONPATH'] = string.join([os.path.join(cwd, 'src'), + os.path.join(cwd, 'etc')], + os.pathsep) + +os.chdir(scons_dir) -sys.exit(exit) +fail = [] + +for path in tests: + if os.path.isabs(path): + abs = path + else: + abs = os.path.join(cwd, path) + cmd = string.join(["python", debug, abs], " ") + if os.system(cmd): + fail.append(path) + +sys.exit(len(fail)) -- 2.26.2