forked from LLNL/Caliper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_caliquery.py
47 lines (33 loc) · 1.43 KB
/
test_caliquery.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
# Some tests for the cali-query tool
import json
import unittest
import calipertest as cat
class CaliperCaliQueryTest(unittest.TestCase):
""" cali-query test cases """
def test_caliquery_args(self):
target_cmd = [ './ci_test_aggregate' ]
query_cmd = [ '../../src/tools/cali-query/cali-query', '--aggregate', 'count(),sum(time.inclusive.duration.ns)', '--aggregate-key=loop.id', '-s', 'loop.id=A', '--json' ]
caliper_config = {
'CALI_CONFIG_PROFILE' : 'serial-trace',
'CALI_RECORDER_FILENAME' : 'stdout',
'CALI_LOG_VERBOSITY' : '0',
}
obj = json.loads( cat.run_test_with_query(target_cmd, query_cmd, caliper_config) )
self.assertEqual(obj[0]["path"], "A")
self.assertEqual(obj[0]["count"], 19)
self.assertTrue("sum#time.inclusive.duration.ns" in obj[0])
def test_caliquery_list_services(self):
target_cmd = [ '../../src/tools/cali-query/cali-query', '--help=services' ]
env = {
'CALI_LOG_VERBOSITY' : '0',
}
service_targets = [
'aggregate', 'event', 'recorder', 'report', 'timestamp', 'trace'
]
report_out,_ = cat.run_test(target_cmd, env)
res = report_out.decode().split()
for target in service_targets:
if not target in res:
self.fail('%s not found in log' % target)
if __name__ == "__main__":
unittest.main()