Skip to content
Snippets Groups Projects
Commit ee94e22a authored by Tobias Melson's avatar Tobias Melson
Browse files

Parse and check test output

parent 0849fe74
Branches
Tags
No related merge requests found
Pipeline #121524 failed
...@@ -7,6 +7,7 @@ before_script: ...@@ -7,6 +7,7 @@ before_script:
- module purge - module purge
- module load intel/21.3.0 - module load intel/21.3.0
- module load impi/2021.3 - module load impi/2021.3
- module load anaconda/3
build_lib: build_lib:
tags: tags:
...@@ -15,4 +16,4 @@ build_lib: ...@@ -15,4 +16,4 @@ build_lib:
- make clean - make clean
- make - make
- make test - make test
- mpiexec -n 1 ./test.x - mpiexec -n 1 ./test.x | ./check_test_output.py
#!/usr/bin/env python3
import sys
import re
def expect_non_mpi(line):
assert(line.startswith('RSS:'))
def expect_mpi(line):
assert(line.startswith('MPI rank: 0'))
def convert_int(mem):
return int(mem.rstrip('M'))
def extract_mem(line):
pattern = re.compile('[1-9][0-9]*M')
matches = re.findall(pattern, line)
assert(len(matches) == 2)
return convert_int(matches[0]), convert_int(matches[1])
def assert_approx(value1, value2):
assert(abs(value2 - value1) <= 1)
lines = sys.stdin.readlines()
expect_non_mpi(lines[0])
for line in lines[1:]:
expect_mpi(line)
rss0, hwm0 = extract_mem(lines[1])
assert(hwm0 == rss0)
rss1, hwm1 = extract_mem(lines[2])
assert(hwm1 == rss1)
assert_approx(rss1, rss0 + 100)
rss2, hwm2 = extract_mem(lines[3])
assert_approx(rss2, rss0)
assert(hwm2 == hwm1)
...@@ -10,7 +10,7 @@ program test ...@@ -10,7 +10,7 @@ program test
call frss_print_rank(0) call frss_print_rank(0)
allocate(array(10000000)) allocate(array(13107200)) ! 100M
array(:) = 0.d0 array(:) = 0.d0
call frss_print() call frss_print()
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment