-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun.py
executable file
·51 lines (39 loc) · 1.28 KB
/
run.py
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
#!/usr/bin/env python
# encoding: utf-8
import qemubox
import time
from testcase import *
from testcase.filesystem import *
from testcase.kernel import *
from testcase.example import *
def RunTestCase(box):
tc = globals()
for item in tc:
if item.startswith('testcase'):
testcase = tc[item]
if testcase.__name__.rfind('.'):
name = testcase.__name__[testcase.__name__.rfind('.') + 1:]
else:
name = testcase.__name__
# print(testcase.__name__),
if testcase.__doc__:
print(testcase.__doc__),
if not testcase.run(box):
print("[%s] failed." % name)
return
else:
print("[%s] passed!" % name)
return
if __name__ == '__main__':
box = qemubox.BoxStartup()
if qemubox.BoxReady(box):
if not qemubox.BoxFileSystemReady(box):
if qemubox.BoxFileSystemFormat(box):
box = qemubox.BoxReload(box)
if not qemubox.BoxFileSystemReady(box):
print('file system failed! Please check manually!')
qemubox.BoxClose(box)
exit(-1)
RunTestCase(box)
time.sleep(0.5)
qemubox.BoxClose(box)