#!/usr/bin/env python

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 == '-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

cwd = os.getcwd()

map(os.path.abspath, tests)

if build == 'aegis':
    if not version:
	version = os.popen("aesub '$version'").read()[:-1]

    match = re.compile(r'^[CD]0*')

    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, '.')

    version = aegis_to_version(version)

    build_test = os.path.join(cwd, "build", "test")
    scons_dir = os.path.join(build_test, "scons-" + version)

    os.environ['PYTHONPATH'] = string.join([scons_dir,
					    build_test],
					   os.pathsep)

else:

    scons_dir = os.path.join(cwd, 'src')

    os.environ['PYTHONPATH'] = string.join([os.path.join(cwd, 'src'),
					    os.path.join(cwd, 'etc')],
					   os.pathsep)

os.chdir(scons_dir)

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))

@@ -91,16 +91,24 @@
 rt sys%0A%0A
+all = 0%0A
 build = 
@@ -123,16 +123,27 @@
 ug = ''%0A
+tests = %5B%5D%0A
 version 
@@ -193,16 +193,17 @@
 v%5B1:%5D, %22
+a
 b:dv:%22,%0A
@@ -211,16 +211,22 @@
 %09%09    %5B'
+all','
 build=',
@@ -272,24 +272,68 @@
 %0A    if o ==
+ '-a' or o == '--all': all = 1%0A    elif o ==
  '-b' or o =
@@ -500,16 +500,30 @@
 tcwd()%0A%0A
+if tests:%0A    
 map(os.p
@@ -541,16 +541,467 @@
 , tests)
+%0Aelif all:%0A    def find_Test_py(arg, dirname, names):%0A%09global tests%0A        n = filter(lambda n: n%5B-8:%5D == %22Tests.py%22, names)%0A%09n = map(lambda x,d=dirname: os.path.join(d, x), n)%0A%09tests = tests + n%0A    os.path.walk('src', find_Test_py, 0)%0A%0A    def find_py(arg, dirname, names):%0A%09global tests%0A        n = filter(lambda n: n%5B-3:%5D == %22.py%22, names)%0A%09n = map(lambda x,d=dirname: os.path.join(d, x), n)%0A%09tests = tests + n%0A    os.path.walk('test', find_py, 0)
 %0A%0Aif bui
@@ -2001,16 +2001,39 @@
 %5D, %22 %22)%0A
+    if all:%0A%09print cmd%0A
     if o

Add a find-the-tests flag to runtest.py.