source: misc/tools/acceptance_tests/test_eqrm.py @ 7663

Last change on this file since 7663 was 7663, checked in by gray, 14 years ago

bug fix

  • Property svn:executable set to *
File size: 2.1 KB
RevLine 
[7025]1#!/bin/env python
2
[7656]3"Testlet to run the EQRM 'test_all.py' script."""
[7025]4
5import os
6import time
7import test_utils as util
[7659]8from for_all_verification import do_tests_checks_demos_audits
[7025]9
10name = 'Running EQRM test_all.py'
11
12def test(logfile):
[7659]13    """
14   
15    """
[7025]16    result = True
17
18    (cluster, domain) = util.get_hostname()
19
20    # get python to run
21    python_env_var = os.getenv('PYTHON')
22
[7659]23    # remember the directory we are in and go to EQRM directory
[7025]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
[7659]30   
31    result = do_tests_checks_demos_audits(eqrm_root_dir=eqrm_path,
32                                          python_command=python_env_var)
[7025]33
[7659]34#     os.chdir(os.path.join(eqrm_path))
35#     print 'in %s' % os.getcwd()
[7025]36
[7659]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)
[7079]45
[7659]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)
[7025]52
[7659]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)
[7237]59
[7663]60    # return to original directory
61    os.chdir(home_directory)
[7025]62
63    return result
64
65
66if __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)
Note: See TracBrowser for help on using the repository browser.