summaryrefslogtreecommitdiffstats
path: root/runtest.py
blob: 5c7b8de8a229fa51d52e54d9417ae0693a70dd21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python

import getopt, os, os.path, re, string, sys

opts, tests = getopt.getopt(sys.argv[1:], "dv:")

debug = ''
version = None

for o, a in opts:
    if o == '-d': debug = "/usr/lib/python1.5/pdb.py"
    if o == '-v': version = a

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)

cwd = os.getcwd()

map(os.path.abspath, tests)

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

os.chdir(scons_ver)

os.environ['PYTHONPATH']  = scons_ver + ':' + build_test

exit = 0

for path in tests:
    if not os.path.isabs(path):
	path = os.path.join(cwd, path)
    if os.system("python " + debug + " " + path):
	exit = 1

sys.exit(exit)