Skip to content

Commit 23898ea

Browse files
authored
Consolidate tests, remove some superfluous test apps (LLNL#235)
1 parent 7600e1a commit 23898ea

12 files changed

+23
-169
lines changed

src/services/event/EventTrigger.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class EventTrigger
9393
}
9494

9595
void check_attribute(Caliper* c, Channel* chn, const Attribute& attr) {
96-
if (attr.skip_events())
96+
if (attr.id() < 12 /* skip fixed metadata attributes */ || attr.skip_events())
9797
return;
9898

9999
auto it = std::find(trigger_attr_names.begin(), trigger_attr_names.end(), attr.name());

src/services/trace/Trace.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ class Trace
353353
chn->events().finish_evt.connect(
354354
[instance](Caliper* c, Channel* chn){
355355
// sT.deactivate_chn(chn);
356+
instance->clear_cb(c, chn);
356357
instance->finish_cb(c, chn);
357358
delete instance;
358359
});

test/ci_app_tests/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@ set(CALIPER_CI_CXX_TEST_APPS
66
ci_test_aggregate
77
ci_test_basic
88
ci_test_binding
9-
ci_test_esc
109
ci_test_io
11-
ci_test_loop
1210
ci_test_macros
1311
ci_test_multichannel
1412
ci_test_nesting
1513
ci_test_postprocess_snapshot
1614
ci_test_report
1715
ci_test_thread)
1816
set(CALIPER_CI_C_TEST_APPS
19-
ci_dgemm_memtrack
2017
ci_test_alloc
2118
ci_test_alloc_hooks
2219
ci_test_c_ann

test/ci_app_tests/ci_dgemm_memtrack.c

-85
This file was deleted.

test/ci_app_tests/ci_test_basic.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
// --- Caliper continuous integration test app for C++ annotation class
22

3-
#include "caliper/Annotation.h"
4-
5-
#include "caliper/common/Variant.h"
3+
#include "caliper/cali.h"
64

75
int main()
86
{
97
std::map<const char*, cali::Variant> metadata = {
108
{ "meta.int", cali::Variant(42) }
119
};
1210

11+
// Test proper escaping
12+
cali_set_string_byname(" =\\weird \"\"attribute\"= ", " \\\\ weird,\" name\",");
13+
1314
cali::Annotation phase_ann("phase", metadata);
1415
std::size_t size = 8;
1516
cali::Annotation size_annot("dgs");

test/ci_app_tests/ci_test_esc.cpp

-8
This file was deleted.

test/ci_app_tests/ci_test_loop.cpp

-27
This file was deleted.

test/ci_app_tests/ci_test_macros.cpp

+10-5
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
// test C and C++ macros
1212

13-
void foo(int sleep_usec)
13+
void foo(int count, int sleep_usec)
1414
{
1515
CALI_CXX_MARK_FUNCTION;
1616

1717
CALI_MARK_BEGIN("pre-loop");
18-
CALI_WRAP_STATEMENT("foo.init", int count = 4);
18+
CALI_WRAP_STATEMENT("foo.init", count = std::max(1, count));
1919
CALI_MARK_END("pre-loop");
2020

2121
CALI_MARK_LOOP_BEGIN(fooloop, "fooloop");
@@ -40,7 +40,9 @@ int main(int argc, char* argv[])
4040
cali::ConfigManager mgr;
4141

4242
if (argc > 2)
43-
mgr.add(argv[2]);
43+
if (std::string(argv[2]) != "none")
44+
mgr.add(argv[2]);
45+
4446
if (mgr.error()) {
4547
std::cerr << mgr.error_msg() << std::endl;
4648
return -1;
@@ -50,14 +52,17 @@ int main(int argc, char* argv[])
5052

5153
CALI_MARK_FUNCTION_BEGIN;
5254

53-
const int count = 4;
55+
int count = 4;
56+
57+
if (argc > 3)
58+
count = std::max(1, std::stoi(argv[3]));
5459

5560
CALI_CXX_MARK_LOOP_BEGIN(mainloop, "mainloop");
5661

5762
for (int i = 0; i < count; ++i) {
5863
CALI_CXX_MARK_LOOP_ITERATION(mainloop, i);
5964

60-
foo(sleep_usec);
65+
foo(count, sleep_usec);
6166
}
6267

6368
CALI_CXX_MARK_LOOP_END(mainloop);

test/ci_app_tests/ci_test_tau_service.cpp

-30
This file was deleted.

test/ci_app_tests/test_basictrace.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ def test_usec_unit_selection(self):
122122
}))
123123

124124
def test_largetrace(self):
125-
target_cmd = [ './ci_test_loop', '80000' ]
125+
target_cmd = [ './ci_test_macros', '0', 'none', '400' ]
126126
query_cmd = [ '../../src/tools/cali-query/cali-query', '-e' ]
127127

128128
caliper_config = {
129129
'CALI_SERVICES_ENABLE' : 'event,trace,report',
130130
# 'CALI_EVENT_ENABLE_SNAPSHOT_INFO' : 'false',
131131
'CALI_REPORT_FILENAME' : 'stdout',
132-
'CALI_REPORT_CONFIG' : 'select function,count() group by function format cali',
132+
'CALI_REPORT_CONFIG' : 'select function,event.end#loop,count() group by function,event.end#loop format cali',
133133
'CALI_TRACE_BUFFER_SIZE' : '1',
134134
'CALI_LOG_VERBOSITY' : '0'
135135
}
@@ -138,7 +138,7 @@ def test_largetrace(self):
138138
snapshots = cat.get_snapshots_from_text(query_output)
139139

140140
self.assertTrue(cat.has_snapshot_with_attributes(
141-
snapshots, { 'function' : 'main/foo', 'count' : '80000'}))
141+
snapshots, { 'function' : 'main/foo', 'event.end#loop': 'fooloop', 'count' : '400' }))
142142

143143

144144
def test_globals(self):
@@ -160,8 +160,8 @@ def test_globals(self):
160160
snapshots, { 'cali.caliper.version' } ) )
161161

162162
def test_esc(self):
163-
target_cmd = [ './ci_test_esc' ]
164-
query_cmd = [ '../../src/tools/cali-query/cali-query', '-j' ]
163+
target_cmd = [ './ci_test_basic' ]
164+
query_cmd = [ '../../src/tools/cali-query/cali-query', '-j', '-s', 'cali.event.set' ]
165165

166166
caliper_config = {
167167
'CALI_CONFIG_PROFILE' : 'serial-trace',

test/ci_app_tests/test_json.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def test_hatchetcontroller(self):
134134

135135

136136
def test_esc(self):
137-
target_cmd = [ './ci_test_esc' ]
137+
target_cmd = [ './ci_test_basic' ]
138138
query_cmd = [ '../../src/tools/cali-query/cali-query',
139139
'-q', 'select *,count() format json-split' ]
140140

test/ci_app_tests/test_libpfm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_libpfm_counting(self):
3131
snapshots, { 'libpfm.counter.cycles', 'phase', 'iteration' }))
3232

3333
def test_libpfm_sampling(self):
34-
target_cmd = [ './ci_dgemm_memtrack' ]
34+
target_cmd = [ './ci_test_macros', '50', 'none', '100' ]
3535
query_cmd = [ '../../src/tools/cali-query/cali-query', '-e' ]
3636

3737
caliper_config = {

0 commit comments

Comments
 (0)