forked from LLNL/Caliper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_thread.py
42 lines (33 loc) · 1.51 KB
/
test_thread.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
# Thread tests
import unittest
import calipertest as calitest
class CaliperThreadTest(unittest.TestCase):
""" Caliper thread test case """
def test_thread(self):
target_cmd = [ './ci_test_thread' ]
query_cmd = [ '../../src/tools/cali-query/cali-query', '-e' ]
caliper_config = {
'CALI_CONFIG_PROFILE' : 'serial-trace',
'CALI_RECORDER_FILENAME' : 'stdout',
'CALI_LOG_VERBOSITY' : '0'
}
query_output = calitest.run_test_with_query(target_cmd, query_cmd, caliper_config)
snapshots = calitest.get_snapshots_from_text(query_output)
self.assertTrue(len(snapshots) >= 16)
self.assertTrue(calitest.has_snapshot_with_keys(
snapshots, {'local', 'global', 'region'}))
self.assertFalse(calitest.has_snapshot_with_keys(
snapshots, {'local', 'my_thread_id' }))
self.assertTrue(calitest.has_snapshot_with_attributes(
snapshots, {'my_thread_id' : '16',
'region' : 'thread_proc',
'global' : '999' }))
self.assertTrue(calitest.has_snapshot_with_attributes(
snapshots, {'my_thread_id' : '49',
'region' : 'thread_proc',
'global' : '999' }))
self.assertTrue(calitest.has_snapshot_with_attributes(
snapshots, { 'region' : 'main',
'local' : '99' }))
if __name__ == "__main__":
unittest.main()