Repository navigation
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·54 lines (47 loc) · 1.42 KB
/
Copy pathtest.py
File metadata and controls
executable file
·54 lines (47 loc) · 1.42 KB
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
#!/usr/bin/env python3
import multiprocessing
from os import execvp, remove
from pathlib import Path
MOD = Path('github.com/fourdim/kecp')
def basic_test(build_target :str, time_out :str):
execvp('go', ('go', 'test', '-timeout', time_out, '-race', '-cover', '-covermode=atomic', build_target))
def advanced_race_test(build_target :str, time_out :str):
execvp('go', ('go', 'test', '-timeout', time_out, '-cpu=1,9,55,99', '-race', '-count=100', '-failfast', '-cover', '-covermode=atomic', build_target))
test_cases = [
{
'target': 'modules/kecp-channel',
'test_method': advanced_race_test,
'time_out': '30s'
},
{
'target': 'modules/kecp-crypto',
'test_method': basic_test,
'time_out': '30s'
},
{
'target': 'modules/kecp-msg',
'test_method': basic_test,
'time_out': '30s'
},
{
'target': 'modules/kecp-signal',
'test_method': basic_test,
'time_out': '180s'
},
{
'target': 'modules/kecp-validate',
'test_method': basic_test,
'time_out': '30s'
}
]
def test():
ps = []
for test_case in test_cases:
path = Path.joinpath(MOD, test_case['target'])
p = multiprocessing.Process(target=test_case['test_method'], args=(path.as_posix(), test_case['time_out']))
p.start()
ps.append(p)
for p in ps:
p.join()
if __name__ == '__main__':
test()