00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 import os, sys
00034 from stat import *
00035
00036
00037 if (len(sys.argv) < 2):
00038 sys.stderr.write("Expecting a path argument for the testsuite directory\n")
00039 sys.exit(1)
00040 else:
00041 sys.stdout.write("\n***************************************************\n")
00042 sys.stdout.write("* *\n")
00043 sys.stdout.write("* Starting Bio-SPHERE testsuite *\n")
00044 sys.stdout.write("* *\n")
00045 sys.stdout.write("***************************************************\n")
00046 testdir = sys.argv[1]
00047
00048
00049 old_cwd = os.getcwd()
00050 os.chdir(testdir)
00051
00052
00053 error_count = 0
00054 for file in os.listdir("."):
00055 st = os.stat(file)
00056 prefix = file.split("_")[0]
00057 if (prefix == "test" and st[0] & (S_IXUSR | S_IXGRP | S_IXOTH) != 0 and not S_ISDIR(st[0])):
00058 num_dots = 39 - len(file)
00059 sys.stdout.write("executing " + file + "." * num_dots)
00060 rv = os.spawnl(os.P_WAIT, file, file)
00061 if rv == 0:
00062 sys.stdout.write("OK\n")
00063 else:
00064 sys.stdout.write("error code %d\n" % rv)
00065 error_count += 1
00066
00067
00068 os.chdir(old_cwd)
00069 if error_count > 0:
00070 sys.stdout.write("\nThere were some errors.\nPlease take a look at the individual testcases that went wrong\n")
00071 sys.exit(1)
00072 else:
00073 sys.stdout.write("\nAll tests passed successfully!\n")
00074 sys.exit()