diff --git a/CMakeLists.txt b/CMakeLists.txt index 8551897..793aed0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,3 @@ -# TODO: -# - check which MSVC are compatible -# - cpack -# - ctest - cmake_minimum_required(VERSION 3.1.0) project(direwolf) @@ -17,6 +12,7 @@ set(direwolf_VERSION_SUFFIX "") option(FORCE_SSE "Compile with SSE instruction only" OFF) option(FORCE_SSSE3 "Compile with SSSE3 instruction only" OFF) option(FORCE_SSE41 "Compile with SSE4.1 instruction only" OFF) +option(OPTIONAL_TEST "Compile optional test (might be broken)" OFF) # where cmake find custom modules list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) @@ -70,6 +66,7 @@ if(direwolf_VERSION_COMMIT) add_definitions("-DEXTRA_VERSION=${direwolf_VERSION_COMMIT}") endif() +set(CUSTOM_SRC_DIR "${CMAKE_SOURCE_DIR}/src") set(CUSTOM_EXTERNAL_DIR "${CMAKE_SOURCE_DIR}/external") set(CUSTOM_MISC_DIR "${CUSTOM_EXTERNAL_DIR}/misc") set(CUSTOM_REGEX_DIR "${CUSTOM_EXTERNAL_DIR}/regex") @@ -80,6 +77,9 @@ set(CUSTOM_TELEMETRY_DIR "${CUSTOM_SCRIPTS_DIR}/telemetry-toolkit") set(CUSTOM_CONF_DIR "${CMAKE_SOURCE_DIR}/conf") set(CUSTOM_DOC_DIR "${CMAKE_SOURCE_DIR}/doc") set(CUSTOM_MAN_DIR "${CMAKE_SOURCE_DIR}/man") +set(CUSTOM_TEST_DIR "${CMAKE_SOURCE_DIR}/test") +set(CUSTOM_TEST_SCRIPTS_DIR "${CUSTOM_TEST_DIR}/scripts") +set(CUSTOM_SHELL_SHABANG "#!/bin/sh -e") # if we don't set build_type if(NOT DEFINED CMAKE_BUILD_TYPE OR "${CMAKE_BUILD_TYPE}" STREQUAL "") @@ -124,6 +124,8 @@ elseif (WIN32) # compile with full multicore set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + + set(CUSTOM_SHELL_BIN "") endif() if (C_CLANG OR C_GCC) @@ -191,6 +193,15 @@ add_subdirectory(${CUSTOM_MISC_DIR}) # direwolf source code and utilities add_subdirectory(src) +# ctest +# Note CMake will generate tests only if the enable_testing() command +# has been invoked. The CTest module invokes the command automatically +# when the BUILD_TESTING option is ON. +include(CTest) +if(BUILD_TESTING) + add_subdirectory(test) +endif() + # manage scripts add_subdirectory(scripts) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 067b0c6..4210892 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,6 @@ # global includes # not ideal but not so slow +# otherwise use target_include_directories include_directories( ${GPSD_INCLUDE_DIRS} ${HAMLIB_INCLUDE_DIRS} @@ -11,8 +12,7 @@ include_directories( # build gen_fff to create fsk_fast_filter.h # optimization for slow processors -set(gen_fff_SOURCES - ${gen_fff_SOURCES} +list(APPEND gen_fff_SOURCES demod_afsk.c dsp.c textcolor.c @@ -32,9 +32,9 @@ add_custom_command(TARGET gen_fff WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) + # direwolf -set(direwolf_SOURCES - ${direwolf_SOURCES} +list(APPEND direwolf_SOURCES direwolf.c aprs_tt.c audio_stats.c @@ -97,29 +97,25 @@ set(direwolf_SOURCES ) if(LINUX) - set(direwolf_SOURCES - ${direwolf_SOURCES} + list(APPEND direwolf_SOURCES audio.c ) if(UDEV_FOUND) - set(direwolf_SOURCES - ${direwolf_SOURCES} + list(APPEND direwolf_SOURCES cm108.c ) endif() elseif(WIN32) # windows - set(direwolf_SOURCES - ${direwolf_SOURCES} - audio_win.c + list(APPEND direwolf_SOURCES + audio_win.c - # icon - ${CMAKE_SOURCE_DIR}/cmake/cpack/direwolf.rc - ) + # icon + ${CMAKE_SOURCE_DIR}/cmake/cpack/direwolf.rc + ) else() # macOS freebsd openbsd - set(direwolf_SOURCES - ${direwolf_SOURCES} - audio_portaudio.c - ) + list(APPEND direwolf_SOURCES + audio_portaudio.c + ) endif() add_executable(direwolf @@ -141,8 +137,7 @@ target_link_libraries(direwolf ) # decode_aprs -set(decode_aprs_SOURCES - ${decode_aprs_SOURCES} +list(APPEND decode_aprs_SOURCES decode_aprs.c kiss_frame.c ax25_pad.c @@ -178,8 +173,7 @@ target_link_libraries(decode_aprs # Convert between text and touch tone representation. # text2tt -set(text2tt_SOURCES - ${text2tt_SOURCES} +list(APPEND text2tt_SOURCES tt_text.c ) @@ -196,8 +190,7 @@ target_link_libraries(text2tt ) # tt2text -set(tt2text_SOURCES - ${tt2text_SOURCES} +list(APPEND tt2text_SOURCES tt_text.c ) @@ -216,8 +209,7 @@ target_link_libraries(tt2text # Convert between Latitude/Longitude and UTM coordinates. # ll2utm -set(ll2utm_SOURCES - ${ll2utm_SOURCES} +list(APPEND ll2utm_SOURCES ll2utm.c textcolor.c ) @@ -232,8 +224,7 @@ target_link_libraries(ll2utm ) # utm2ll -set(utm2ll_SOURCES - ${utm2ll_SOURCES} +list(APPEND utm2ll_SOURCES utm2ll.c textcolor.c ) @@ -250,8 +241,7 @@ target_link_libraries(utm2ll # Convert from log file to GPX. # log2gpx -set(log2gpx_SOURCES - ${log2gpx_SOURCES} +list(APPEND log2gpx_SOURCES log2gpx.c textcolor.c ) @@ -267,8 +257,7 @@ target_link_libraries(log2gpx # Test application to generate sound. # gen_packets -set(gen_packets_SOURCES - ${gen_packets_SOURCES} +list(APPEND gen_packets_SOURCES gen_packets.c ax25_pad.c hdlc_send.c @@ -291,8 +280,7 @@ target_link_libraries(gen_packets # Unit test for AFSK demodulator # atest -set(atest_SOURCES - ${atest_SOURCES} +list(APPEND atest_SOURCES atest.c demod.c demod_afsk.c @@ -333,8 +321,7 @@ target_link_libraries(atest # Multiple AGWPE network or serial port clients to test TNCs side by side. # aclients -set(aclients_SOURCES - ${aclients_SOURCES} +list(APPEND aclients_SOURCES aclients.c ax25_pad.c fcs_calc.c @@ -354,8 +341,7 @@ target_link_libraries(aclients # Talk to a KISS TNC. # Note: kiss_frame.c has conditional compilation on KISSUTIL. # kissutil -set(kissutil_SOURCES - ${kissutil_SOURCES} +list(APPEND kissutil_SOURCES kissutil.c kiss_frame.c ax25_pad.c @@ -383,8 +369,7 @@ target_link_libraries(kissutil # List USB audio adapters than can use GPIO for PTT. # cm108 if(UDEV_FOUND) - set(cm108_SOURCES - ${cm108_SOURCES} + list(APPEND cm108_SOURCES cm108.c textcolor.c ) @@ -406,8 +391,7 @@ endif() # Touch Tone to Speech sample application. # ttcalc -set(ttcalc_SOURCES - ${ttcalc_SOURCES} +list(APPEND ttcalc_SOURCES ttcalc.c ax25_pad.c fcs_calc.c @@ -438,18 +422,3 @@ install(TARGETS kissutil DESTINATION bin) if(UDEV_FOUND) install(TARGETS cm108 DESTINATION bin) endif() - - - -## TESTS -# Note CMake will generate tests only if the enable_testing() command -# has been invoked. The CTest module invokes the command automatically -# when the BUILD_TESTING option is ON. -include(CTest) -if(BUILD_TESTING) - # add_test(NAME COMMAND [...] - # [CONFIGURATIONS ...] -# [WORKING_DIRECTORY ]) - - -endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..63160c8 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,569 @@ +# this is a trick to avoid to more complication +# because configure_file() is done a configuration time +set(CUSTOM_TEST_BINARY_DIR "${CMAKE_BINARY_DIR}/test") +set(GEN_PACKETS_BIN "${CMAKE_BINARY_DIR}/src/gen_packets${CMAKE_EXECUTABLE_SUFFIX}") +set(ATEST_BIN "${CMAKE_BINARY_DIR}/src/atest${CMAKE_EXECUTABLE_SUFFIX}") + +if(WIN32) + set(CUSTOM_SCRIPT_SUFFIX ".bat") +else() + set(CUSTOM_SCRIPT_SUFFIX "") +endif() + +set(TEST_CHECK-MODEM1200_FILE "check-modem1200") +set(TEST_CHECK-MODEM300_FILE "check-modem300") +set(TEST_CHECK-MODEM9600_FILE "check-modem9600") +set(TEST_CHECK-MODEM19200_FILE "check-modem19200") +set(TEST_CHECK-MODEM2400-a_FILE "check-modem2400-a") +set(TEST_CHECK-MODEM2400-b_FILE "check-modem2400-b") +set(TEST_CHECK-MODEM2400-g_FILE "check-modem2400-g") +set(TEST_CHECK-MODEM4800_FILE "check-modem4800") + +# generate the scripts that run the tests +configure_file( + "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM1200_FILE}" + "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM1200_FILE}${CUSTOM_SCRIPT_SUFFIX}" + @ONLY + ) + +configure_file( + "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM300_FILE}" + "${CUSTOM_TEST_BINARY_DIR}${CUSTOM_SCRIPT_SUFFIX}" + @ONLY + ) + +configure_file( + "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM9600_FILE}" + "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM9600_FILE}${CUSTOM_SCRIPT_SUFFIX}" + @ONLY + ) + +configure_file( + "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM19200_FILE}" + "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM19200_FILE}${CUSTOM_SCRIPT_SUFFIX}" + @ONLY + ) + +configure_file( + "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM2400-a_FILE}" + "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM2400-a_FILE}${CUSTOM_SCRIPT_SUFFIX}" + @ONLY + ) + +configure_file( + "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM2400-b_FILE}" + "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM2400-b_FILE}${CUSTOM_SCRIPT_SUFFIX}" + @ONLY + ) + +configure_file( + "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM2400-g_FILE}" + "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM2400-g_FILE}${CUSTOM_SCRIPT_SUFFIX}" + @ONLY + ) + +configure_file( + "${CUSTOM_TEST_SCRIPTS_DIR}/${TEST_CHECK-MODEM4800_FILE}" + "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM4800_FILE}${CUSTOM_SCRIPT_SUFFIX}" + @ONLY + ) + + +# global includes +# not ideal but not so slow +# otherwise use target_include_directories +include_directories( + ${CUSTOM_SRC_DIR} + ${GPSD_INCLUDE_DIRS} + ${HAMLIB_INCLUDE_DIRS} + ${ALSA_INCLUDE_DIRS} + ${UDEV_INCLUDE_DIRS} + ${PORTAUDIO_INCLUDE_DIRS} + ${CUSTOM_GEOTRANZ_DIR} + ${CMAKE_BINARY_DIR}/src + ) + + +# Unit test for demodulators +list(APPEND atest9_SOURCES + ${CUSTOM_SRC_DIR}/atest.c + ${CUSTOM_SRC_DIR}/demod.c + ${CUSTOM_SRC_DIR}/dsp.c + ${CUSTOM_SRC_DIR}/demod_afsk.c + ${CUSTOM_SRC_DIR}/demod_psk.c + ${CUSTOM_SRC_DIR}/demod_9600.c + ${CUSTOM_SRC_DIR}/hdlc_rec.c + ${CUSTOM_SRC_DIR}/hdlc_rec2.c + ${CUSTOM_SRC_DIR}/multi_modem.c + ${CUSTOM_SRC_DIR}/rrbb.c + ${CUSTOM_SRC_DIR}/fcs_calc.c + ${CUSTOM_SRC_DIR}/ax25_pad.c + ${CUSTOM_SRC_DIR}/decode_aprs.c + ${CUSTOM_SRC_DIR}/dwgpsnmea.c + ${CUSTOM_SRC_DIR}/dwgps.c + ${CUSTOM_SRC_DIR}/dwgpsd.c + ${CUSTOM_SRC_DIR}/serial_port.c + ${CUSTOM_SRC_DIR}/latlong.c + ${CUSTOM_SRC_DIR}/symbols.c + ${CUSTOM_SRC_DIR}/textcolor.c + ${CUSTOM_SRC_DIR}/telemetry.c + ${CUSTOM_SRC_DIR}/dtime_now.c + ${CUSTOM_SRC_DIR}/tt_text.c + ) + +add_executable(atest9 + ${atest9_SOURCES} + ) + +add_dependencies(atest9 gen_fff) + +target_link_libraries(atest9 + ${MISC_LIBRARIES} + ${GPSD_LIBRARIES} + Threads::Threads + ) + + +# Unit test for inner digipeater algorithm +list(APPEND dtest_SOURCES + ${CUSTOM_SRC_DIR}/digipeater.c + ${CUSTOM_SRC_DIR}/dedupe.c + ${CUSTOM_SRC_DIR}/pfilter.c + ${CUSTOM_SRC_DIR}/ax25_pad.c + ${CUSTOM_SRC_DIR}/fcs_calc.c + ${CUSTOM_SRC_DIR}/tq.c + ${CUSTOM_SRC_DIR}/textcolor.c + ${CUSTOM_SRC_DIR}/decode_aprs.c + ${CUSTOM_SRC_DIR}/dwgpsnmea.c + ${CUSTOM_SRC_DIR}/dwgps.c + ${CUSTOM_SRC_DIR}/dwgpsd.c + ${CUSTOM_SRC_DIR}/serial_port.c + ${CUSTOM_SRC_DIR}/latlong.c + ${CUSTOM_SRC_DIR}/telemetry.c + ${CUSTOM_SRC_DIR}/symbols.c + ${CUSTOM_SRC_DIR}/tt_text.c + ) + +add_executable(dtest + ${dtest_SOURCES} + ) + +set_target_properties(dtest + PROPERTIES COMPILE_FLAGS "-DDIGITEST" + ) + +target_link_libraries(dtest + ${MISC_LIBRARIES} + ${REGEX_LIBRARIES} + ${GPSD_LIBRARIES} + Threads::Threads + ) + + +# Unit test for APRStt tone seqence parsing. +list(APPEND ttest_SOURCES + ${CUSTOM_SRC_DIR}/aprs_tt.c + ${CUSTOM_SRC_DIR}/tt_text.c + ${CUSTOM_SRC_DIR}/latlong.c + ${CUSTOM_SRC_DIR}/textcolor.c + ) + +add_executable(ttest + ${ttest_SOURCES} + ) + +set_target_properties(ttest + PROPERTIES COMPILE_FLAGS "-DTT_MAIN" + ) + +target_link_libraries(ttest + ${MISC_LIBRARIES} + ${GEOTRANZ_LIBRARIES} + ) + + +# Unit test for APRStt tone sequence / text conversions. +list(APPEND tttexttest_SOURCES + ${CUSTOM_SRC_DIR}/tt_text.c + ${CUSTOM_SRC_DIR}/textcolor.c + ) + +add_executable(tttexttest + ${tttexttest_SOURCES} + ) + +set_target_properties(tttexttest + PROPERTIES COMPILE_FLAGS "-DTTT_TEST" + ) + +target_link_libraries(tttexttest + ${MISC_LIBRARIES} + ) + + +# Unit test for Packet Filtering. +list(APPEND pftest_SOURCES + ${CUSTOM_SRC_DIR}/pfilter.c + ${CUSTOM_SRC_DIR}/ax25_pad.c + ${CUSTOM_SRC_DIR}/textcolor.c + ${CUSTOM_SRC_DIR}/fcs_calc.c + ${CUSTOM_SRC_DIR}/decode_aprs.c + ${CUSTOM_SRC_DIR}/dwgpsnmea.c + ${CUSTOM_SRC_DIR}/dwgps.c + ${CUSTOM_SRC_DIR}/dwgpsd.c + ${CUSTOM_SRC_DIR}/serial_port.c + ${CUSTOM_SRC_DIR}/latlong.c + ${CUSTOM_SRC_DIR}/symbols.c + ${CUSTOM_SRC_DIR}/telemetry.c + ${CUSTOM_SRC_DIR}/tt_text.c + ) + +add_executable(pftest + ${pftest_SOURCES} + ) + +set_target_properties(pftest + PROPERTIES COMPILE_FLAGS "-DPFTEST" + ) + +target_link_libraries(pftest + ${MISC_LIBRARIES} + ${REGEX_LIBRARIES} + ${GPSD_LIBRARIES} + Threads::Threads + ) + + +# Unit test for telemetry decoding. +list(APPEND tlmtest_SOURCES + ${CUSTOM_SRC_DIR}/telemetry.c + ${CUSTOM_SRC_DIR}/ax25_pad.c + ${CUSTOM_SRC_DIR}/fcs_calc.c + ${CUSTOM_SRC_DIR}/textcolor.c + ) + +add_executable(tlmtest + ${tlmtest_SOURCES} + ) + +set_target_properties(tlmtest + PROPERTIES COMPILE_FLAGS "-DTEST" + ) + +target_link_libraries(tlmtest + ${MISC_LIBRARIES} + ${REGEX_LIBRARIES} + ) + + +# Unit test for location coordinate conversion. +list(APPEND lltest_SOURCES + ${CUSTOM_SRC_DIR}/latlong.c + ${CUSTOM_SRC_DIR}/textcolor.c + ) + +add_executable(lltest + ${lltest_SOURCES} + ) + +set_target_properties(lltest + PROPERTIES COMPILE_FLAGS "-DLLTEST" + ) + +target_link_libraries(lltest + ${MISC_LIBRARIES} + ) + + +# Unit test for encoding position & object report. +list(APPEND enctest_SOURCES + ${CUSTOM_SRC_DIR}/encode_aprs.c + ${CUSTOM_SRC_DIR}/latlong.c + ${CUSTOM_SRC_DIR}/textcolor.c + ) + +add_executable(enctest + ${enctest_SOURCES} + ) + +set_target_properties(enctest + PROPERTIES COMPILE_FLAGS "-DEN_MAIN" + ) + +target_link_libraries(enctest + ${MISC_LIBRARIES} + ) + + +# Unit test for KISS encapsulation. +list(APPEND kisstest_SOURCES + ${CUSTOM_SRC_DIR}/kiss_frame.c + ) + +add_executable(kisstest + ${kisstest_SOURCES} + ) + +set_target_properties(kisstest + PROPERTIES COMPILE_FLAGS "-DKISSTEST" + ) + + +# Unit test for constructing frames besides UI. +list(APPEND pad2test_SOURCES + ${CUSTOM_SRC_DIR}/ax25_pad2.c + ${CUSTOM_SRC_DIR}/ax25_pad.c + ${CUSTOM_SRC_DIR}/fcs_calc.c + ${CUSTOM_SRC_DIR}/textcolor.c + ) + +add_executable(pad2test + ${pad2test_SOURCES} + ) + +set_target_properties(pad2test + PROPERTIES COMPILE_FLAGS "-DPAD2TEST" + ) + +target_link_libraries(pad2test + ${MISC_LIBRARIES} + ${REGEX_LIBRARIES} + ) + + +# Unit Test for XID frame encode/decode. +list(APPEND xidtest_SOURCES + ${CUSTOM_SRC_DIR}/xid.c + ${CUSTOM_SRC_DIR}/textcolor.c + ) + +add_executable(xidtest + ${xidtest_SOURCES} + ) + +set_target_properties(xidtest + PROPERTIES COMPILE_FLAGS "-DXIDTEST" + ) + +target_link_libraries(xidtest + ${MISC_LIBRARIES} + ) + + +# Unit Test for DTMF encode/decode. +list(APPEND dtmftest_SOURCES + ${CUSTOM_SRC_DIR}/dtmf.c + ${CUSTOM_SRC_DIR}/textcolor.c + ) + +add_executable(dtmftest + ${dtmftest_SOURCES} + ) + +set_target_properties(dtmftest + PROPERTIES COMPILE_FLAGS "-DDTMF_TEST" + ) + + +# doing ctest on previous programs +add_test(dtest dtest) +add_test(ttest ttest) +add_test(tttexttest tttexttest) +add_test(pftest pftest) +add_test(tlmtest tlmtest) +add_test(lltest lltest) +add_test(enctest enctest) +add_test(kisstest kisstest) +add_test(pad2test pad2test) +add_test(xidtest xidtest) +add_test(dtmftest dtmftest) + +add_test(check-modem1200 "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM1200_FILE}${CUSTOM_SCRIPT_SUFFIX}") +add_test(check-modem300 "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM300_FILE}${CUSTOM_SCRIPT_SUFFIX}") +add_test(check-modem9600 "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM9600_FILE}${CUSTOM_SCRIPT_SUFFIX}") +add_test(check-modem19200 "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM19200_FILE}${CUSTOM_SCRIPT_SUFFIX}") +add_test(check-modem2400-a "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM2400-a_FILE}${CUSTOM_SCRIPT_SUFFIX}") +add_test(check-modem2400-b "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM2400-b_FILE}${CUSTOM_SCRIPT_SUFFIX}") +add_test(check-modem2400-g "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM2400-g_FILE}${CUSTOM_SCRIPT_SUFFIX}") +add_test(check-modem4800 "${CUSTOM_TEST_BINARY_DIR}/${TEST_CHECK-MODEM4800_FILE}${CUSTOM_SCRIPT_SUFFIX}") + +# TODO miss the audio file +# ./atest9 -B 9600 ../walkabout9600.wav | grep "packets decoded in" >atest.out + + +# ----------------------------- Manual tests and experiments --------------------------- +if(OPTIONAL_TEST) + + # Unit test for IGate + list(APPEND itest_SOURCES + ${CUSTOM_SRC_DIR}/igate.c + ${CUSTOM_SRC_DIR}/ax25_pad.c + ${CUSTOM_SRC_DIR}/fcs_calc.c + ${CUSTOM_SRC_DIR}/mheard.c + ${CUSTOM_SRC_DIR}/pfilter.c + ${CUSTOM_SRC_DIR}/telemetry.c + ${CUSTOM_SRC_DIR}/decode_aprs.c + ${CUSTOM_SRC_DIR}/dwgpsnmea.c + ${CUSTOM_SRC_DIR}/dwgps.c + ${CUSTOM_SRC_DIR}/dwgpsd.c + ${CUSTOM_SRC_DIR}/serial_port.c + ${CUSTOM_SRC_DIR}/textcolor.c + ${CUSTOM_SRC_DIR}/dtime_now.c + ${CUSTOM_SRC_DIR}/latlong.c + ${CUSTOM_SRC_DIR}/tt_text.c + ${CUSTOM_SRC_DIR}/symbols.c + ) + + add_executable(itest + ${itest_SOURCES} + ) + + set_target_properties(itest + PROPERTIES COMPILE_FLAGS "-DITEST" + ) + + target_link_libraries(itest + ${MISC_LIBRARIES} + ${GPSD_LIBRARIES} + Threads::Threads + ) + + + # For demodulator tweaking experiments. + list(APPEND testagc_SOURCES + ${CUSTOM_SRC_DIR}/atest.c + ${CUSTOM_SRC_DIR}/demod.c + ${CUSTOM_SRC_DIR}/dsp.c + ${CUSTOM_SRC_DIR}/demod_afsk.c + ${CUSTOM_SRC_DIR}/demod_psk.c + ${CUSTOM_SRC_DIR}/demod_9600.c + ${CUSTOM_SRC_DIR}/hdlc_rec.c + ${CUSTOM_SRC_DIR}/hdlc_rec2.c + ${CUSTOM_SRC_DIR}/multi_modem.c + ${CUSTOM_SRC_DIR}/rrbb.c + ${CUSTOM_SRC_DIR}/fcs_calc.c + ${CUSTOM_SRC_DIR}/ax25_pad.c + ${CUSTOM_SRC_DIR}/decode_aprs.c + ${CUSTOM_SRC_DIR}/dwgpsnmea.c + ${CUSTOM_SRC_DIR}/dwgps.c + ${CUSTOM_SRC_DIR}/dwgpsd.c + ${CUSTOM_SRC_DIR}/serial_port.c + ${CUSTOM_SRC_DIR}/telemetry.c + ${CUSTOM_SRC_DIR}/dtime_now.c + ${CUSTOM_SRC_DIR}/latlong.c + ${CUSTOM_SRC_DIR}/tt_text.c + ${CUSTOM_SRC_DIR}/symbols.c + ${CUSTOM_SRC_DIR}/textcolor.c + ) + + add_executable(testagc + ${testagc_SOURCES} + ) + + add_dependencies(testagc gen_fff) + + target_link_libraries(testagc + ${MISC_LIBRARIES} + ${GPSD_LIBRARIES} + Threads::Threads + ) + + + # Send GPS location to KISS TNC each second. + list(APPEND walk96_SOURCES + ${CUSTOM_SRC_DIR}/walk96.c + ${CUSTOM_SRC_DIR}/dwgps.c + ${CUSTOM_SRC_DIR}/dwgpsnmea.c + ${CUSTOM_SRC_DIR}/dwgpsd.c + ${CUSTOM_SRC_DIR}/kiss_frame.c + ${CUSTOM_SRC_DIR}/latlong.c + ${CUSTOM_SRC_DIR}/encode_aprs.c + ${CUSTOM_SRC_DIR}/serial_port.c + ${CUSTOM_SRC_DIR}/textcolor.c + ${CUSTOM_SRC_DIR}/ax25_pad.c + ${CUSTOM_SRC_DIR}/fcs_calc.c + ${CUSTOM_SRC_DIR}/xmit.c + ${CUSTOM_SRC_DIR}/xid.c + ${CUSTOM_SRC_DIR}/hdlc_send.c + ${CUSTOM_SRC_DIR}/gen_tone.c + ${CUSTOM_SRC_DIR}/ptt.c + ${CUSTOM_SRC_DIR}/tq.c + ${CUSTOM_SRC_DIR}/hdlc_rec.c + ${CUSTOM_SRC_DIR}/hdlc_rec2.c + ${CUSTOM_SRC_DIR}/rrbb.c + ${CUSTOM_SRC_DIR}/dsp.c + ${CUSTOM_SRC_DIR}/multi_modem.c + ${CUSTOM_SRC_DIR}/demod.c + ${CUSTOM_SRC_DIR}/demod_afsk.c + ${CUSTOM_SRC_DIR}/demod_psk.c + ${CUSTOM_SRC_DIR}/demod_9600.c + ${CUSTOM_SRC_DIR}/rdq.c + ${CUSTOM_SRC_DIR}/server.c + ${CUSTOM_SRC_DIR}/morse.c + ${CUSTOM_SRC_DIR}/dtmf.c + ${CUSTOM_SRC_DIR}/audio_stats.c + ${CUSTOM_SRC_DIR}/dtime_now.c + ${CUSTOM_SRC_DIR}/dlq.c + ) + + if(LINUX) + list(APPEND walk96_SOURCES + ${CUSTOM_SRC_DIR}/audio.c + ) + if(UDEV_FOUND) + list(APPEND walk96_SOURCES + ${CUSTOM_SRC_DIR}/cm108.c + ) + endif() + elseif(WIN32) # windows + list(APPEND walk96_SOURCES + ${CUSTOM_SRC_DIR}/audio_win.c + ) + else() # macOS freebsd openbsd + list(APPEND walk96_SOURCES + ${CUSTOM_SRC_DIR}/audio_portaudio.c + ) + endif() + + add_executable(walk96 + ${walk96_SOURCES} + ) + + set_target_properties(walk96 + PROPERTIES COMPILE_FLAGS "-DWALK96" + ) + + target_link_libraries(walk96 + ${MISC_LIBRARIES} + ${REGEX_LIBRARIES} + ${GPSD_LIBRARIES} + ${HAMLIB_LIBRARIES} + ${ALSA_LIBRARIES} + ${PORTAUDIO_LIBRARIES} + ${UDEV_LIBRARIES} + Threads::Threads + ) + + + # TODO miss the audio file + + # testagc + # ./atest -P H+ -F 0 ../01_Track_1.wav ../02_Track_2.wav | grep "packets decoded in" >atest.out + + # testagc3 + # ./gen_packets -B 300 -n 100 -o noisy3.wav + # ./atest3 -B 300 -P D -D 3 noisy3.wav | grep "packets decoded in" >atest.out + + # testagc96 + # ./gen_packets -B 9600 -n 100 -o noisy96.wav + # ./atest96 -B 9600 ../walkabout9600c.wav noisy96.wav zzz16.wav zzz16.wav zzz16.wav zzz8.wav zzz8.wav zzz8.wav | grep "packets decoded in" >atest.out + + # testagc24 + # ./atest24 -B 2400 test2400.wav | grep "packets decoded in" >atest.out + + # testagc24mfj + # ./atest24mfj -F 1 -B 2400 ../ref-doc/MFJ-2400-PSK/2k4_short.wav + + # testagc48 + # ./atest48 -B 4800 test4800.wav | grep "packets decoded in" >atest.out +endif() # OPTIONAL_TEST diff --git a/test/scripts/check-modem1200 b/test/scripts/check-modem1200 new file mode 100755 index 0000000..2b97587 --- /dev/null +++ b/test/scripts/check-modem1200 @@ -0,0 +1,5 @@ +@CUSTOM_SHELL_SHABANG@ + +@GEN_PACKETS_BIN@ -n 100 -o test12.wav +@ATEST_BIN@ -F0 -PE -L64 -G72 test12.wav +@ATEST_BIN@ -F1 -PE -L70 -G75 test12.wav diff --git a/test/scripts/check-modem19200 b/test/scripts/check-modem19200 new file mode 100755 index 0000000..8d08a8e --- /dev/null +++ b/test/scripts/check-modem19200 @@ -0,0 +1,7 @@ +@CUSTOM_SHELL_SHABANG@ + +@GEN_PACKETS_BIN@ -r 96000 -B19200 -a 170 -o test19.wav +@ATEST_BIN@ -B19200 -F0 -L4 test19.wav +@GEN_PACKETS_BIN@ -r 96000 -B19200 -n 100 -o test19.wav +@ATEST_BIN@ -B19200 -F0 -L60 -G64 test19.wav +@ATEST_BIN@ -B19200 -F1 -L64 -G68 test19.wav diff --git a/test/scripts/check-modem2400-a b/test/scripts/check-modem2400-a new file mode 100755 index 0000000..1faa7d1 --- /dev/null +++ b/test/scripts/check-modem2400-a @@ -0,0 +1,5 @@ +@CUSTOM_SHELL_SHABANG@ + +@GEN_PACKETS_BIN@ -B2400 -j -n 100 -o test24-a.wav +@ATEST_BIN@ -B2400 -j -F0 -L76 -G80 test24-a.wav +@ATEST_BIN@ -B2400 -j -F1 -L84 -G88 test24-a.wav diff --git a/test/scripts/check-modem2400-b b/test/scripts/check-modem2400-b new file mode 100755 index 0000000..01479b7 --- /dev/null +++ b/test/scripts/check-modem2400-b @@ -0,0 +1,5 @@ +@CUSTOM_SHELL_SHABANG@ + +@GEN_PACKETS_BIN@ -B2400 -J -n 100 -o test24-b.wav +@ATEST_BIN@ -B2400 -J -F0 -L79 -G83 test24-b.wav +@ATEST_BIN@ -B2400 -J -F1 -L87 -G91 test24-b.wav diff --git a/test/scripts/check-modem2400-g b/test/scripts/check-modem2400-g new file mode 100755 index 0000000..b505370 --- /dev/null +++ b/test/scripts/check-modem2400-g @@ -0,0 +1,4 @@ +@CUSTOM_SHELL_SHABANG@ + +@GEN_PACKETS_BIN@ -B2400 -g -n 100 -o test24-g.wav +@ATEST_BIN@ -B2400 -g -F0 -L99 -G100 test24-g.wav diff --git a/test/scripts/check-modem300 b/test/scripts/check-modem300 new file mode 100755 index 0000000..da37dd2 --- /dev/null +++ b/test/scripts/check-modem300 @@ -0,0 +1,5 @@ +@CUSTOM_SHELL_SHABANG@ + +@GEN_PACKETS_BIN@ -B300 -n 100 -o test3.wav +@ATEST_BIN@ -B300 -F0 -L68 -G69 test3.wav +@ATEST_BIN@ -B300 -F1 -L71 -G75 test3.wav diff --git a/test/scripts/check-modem4800 b/test/scripts/check-modem4800 new file mode 100755 index 0000000..2ad033d --- /dev/null +++ b/test/scripts/check-modem4800 @@ -0,0 +1,5 @@ +@CUSTOM_SHELL_SHABANG@ + +@GEN_PACKETS_BIN@ -B4800 -n 100 -o test48.wav +@ATEST_BIN@ -B4800 -F0 -L70 -G74 test48.wav +@ATEST_BIN@ -B4800 -F1 -L79 -G84 test48.wav diff --git a/test/scripts/check-modem9600 b/test/scripts/check-modem9600 new file mode 100755 index 0000000..fa5f658 --- /dev/null +++ b/test/scripts/check-modem9600 @@ -0,0 +1,7 @@ +@CUSTOM_SHELL_SHABANG@ + +@GEN_PACKETS_BIN@ -B9600 -a 170 -o test96.wav +@ATEST_BIN@ -B9600 -F0 -L4 -G4 test96.wav +@GEN_PACKETS_BIN@ -B9600 -n 100 -o test96.wav +@ATEST_BIN@ -B9600 -F0 -L61 -G65 test96.wav +@ATEST_BIN@ -B9600 -F1 -L62 -G66 test96.wav