"""atfexecute """ import os.path import sys import parser from atfglobals import GlobalObj def _execute_testunit(testunit): """ *) Parse the testcaseslist file in the 'testunit' and select test cases specified for testing 'glusterversion' *) Call Main.py of 'testunit' to execute the testcases. """ return_status = 1 testruninfo_obj = GlobalObj.getTestrunInfoObj() atfdir = testruninfo_obj.getAtfDir() testunit_abspath = atfdir + "/TestUnits/" + testunit testenvfile = testunit_abspath + "/testenv.cfg" testcaseslistfile = testunit_abspath + "/testcaseslist" if not os.path.exists(testenvfile): default_testenvfile = atfdir + "testenv.cfg" if not os.path.exists(testenvfile): print "Skipping TestUnit %s . TestEnv File Not Found" % testenvfile return return_status else: testenvfile = default_testenvfile if not os.path.exists(testcaseslistfile): print "Skipping TestUnit %s" % testunit return return_status else: testcaseslist = [] testcasespassed = None testcasesfailed = None totaltestcases = None testcaseslist = parser.parse_testcaseslist_file(testcaseslistfile) if not testcaseslist: print "Skipping TestUnit %s. No testcases to execute" % testunit return return_status else: sys.path.append(testunit_abspath) import Main print "Executing TestUnit: %s" % testunit print "-" * 50 return_status = Main.main(testenvfile, *testcaseslist) return return_status def execute(): """ *) Execute the TestsCases form TestUnits specified in TestRunInfo File """ testruninfo_obj = GlobalObj.getTestrunInfoObj() testunits = testruninfo_obj.getTestUnits() for testunit in testunits: _execute_testunit(testunit) return 0 __all__ = ['execute']