Skip to content

Commit 31cc2eb

Browse files
committed
check if Darshan log file exists
1 parent 8bd80c4 commit 31cc2eb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

darshan-test/python_runtime_tests.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,19 @@ def test_os_dup(tmpdir):
274274
io_module = "POSIX"
275275
key = "POSIX_BYTES_WRITTEN"
276276

277+
# check if log file exists
278+
if not os.path.isfile(path_to_log) :
279+
print(f"Darshan log file '{path_to_log}' does not exist")
280+
else :
281+
print(f"Darshan log file '{path_to_log}'")
282+
277283
try:
278284
with darshan.DarshanReport(path_to_log, filter_patterns=[target_filename], filter_mode='include') as report:
279285
try:
280286
records = report.records[io_module].to_dict()
281287
if len(records) > 0:
282-
rec = report.records[io_module].to_dict()
283288
try:
284-
value = rec[0]["counters"][key]
289+
value = records[0]["counters"][key]
285290
print(f"key '{key}' has value of '{value}'")
286291
assert value == 928
287292
except KeyError:

0 commit comments

Comments
 (0)