forked from h2oai/h2o-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjunit.py
90 lines (79 loc) · 3.33 KB
/
junit.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import os, json, unittest, time, shutil, sys, getpass
import h2o
class JUnit(unittest.TestCase):
def testScoring(self):
(ps, stdout, stderr) = h2o.spawn_cmd('junit', [
'java',
'-ea', '-jar', h2o.find_file('target/h2o.jar'),
'-mainClass', 'org.junit.runner.JUnitCore',
# The tests
'water.score.ScorePmmlTest',
'water.score.ScoreTest',
])
rc = ps.wait(None)
out = file(stdout).read()
err = file(stderr).read()
if rc is None:
ps.terminate()
raise Exception("junit timed out.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
elif rc != 0:
raise Exception("junit failed.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
def testAll(self):
try:
h2o.build_cloud(node_count=2)
# we don't have the port or ip configuration here
# that util/h2o.py does? Keep this in synch with spawn_h2o there.
# also don't have --nosigar here?
(ps, stdout, stderr) = h2o.spawn_cmd('junit', [
'java',
'-Dh2o.arg.ice_root='+h2o.tmp_dir('ice.'),
'-Dh2o.arg.name='+h2o.cloud_name(),
'-Dh2o.arg.ip='+h2o.get_ip_address(),
'-ea', '-jar', h2o.find_file('target/h2o.jar'),
'-mainClass', 'org.junit.runner.JUnitCore',
# The tests
#'hex.GLMGridTest',
'hex.HistogramTest',
'hex.GLMTest',
'hex.KMeansTest',
'hex.rf.RandomForestTest',
'hex.rf.RFPredDomainTest',
'water.AtomicTest',
'water.AutoSerialTest',
'water.KVTest',
'water.KeyToString',
'water.api.RStringTest',
'water.exec.ExprTest',
'water.parser.DatasetCornerCasesTest',
'water.parser.ParseProgressTest',
'water.parser.ParserTest',
'water.parser.RReaderTest',
])
rc = ps.wait(None)
out = file(stdout).read()
err = file(stderr).read()
if rc is None:
ps.terminate()
raise Exception("junit timed out.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
elif rc != 0:
raise Exception("junit failed.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
finally:
h2o.tear_down_cloud()
#def testMore(self):
# (ps, stdout, stderr) = h2o.spawn_cmd('junit', [
# 'java',
# '-ea', '-jar', h2o.find_file('target/h2o.jar'),
# '-mainClass', 'org.junit.runner.JUnitCore',
# 'hex.rf.RFRunner',
# ])
#
# rc = ps.wait(None)
# out = file(stdout).read()
# err = file(stderr).read()
# if rc is None:
# ps.terminate()
# raise Exception("junit timed out.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
# elif rc != 0:
# raise Exception("junit failed.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
if __name__ == '__main__':
h2o.unit_main()