1 | #!/bin/env python |
---|
2 | |
---|
3 | "Testlet to run the EQRM 'test_all.py' script.""" |
---|
4 | |
---|
5 | import os |
---|
6 | import time |
---|
7 | import test_utils as util |
---|
8 | from for_all_verification import do_tests_checks_demos_audits |
---|
9 | |
---|
10 | name = 'Running EQRM test_all.py' |
---|
11 | |
---|
12 | def test(logfile): |
---|
13 | """ |
---|
14 | |
---|
15 | """ |
---|
16 | result = True |
---|
17 | |
---|
18 | (cluster, domain) = util.get_hostname() |
---|
19 | |
---|
20 | # get python to run |
---|
21 | python_env_var = os.getenv('PYTHON') |
---|
22 | |
---|
23 | # remember the directory we are in and go to EQRM directory |
---|
24 | home_directory = os.getcwd() |
---|
25 | eqrm_path = os.getenv('EQRMPATH') |
---|
26 | if not eqrm_path: |
---|
27 | util.log_print_nl(logfile, "The EQRMPATH environment variable not set, " |
---|
28 | "can't test EQRM.") |
---|
29 | return False |
---|
30 | |
---|
31 | result = do_tests_checks_demos_audits(eqrm_root_dir=eqrm_path, |
---|
32 | python_command=python_env_var) |
---|
33 | |
---|
34 | # os.chdir(os.path.join(eqrm_path)) |
---|
35 | # print 'in %s' % os.getcwd() |
---|
36 | |
---|
37 | # # run clean_all.py |
---|
38 | # util.log_print_nl(logfile, '%s clean_all.py' % python_env_var) |
---|
39 | # (fd_in, fd_out) = os.popen4('%s clean_all.py' % python_env_var) |
---|
40 | # fd_in.write('y\n') |
---|
41 | # fd_in.close() |
---|
42 | # clean_result = fd_out.read() |
---|
43 | # fd_out.close() |
---|
44 | # util.log_print(logfile, clean_result) |
---|
45 | |
---|
46 | # # run test_all.py |
---|
47 | # util.log_print_nl(logfile, '%s test_all.py' % python_env_var) |
---|
48 | # (_, fd_out) = os.popen4('%s test_all.py' % python_env_var) |
---|
49 | # test_result = fd_out.read() |
---|
50 | # status = fd_out.close() |
---|
51 | # util.log_print(logfile, test_result) |
---|
52 | |
---|
53 | # # run check_scenarios.py |
---|
54 | # util.log_print_nl(logfile, '%s check_scenarios.py' % python_env_var) |
---|
55 | # (_, fd_out) = os.popen4('%s check_scenarios.py' % python_env_var) |
---|
56 | # test_result = fd_out.read() |
---|
57 | # status = fd_out.close() |
---|
58 | # util.log_print(logfile, test_result) |
---|
59 | |
---|
60 | # # return to original directory |
---|
61 | # os.chdir(home_directory) |
---|
62 | |
---|
63 | return result |
---|
64 | |
---|
65 | |
---|
66 | if __name__ == '__main__': |
---|
67 | import sys |
---|
68 | |
---|
69 | home_directory = os.getcwd() |
---|
70 | logfile = os.path.join(home_directory, 'test.log') |
---|
71 | if len(sys.argv) > 1: |
---|
72 | logfile = sys.argv[1] |
---|
73 | |
---|
74 | try: |
---|
75 | os.remove(logfile) |
---|
76 | except: |
---|
77 | pass |
---|
78 | |
---|
79 | if not test(logfile): |
---|
80 | sys.exit(10) |
---|
81 | |
---|
82 | sys.exit(0) |
---|