Skip to content

Commit b693cc4

Browse files
committed
fix failure with tests not producing tracing data
this occurs with enabled MPI
1 parent 90a8ffc commit b693cc4

File tree

1 file changed

+28
-20
lines changed

1 file changed

+28
-20
lines changed

generate_coverage.py

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -128,29 +128,37 @@ def run_test(path, name, is_example):
128128
logging.debug("capturing all tracing data ...")
129129
print('### capturing all tracing data ...', file=output_file, flush=True)
130130
sp.check_call('lcov --capture --directory . --output-file "%s.info.complete"' % name,
131-
shell=True, stdout=output_file, stderr=output_file)
131+
shell=True, stdout=output_file, stderr=output_file)
132132
print('### done.', file=output_file, flush=True)
133133

134134
logging.debug("removing unnecessary data ...")
135135
print('### removing unnecessary data ...', file=output_file, flush=True)
136-
sp.check_call('lcov --remove "%s.info.complete" "*%s/include/pfasst/easylogging++.h" '
137-
'--output-file %s.info.prelim'
138-
% (name, options.base_dir, name),
139-
shell=True, stdout=output_file, stderr=output_file)
136+
try:
137+
sp.check_call('lcov --remove "%s.info.complete" "%s/include/pfasst/easylogging++.h" --output-file %s.info.prelim'
138+
% (name, options.base_dir, name),
139+
shell=True, stdout=output_file, stderr=output_file)
140+
except sp.CalledProcessError as e:
141+
logging.warning(e)
140142
print('### done.', file=output_file, flush=True)
141143

142144
logging.debug("extracting interesting tracing data ...")
143145
print('### extracting interesting tracing data ...', file=output_file, flush=True)
144-
sp.check_call('lcov --extract "%s.info.prelim" "*%s/include/**/*" --output-file %s.info'
145-
% (name, options.base_dir, name),
146-
shell=True, stdout=output_file, stderr=output_file)
147-
options.tracefiles.append("%s/%s.info" % (os.path.abspath(path), name))
146+
try:
147+
sp.check_call('lcov --extract "%s.info.prelim" "*%s/include/**/*" --output-file %s.info'
148+
% (name, options.base_dir, name),
149+
shell=True, stdout=output_file, stderr=output_file)
150+
options.tracefiles.append("%s/%s.info" % (os.path.abspath(path), name))
151+
except sp.CalledProcessError as e:
152+
logging.warning(e)
148153
if is_example:
149154
logging.debug("this test belongs to an example, thus also covering examples code")
150-
sp.check_call('lcov --extract "%s.info.prelim" "*%s/examples/**/*" --output-file %s.info.example'
151-
% (name, options.base_dir, name),
152-
shell=True, stdout=output_file, stderr=output_file)
153-
options.tracefiles.append("%s/%s.info.example" % (os.path.abspath(path), name))
155+
try:
156+
sp.check_call('lcov --extract "%s.info.prelim" "*%s/examples/**/*" --output-file %s.info.example'
157+
% (name, options.base_dir, name),
158+
shell=True, stdout=output_file, stderr=output_file)
159+
options.tracefiles.append("%s/%s.info.example" % (os.path.abspath(path), name))
160+
except sp.CalledProcessError as e:
161+
logging.warning(e)
154162
print('### done.', file=output_file, flush=True)
155163

156164
os.chdir(options.base_dir)
@@ -166,12 +174,12 @@ def aggregate_tracefiles():
166174
print("### adding tracefile: %s" % (tracefile,), file=output_file, flush=True)
167175
if os.access(options.final_tracefile, os.W_OK):
168176
sp.check_call('lcov --add-tracefile "%s" --add-tracefile "%s" --output-file "%s"'
169-
% (options.final_tracefile, tracefile, options.final_tracefile),
170-
shell=True, stdout=output_file, stderr=output_file)
177+
% (options.final_tracefile, tracefile, options.final_tracefile),
178+
shell=True, stdout=output_file, stderr=output_file)
171179
else:
172180
sp.check_call('lcov --add-tracefile "%s" --output-file "%s"'
173-
% (tracefile, options.final_tracefile),
174-
shell=True, stdout=output_file, stderr=output_file)
181+
% (tracefile, options.final_tracefile),
182+
shell=True, stdout=output_file, stderr=output_file)
175183
print("### done.", file=output_file, flush=True)
176184
output_file.close()
177185

@@ -180,9 +188,9 @@ def generate_html():
180188
logging.info("generating HTML report ...")
181189
output_file = open('%s/generate_html.log' % (options.coverage_dir,), mode='a')
182190
sp.check_call('genhtml --output-directory %s --demangle-cpp --num-spaces 2 --sort '
183-
'--title "PFASST++ Test Coverage" --prefix "%s" --function-coverage --legend '
184-
'"%s"' % (options.coverage_dir, options.base_dir, options.final_tracefile),
185-
shell=True, stdout=output_file, stderr=output_file)
191+
'--title "PFASST++ Test Coverage" --prefix "%s" --function-coverage --legend "%s"'
192+
% (options.coverage_dir, options.base_dir, options.final_tracefile),
193+
shell=True, stdout=output_file, stderr=output_file)
186194
output_file.close()
187195
logging.info("coverage report can be found in: %s" % options.coverage_dir)
188196

0 commit comments

Comments
 (0)