Skip to content

Commit e522f13

Browse files
committed
check both posix and stdio records
1 parent b11df5d commit e522f13

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

darshan-test/python_runtime_tests.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -282,20 +282,12 @@ def test_os_dup(tmpdir):
282282

283283
try:
284284
with darshan.DarshanReport(path_to_log, filter_patterns=[target_filename], filter_mode='include') as report:
285-
try:
286-
records = report.records[io_module].to_dict()
287-
if len(records) > 0:
288-
try:
289-
value = records[0]["counters"][key]
290-
print(f"key '{key}' has value of '{value}'")
291-
assert value == 528
292-
except KeyError:
293-
print(f"Error: record key '{key}' was not found.")
294-
else:
295-
print(f"I/O module '{io_module}' for file '{target_filename}' has no record")
296-
except KeyError:
297-
print(f"I/O module '{io_module}' not found")
298-
except KeyError:
299-
print(f"I/O module '{io_module}' not found")
285+
# numpy will write the header (128 bytes) out via posix...
286+
posix_records = report.records["POSIX"].to_dict()
287+
# but flush its payload (50 8 byte ints: 400 bytes) with stdio (flush at fclose)
288+
stdio_records = report.records["STDIO"].to_dict()
289+
posix_bytes = posix_records[0]["counters"]["POSIX_BYTES_WRITTEN"]
290+
stdio_bytes = stdio_records[0]["counters"]["STDIO_BYTES_WRITTEN"]
291+
assert posix_bytes + stdio_bytes == 528
300292
except RuntimeError:
301293
print(f"Error: The file '{path_to_log}' was not found.")

0 commit comments

Comments
 (0)