1- #! /bin/sh
2-
3- # NOTE: binary diff is not a good idea as it dont reflect what people use to read reports
1+ #! /bin/sh
42
53OK=0
64FAILED=1
7- sonata_reports=@ENABLE_SONATA_REPORTS@
8- bin_reports=@ENABLE_BIN_REPORTS@
5+ sonata_reports=@ENABLE_SONATA_REPORTS_TESTS@
6+ bin_reports=@ENABLE_BIN_REPORTS_TESTS@
7+ test_ref=@CMAKE_CURRENT_BINARY_DIR@/@SIM_NAME@/test_ref.out
98
109if [ " $bin_reports " = " ON" ]
1110then
1211 if [ -f test_1.bbp ]
1312 then
14- # checking something with @reportinglib_BIN_DIR@/dump test_1.bbp
15- # for ascii files that will be using grep for instance.
16- nb_recorded=$( @reportinglib_somaDump@ test_1.bbp 1| wc -l)
17- # 101 because a white space
18- if [ $nb_recorded -eq 100 ]; then
19- exit $OK
20- else
21- echo " [ERROR] The number of steps recorded by ReportingLib doesn't match.
22- Found $nb_recorded , expected 100. Test failed!" >&2
23- exit $FAILED
24- fi
13+ somaDump_diff=$( @reportinglib_somaDump@ test_1.bbp 1 | sed ' s/ //g' | diff $test_ref -)
14+
15+ if [ $? -ne 0 ]
16+ then
17+ echo -e " [ERROR] The report output generated by Reportinglib differs!\n$somaDump_diff " >&2
18+ exit $FAILED
19+ fi
2520 else
2621 echo " [ERROR] Expected ReportingLib soma file 'test_1.bbp' is missing. Test failed!" >&2
2722 exit $FAILED
@@ -32,19 +27,18 @@ if [ "$sonata_reports" = "ON" ]
3227then
3328 if [ -f test_2.h5 ]
3429 then
35- # checking something with @reportinglib_BIN_DIR@/dump test_1.bbp
36- # for ascii files that will be using grep for instance.
37- nb_recorded_sonata=$( @H5DUMP_EXECUTABLE@ -d /report/data -y -O test_2.h5 | wc -l)
38- # 101 because a white space
39- if [ $nb_recorded_sonata -eq 101 ]; then
40- exit $OK
41- else
42- echo " [ERROR] The number of steps recorded by SONATA doesn't match.
43- Found $nb_recorded , expected 101. Test failed!" >&2
44- exit $FAILED
45- fi
30+ h5dump_diff=$( @H5DUMP_EXECUTABLE@ -d /report/All/data -y -O test_2.h5 | sed ' 1d;$d;s/,//g;s/ //g' | diff $test_ref -)
31+
32+ if [ $? -ne 0 ]
33+ then
34+ echo -e " [ERROR] The report output generated by Libsonata differs!\n$h5dump_diff " >&2
35+ exit $FAILED
36+ fi
4637 else
4738 echo " [ERROR] Expected SONATA soma file 'test_2.h5' doesn't exist. Test failed!" >&2
4839 exit $FAILED
4940 fi
5041fi
42+
43+ # If we reach this point, all tests were successful
44+ exit $OK
0 commit comments