blob: 0f3a9133f44519349674fe0a82dc0f82eaf10e58 (
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#!/usr/bin/env python
import os
import sys
import ATFUtils
def execute():
"""
Description:
Execute the TestsCases for Specified TestUnits.
Keyword is used to select the testscases under each TestUnit
Parameters:
None
Returns:
Success: 0 ( Successful Execution of all TestUnits )
Failure: 1 ( Unsuccessful Test Runs )
"""
testunits = ATFUtils.TestsObj.get_testunits()
atfroot = ATFUtils.get_environ('ATF_ROOT')
for unit in testunits:
testdir = atfroot + "/Glusterfs/TestUnits/" + unit
cwd = os.getcwd()
try:
os.chdir(testdir)
except OSError as (errno, errstr):
ATFUtils.Logger.warning("OSError: [Error %d] %s: %s" % (errno,
errstr, testdir))
ATFUtils.Logger.warning("Ignoring TestUnit:" + testdir)
continue
else:
ATFUtils.set_environ(ATF_WORKUNIT=testdir)
try:
os.mkdir('Log')
except OSError as (errno, errstr):
ATFUtils.Logger.debug("Log Directory already exist")
ATFUtils.LogObj.add_detaillog_handler('ATF_LOG')
ATFUtils.Logger.info("Starting Tests in TestUnit: " + testdir)
sys.path.append(testdir)
import Main
returncode = Main.main()
if returncode:
ATFUtils.Logger.error("Test Runs Unsuccessful in TestUnit: " +
testdir)
ATFUtils.Logger.info("Ending Tests in TestUnit: " + testdir)
ATFUtils.LogObj.remove_detaillog_handler('ATF_LOG')
continue
else:
ATFUtils.Logger.info("Test Runs Successful in TestUnit: " +
testdir)
ATFUtils.Logger.info("Ending Tests in TestUnit: " + testdir)
ATFUtils.LogObj.remove_detaillog_handler('ATF_LOG')
continue
return 0
|