Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit b74fb9f

Browse files
fouriauxpramodk
authored andcommitted
Reportinglib integration tests (#97)
* add integration test concerning reportinglib * regenerate dataset from vanilla nmodl special
1 parent 4662fd6 commit b74fb9f

File tree

17 files changed

+58
-7
lines changed

17 files changed

+58
-7
lines changed

CMake/packages/Findreportinglib.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@
5858

5959
# UNIX paths are standard, no need to write.
6060
find_path(reportinglib_INCLUDE_DIR reportinglib/Report.h)
61-
6261
find_library(reportinglib_LIBRARY reportinglib)
6362
get_filename_component(reportinglib_LIB_DIR ${reportinglib_LIBRARY} DIRECTORY)
63+
find_program (reportinglib_somaDump somaDump ${reportinglib_LIB_DIR}/../bin)
6464

6565
# Checks 'REQUIRED', 'QUIET' and versions.
6666
include(FindPackageHandleStandardArgs)
6767

6868
find_package_handle_standard_args(reportinglib
6969
FOUND_VAR reportinglib_FOUND
7070
REQUIRED_VARS reportinglib_INCLUDE_DIR reportinglib_LIBRARY reportinglib_LIB_DIR)
71-
71+
72+
# reporting_BIN_DIR is required only for running tests

coreneuron/nrniv/nrn_filehandler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ void FileHandler::open(const char* filename, bool reorder, std::ios::openmode mo
4141
reorder_bytes = reorder;
4242
close();
4343
F.open(filename, mode | std::ios::binary);
44+
if (! F.is_open()) fprintf (stderr, "cannot open file %s\n", filename);
4445
nrn_assert(F.is_open());
4546
current_mode = mode;
4647
char version[256];

coreneuron/utils/reports/report_configuration_parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ std::vector<ReportConfiguration> create_report_configurations(const char* conf_f
6969

7070
FILE* fp = fopen(conf_file, "r");
7171
if (!fp) {
72-
std::cerr << "Error while reading report configuration " << conf_file << std::endl;
72+
std::cerr << "Cannot open configuration file: " << conf_file << ", aborting execution" << std::endl;
7373
abort();
7474
}
7575

tests/integration/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,16 @@ endif()
117117
endfunction(exec_test)
118118

119119
endif()
120+
121+
if (ENABLE_REPORTINGLIB)
122+
foreach(TEST_NAME "1")
123+
set (SIM_NAME "reporting_${TEST_NAME}")
124+
set (CONFIG_ARG "${TEST_NAME}")
125+
configure_file(reportinglib/${TEST_NAME}.conf.in ${SIM_NAME}/${TEST_NAME}.conf @ONLY)
126+
configure_file(reportinglib/reporting_test.sh.in ${SIM_NAME}/reporting_test.sh @ONLY)
127+
configure_file(reportinglib/${TEST_NAME}.check.in ${SIM_NAME}/${TEST_NAME}.check @ONLY)
128+
add_test(NAME ${SIM_NAME}
129+
COMMAND "/bin/sh" ${CMAKE_CURRENT_BINARY_DIR}/${SIM_NAME}/reporting_test.sh
130+
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${SIM_NAME}")
131+
endforeach()
132+
endif()
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#! /bin/sh
2+
3+
#NOTE: binary diff is not a good idea as it dont reflect what people use to read reports
4+
5+
OK=0
6+
FAILED=1
7+
8+
if [ -f test_1.bbp ]
9+
then
10+
#checking something with @reportinglib_BIN_DIR@/dump test_1.bbp
11+
# for ascii files that will be using grep for instance.
12+
nb_recorded=$(@reportinglib_somaDump@ test_1.bbp 1| wc -l)
13+
if [ $nb_recorded -eq 100 ]; then
14+
exit $OK
15+
else
16+
exit $FAILED
17+
fi
18+
else
19+
exit $FAILED
20+
fi
21+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--outpath ./
2+
--datpath @CMAKE_CURRENT_SOURCE_DIR@/ring/
3+
--tstop 10.000000
4+
--dt 0.025000
5+
--forwardskip 0.000000
6+
--prcellgid -1
7+
--report-conf @CMAKE_CURRENT_SOURCE_DIR@/reportinglib/1.report
8+
--cell-permute 0
76 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/sh
2+
3+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:@CMAKE_BINARY_DIR@/lib:@reportinglib_LIB_DIR@
4+
export OMP_NUM_THREADS=1
5+
@SRUN_PREFIX@ @CMAKE_BINARY_DIR@/bin/coreneuron_exec --read-config @[email protected] -mpi
6+
chmod +x ./@[email protected]
7+

0 commit comments

Comments
 (0)