2021-12-11 21:39:31 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
project (FreeDATA)
|
|
|
|
include(CTest)
|
|
|
|
enable_testing()
|
|
|
|
|
|
|
|
# Find codec2
|
|
|
|
if(CODEC2_BUILD_DIR)
|
|
|
|
find_package(codec2 REQUIRED
|
|
|
|
PATHS ${CODEC2_BUILD_DIR}
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
CONFIGS codec2.cmake
|
|
|
|
)
|
|
|
|
if(codec2_FOUND)
|
|
|
|
message(STATUS "Codec2 library found in build tree.")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
find_package(codec2 REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
2021-12-12 12:54:23 +00:00
|
|
|
# test variables
|
|
|
|
set(FRAMESPERBURST 3)
|
|
|
|
set(BURSTS 1)
|
|
|
|
set(TESTFRAMES 3)
|
|
|
|
|
2021-12-15 21:20:24 +00:00
|
|
|
add_test(NAME 000_resampler
|
|
|
|
COMMAND sh -c "export LD_LIBRARY_PATH=${CODEC2_BUILD_DIR}/src;
|
|
|
|
cd ${CMAKE_CURRENT_SOURCE_DIR}/test/000_resampler;
|
|
|
|
python3 t48_8_short.py")
|
|
|
|
set_tests_properties(000_resampler PROPERTIES PASS_REGULAR_EXPRESSION "PASS")
|
|
|
|
|
2021-12-13 20:11:09 +00:00
|
|
|
add_test(NAME 001_highsnr_stdio_P_C_SM
|
2021-12-11 22:05:06 +00:00
|
|
|
COMMAND sh -c "export LD_LIBRARY_PATH=${CODEC2_BUILD_DIR}/src;
|
2021-12-11 22:50:53 +00:00
|
|
|
PATH=$PATH:${CODEC2_BUILD_DIR}/src;
|
2021-12-11 22:05:06 +00:00
|
|
|
cd ${CMAKE_CURRENT_SOURCE_DIR}/test/001_highsnr_stdio_audio;
|
2021-12-12 21:39:03 +00:00
|
|
|
python3 test_tx.py --mode datac0 --delay 500 --framesperburst ${FRAMESPERBURST} --bursts ${BURSTS} |
|
2021-12-16 03:24:59 +00:00
|
|
|
sox -t .s16 -r 48000 -c 1 - -t .s16 -r 8000 -c 1 - |
|
2021-12-12 12:54:23 +00:00
|
|
|
freedv_data_raw_rx datac0 - - --framesperburst ${FRAMESPERBURST} | hexdump -C")
|
2021-12-13 20:11:09 +00:00
|
|
|
set_tests_properties(001_highsnr_stdio_P_C_SM PROPERTIES PASS_REGULAR_EXPRESSION "HELLO WORLD")
|
2021-12-11 21:39:31 +00:00
|
|
|
|
2021-12-13 20:11:09 +00:00
|
|
|
add_test(NAME 001_highsnr_stdio_C_P_SM
|
2021-12-12 12:54:23 +00:00
|
|
|
COMMAND sh -c "export LD_LIBRARY_PATH=${CODEC2_BUILD_DIR}/src;
|
|
|
|
PATH=$PATH:${CODEC2_BUILD_DIR}/src;
|
|
|
|
cd ${CMAKE_CURRENT_SOURCE_DIR}/test/001_highsnr_stdio_audio;
|
2021-12-12 21:39:03 +00:00
|
|
|
freedv_data_raw_tx datac0 --testframes ${TESTFRAMES} --bursts ${BURSTS} --framesperburst ${FRAMESPERBURST} /dev/zero - |
|
2021-12-16 03:24:59 +00:00
|
|
|
sox -t .s16 -r 8000 -c 1 - -t .s16 -r 48000 -c 1 - |
|
2021-12-13 18:00:38 +00:00
|
|
|
python3 test_rx.py --mode datac0 --framesperburst ${FRAMESPERBURST} --bursts ${BURSTS}")
|
2021-12-13 20:11:09 +00:00
|
|
|
set_tests_properties(001_highsnr_stdio_C_P_SM PROPERTIES PASS_REGULAR_EXPRESSION "RECEIVED BURSTS: ${BURSTS} RECEIVED FRAMES: ${FRAMESPERBURST}")
|
2021-12-12 12:54:23 +00:00
|
|
|
|
2021-12-13 20:11:09 +00:00
|
|
|
add_test(NAME 001_highsnr_stdio_P_P_SM
|
2021-12-12 12:54:23 +00:00
|
|
|
COMMAND sh -c "export LD_LIBRARY_PATH=${CODEC2_BUILD_DIR}/src;
|
|
|
|
PATH=$PATH:${CODEC2_BUILD_DIR}/src;
|
|
|
|
cd ${CMAKE_CURRENT_SOURCE_DIR}/test/001_highsnr_stdio_audio;
|
2021-12-12 21:39:03 +00:00
|
|
|
python3 test_tx.py --mode datac0 --delay 500 --framesperburst ${FRAMESPERBURST} --bursts ${BURSTS} |
|
2021-12-13 18:00:38 +00:00
|
|
|
python3 test_rx.py --mode datac0 --framesperburst ${FRAMESPERBURST} --bursts ${BURSTS}")
|
2021-12-13 20:11:09 +00:00
|
|
|
set_tests_properties(001_highsnr_stdio_P_P_SM PROPERTIES PASS_REGULAR_EXPRESSION "RECEIVED BURSTS: ${BURSTS} RECEIVED FRAMES: ${FRAMESPERBURST}")
|
|
|
|
|
|
|
|
add_test(NAME 001_highsnr_stdio_P_P_MM
|
|
|
|
COMMAND sh -c "export LD_LIBRARY_PATH=${CODEC2_BUILD_DIR}/src;
|
|
|
|
PATH=$PATH:${CODEC2_BUILD_DIR}/src;
|
|
|
|
cd ${CMAKE_CURRENT_SOURCE_DIR}/test/001_highsnr_stdio_audio;
|
|
|
|
python3 test_multimode_tx.py --delay 500 --framesperburst ${FRAMESPERBURST} --bursts ${BURSTS} |
|
2021-12-15 06:54:10 +00:00
|
|
|
python3 test_multimode_rx.py --framesperburst ${FRAMESPERBURST} --bursts ${BURSTS} --timeout 20")
|
2021-12-13 20:11:09 +00:00
|
|
|
set_tests_properties(001_highsnr_stdio_P_P_MM PROPERTIES PASS_REGULAR_EXPRESSION "DATAC0: ${BURSTS}/${FRAMESPERBURST} DATAC1: ${BURSTS}/${FRAMESPERBURST} DATAC3: ${BURSTS}/${FRAMESPERBURST}")
|
2021-12-14 02:48:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
# These tests can't run on GitHub actions
|
|
|
|
if(NOT DEFINED ENV{GITHUB_RUN_ID})
|
|
|
|
|
2021-12-14 20:51:54 +00:00
|
|
|
# uses aplay/arecord then pipe to Python
|
|
|
|
add_test(NAME 001_highsnr_virtual1_P_P
|
2021-12-14 02:48:12 +00:00
|
|
|
COMMAND sh -c "export LD_LIBRARY_PATH=${CODEC2_BUILD_DIR}/src;
|
|
|
|
PATH=$PATH:${CODEC2_BUILD_DIR}/src;
|
|
|
|
cd ${CMAKE_CURRENT_SOURCE_DIR}/test/001_highsnr_stdio_audio;
|
2021-12-14 20:51:54 +00:00
|
|
|
./test_virtual1.sh")
|
|
|
|
set_tests_properties(001_highsnr_virtual1_P_P PROPERTIES PASS_REGULAR_EXPRESSION "RECEIVED BURSTS: 5 RECEIVED FRAMES: 10 RX_ERRORS: 0")
|
|
|
|
|
2021-12-15 03:37:26 +00:00
|
|
|
# let Python do audio I/O
|
2021-12-14 20:51:54 +00:00
|
|
|
add_test(NAME 001_highsnr_virtual2_P_P
|
|
|
|
COMMAND sh -c "export LD_LIBRARY_PATH=${CODEC2_BUILD_DIR}/src;
|
|
|
|
PATH=$PATH:${CODEC2_BUILD_DIR}/src;
|
|
|
|
cd ${CMAKE_CURRENT_SOURCE_DIR}/test/001_highsnr_stdio_audio;
|
|
|
|
./test_virtual2.sh")
|
2021-12-16 07:23:11 +00:00
|
|
|
set_tests_properties(001_highsnr_virtual2_P_P PROPERTIES PASS_REGULAR_EXPRESSION "RECEIVED BURSTS: 3 RECEIVED FRAMES: 6 RX_ERRORS: 0")
|
2021-12-14 02:48:12 +00:00
|
|
|
|
2021-12-15 03:37:26 +00:00
|
|
|
# Multimode test with Python I/O
|
2021-12-14 22:07:01 +00:00
|
|
|
add_test(NAME 001_highsnr_virtual3_P_P_MM
|
|
|
|
COMMAND sh -c "export LD_LIBRARY_PATH=${CODEC2_BUILD_DIR}/src;
|
|
|
|
PATH=$PATH:${CODEC2_BUILD_DIR}/src;
|
|
|
|
cd ${CMAKE_CURRENT_SOURCE_DIR}/test/001_highsnr_stdio_audio;
|
|
|
|
./test_virtual_mm.sh")
|
2021-12-15 06:13:47 +00:00
|
|
|
set_tests_properties(001_highsnr_virtual3_P_P_MM PROPERTIES PASS_REGULAR_EXPRESSION "DATAC0: 2/4 DATAC1: 2/4 DATAC3: 2/4")
|
2021-12-19 14:04:35 +00:00
|
|
|
|
|
|
|
# let Python do audio I/O via pyaudio callback mode
|
|
|
|
add_test(NAME 001_highsnr_virtual4_P_P_SM_CB
|
|
|
|
COMMAND sh -c "export LD_LIBRARY_PATH=${CODEC2_BUILD_DIR}/src;
|
|
|
|
PATH=$PATH:${CODEC2_BUILD_DIR}/src;
|
|
|
|
cd ${CMAKE_CURRENT_SOURCE_DIR}/test/001_highsnr_stdio_audio;
|
2021-12-20 09:33:35 +00:00
|
|
|
./test_virtual3a.sh")
|
2021-12-19 14:04:35 +00:00
|
|
|
set_tests_properties(001_highsnr_virtual4_P_P_SM_CB PROPERTIES PASS_REGULAR_EXPRESSION "RECEIVED BURSTS: 3 RECEIVED FRAMES: 6 RX_ERRORS: 0")
|
|
|
|
|
2021-12-20 09:33:35 +00:00
|
|
|
# let Python do audio I/O via pyaudio callback mode with code outside of callback
|
|
|
|
add_test(NAME 001_highsnr_virtual4_P_P_SM_CB_OUTSIDE
|
|
|
|
COMMAND sh -c "export LD_LIBRARY_PATH=${CODEC2_BUILD_DIR}/src;
|
|
|
|
PATH=$PATH:${CODEC2_BUILD_DIR}/src;
|
|
|
|
cd ${CMAKE_CURRENT_SOURCE_DIR}/test/001_highsnr_stdio_audio;
|
|
|
|
./test_virtual3b.sh")
|
|
|
|
set_tests_properties(001_highsnr_virtual4_P_P_SM_CB_OUTSIDE PROPERTIES PASS_REGULAR_EXPRESSION "RECEIVED BURSTS: 3 RECEIVED FRAMES: 6 RX_ERRORS: 0")
|
2021-12-19 14:04:35 +00:00
|
|
|
|
2021-12-14 02:48:12 +00:00
|
|
|
endif()
|
|
|
|
|