Skip to content
Snippets Groups Projects
Commit d676676e authored by Jonathan Hanks's avatar Jonathan Hanks
Browse files

Adding tests for nds1 connection count limits to the ctest setup.

parent 8ee79d41
No related branches found
No related tags found
1 merge request!27Consumer limits
......@@ -145,6 +145,9 @@ install(TARGETS daqd_shmem DESTINATION bin)
add_executable(test_daqd_cmask_t tests/test_main.cc
tests/test_daqd_cmask_t.cc)
target_include_directories(test_daqd_cmask_t PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_daqd_cmask_t
COMMAND test_daqd_cmask_t
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
if (libNDS2Client_FOUND)
......@@ -167,6 +170,12 @@ if (libNDS2Client_FOUND)
target_link_libraries(test_nds1_connections PUBLIC nds2client::cxx
${CMAKE_THREAD_LIBS_INIT})
configure_file(tests/test_daqd_nds_connections.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_daqd_nds_connections.sh @ONLY)
add_test(NAME test_daqd_nds_connections
COMMAND /bin/bash ./test_daqd_nds_connections.sh
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif (libNDS2Client_FOUND)
endif(${DAQD_CAN_BUILD_DAQD_SHMEM})
#!/bin/bash
CWD="@CMAKE_CURRENT_BINARY_DIR@"
TDIR=""
PID_MULTI_STREAM=0
PID_DAQD=0
function kill_proc {
if [ $1 -gt 0 ]; then
echo "Closing process $1"
kill $1
fi
}
function cleanup {
rm -rf daqdrc_nds1_connection_test_final
if [ "x$TDIR" != "x" ]; then
if [ -d $TDIR ]; then
rm -rf "$TDIR"
fi
fi
kill_proc $PID_MULTI_STREAM
kill_proc $PID_DAQD
}
MUTLI_STREAM="$CWD/../fe_stream_test/fe_multi_stream_test"
if [ ! -x "$MUTLI_STREAM" ]; then
echo "cannot find $MULTI_STREAM"
exit 1
fi
DAQD="$CWD/../daqd/daqd_shmem"
if [ ! -x "$DAQD" ]; then
echo "cannot find $DAQD"
exit 1
fi
NDS1_CONNECTIONS_CHECK="$CWD/test_nds1_connections"
if [ ! -x "$NDS1_CONNECTIONS_CHECK" ]; then
echo "cannot find $NDS1_CONNECTIONS_CHECK"
exit 1
fi
if [ ! -w /dev/gpstime ]; then
echo "the gpstime module must be loaded, configured, and accessible by this user"
exit 1
fi
if [ ! -w /dev/mbuf ]; then
echo "the mbuf module must be loaded, configured, and accessible by this user"
exit 1
fi
PYTHON=""
which python > /dev/null
if [ $? -eq 0 ]; then
PYTHON=`which python`
else
which python3 > /dev/null
if [ $? -eq 0 ]; then
PYTHON=`which python3`
else
echo "Cannot find python or python3"
exit 1
fi
fi
trap cleanup EXIT
TDIR=`$PYTHON -c "from __future__ import print_function; import tempfile; print(tempfile.mkdtemp())"`
mkdir "$TDIR/ini_files"
mkdir "$TDIR/logs"
echo "Ini dir = $TDIR/ini_files"
"$MUTLI_STREAM" -i "$TDIR/ini_files" -M "$TDIR/ini_files/master" -b local_dc -m 100 -k 700 -R 100 > "$TDIR/logs/multi_stream" &
PID_MULTI_STREAM=$!
echo "Streamer PID = PID_MULTI_STREAM"
sleep 1
MASTER_FILE="$TDIR/ini_files/master"
TESTPOINT_FILE=""
cat daqdrc_live_test | sed s\|MASTER\|$MASTER_FILE\| | sed s\|TESTPOINT\|$TESTPOINT_FILE\| > daqdrc_nds1_connection_test_final
"$DAQD" -c daqdrc_nds1_connection_test_final &> "$TDIR/logs/daqd" &
PID_DAQD=$!
echo "Sleeping to allow the daq to start"
sleep 15
export NDSSERVER=localhost:8088
"$NDS1_CONNECTIONS_CHECK"
RESULT=$?
echo "Testing return $RESULT (0 = success)"
exit $RESULT
#echo "Press enter to continue..."
#DUMMY=""
#read DUMMY
\ No newline at end of file
......@@ -98,5 +98,9 @@ main( int argc, char* argv[] )
<< std::endl;
std::cout << "We had " << error.load( )
<< " unexpected errors in the threads." << std::endl;
return 0;
if ( error.load( ) == 0 )
{
return 0;
}
return 1;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment