diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /tests/integration/jt9 | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'tests/integration/jt9')
| -rw-r--r-- | tests/integration/jt9/compare_decoder_output.cmake | 44 | ||||
| -rw-r--r-- | tests/integration/jt9/compare_mtd_messages.cmake | 133 | ||||
| -rw-r--r-- | tests/integration/jt9/smoke_decoder_callback.cmake | 47 | ||||
| -rw-r--r-- | tests/integration/jt9/verify_elf_stack.cmake | 30 | ||||
| -rw-r--r-- | tests/integration/jt9/verify_jt4_12000_read_extent.cmake | 67 |
5 files changed, 321 insertions, 0 deletions
diff --git a/tests/integration/jt9/compare_decoder_output.cmake b/tests/integration/jt9/compare_decoder_output.cmake new file mode 100644 index 00000000..a7d28827 --- /dev/null +++ b/tests/integration/jt9/compare_decoder_output.cmake @@ -0,0 +1,44 @@ +foreach (required_variable JT9 MODE SAMPLE EXPECTED WORK_DIR SOURCE_DIR) + if (NOT DEFINED ${required_variable} OR "${${required_variable}}" STREQUAL "") + message (FATAL_ERROR "${required_variable} is required") + endif () +endforeach () + +file (MAKE_DIRECTORY "${WORK_DIR}") +set (actual_file "${WORK_DIR}/actual.txt") +set (stderr_file "${WORK_DIR}/stderr.txt") + +execute_process ( + COMMAND "${JT9}" + -a "${WORK_DIR}" + -t "${WORK_DIR}" + -r "${SOURCE_DIR}" + ${MODE} + "${SAMPLE}" + WORKING_DIRECTORY "${WORK_DIR}" + RESULT_VARIABLE decoder_result + OUTPUT_VARIABLE decoder_stdout + ERROR_VARIABLE decoder_stderr) + +file (WRITE "${actual_file}" "${decoder_stdout}") +file (WRITE "${stderr_file}" "${decoder_stderr}") + +if (NOT "${decoder_result}" STREQUAL "0") + message (FATAL_ERROR + "jt9 exited with ${decoder_result}\n" + "stdout:\n${decoder_stdout}\n" + "stderr:\n${decoder_stderr}") +endif () + +if (NOT "${decoder_stderr}" STREQUAL "") + message (FATAL_ERROR "jt9 wrote to stderr:\n${decoder_stderr}") +endif () + +file (READ "${EXPECTED}" expected_output) +if (NOT "${decoder_stdout}" STREQUAL "${expected_output}") + message (FATAL_ERROR + "jt9 output differs from ${EXPECTED}\n" + "expected:\n${expected_output}\n" + "actual:\n${decoder_stdout}\n" + "preserved output: ${actual_file}") +endif () diff --git a/tests/integration/jt9/compare_mtd_messages.cmake b/tests/integration/jt9/compare_mtd_messages.cmake new file mode 100644 index 00000000..4011dca7 --- /dev/null +++ b/tests/integration/jt9/compare_mtd_messages.cmake @@ -0,0 +1,133 @@ +foreach (required_variable JT9 SAMPLE EXPECTED WORK_DIR SOURCE_DIR MTD_WORKERS + DECODE_CYCLES FFT_THREADS) + if (NOT DEFINED ${required_variable} OR "${${required_variable}}" STREQUAL "") + message (FATAL_ERROR "${required_variable} is required") + endif () +endforeach () + +file (MAKE_DIRECTORY "${WORK_DIR}") + +set (input_samples "${SAMPLE}") +set (expected_completion_count 1) +if (CONSECUTIVE_PERIODS) + set (input_samples) + foreach (utc IN ITEMS 133430 133445 133500 133515) + set (period_sample "${WORK_DIR}/210703_${utc}.wav") + configure_file ("${SAMPLE}" "${period_sample}" COPYONLY) + list (APPEND input_samples "${period_sample}") + endforeach () + list (LENGTH input_samples expected_completion_count) +endif () + +set (qso_arguments) +set (qso_variables MY_CALL DX_CALL QSO_FREQUENCY QSO_PROGRESS) +set (configured_qso_variable_count 0) +foreach (qso_variable IN LISTS qso_variables) + if (DEFINED ${qso_variable} AND NOT "${${qso_variable}}" STREQUAL "") + math (EXPR configured_qso_variable_count + "${configured_qso_variable_count} + 1") + endif () +endforeach () +if (configured_qso_variable_count GREATER 0 AND + NOT configured_qso_variable_count EQUAL 4) + message (FATAL_ERROR + "MY_CALL, DX_CALL, QSO_FREQUENCY, and QSO_PROGRESS must be set together") +elseif (configured_qso_variable_count EQUAL 4) + list (APPEND qso_arguments + -c "${MY_CALL}" -x "${DX_CALL}" -f "${QSO_FREQUENCY}" -Q "${QSO_PROGRESS}") +endif () + +set (actual_file "${WORK_DIR}/actual.txt") +set (stderr_file "${WORK_DIR}/stderr.txt") +file (WRITE "${stderr_file}" "") + +execute_process ( + COMMAND "${CMAKE_COMMAND}" -E env OMP_STACKSIZE=16M + "${JT9}" + -8 -M -N ${MTD_WORKERS} -d 3 -C ${DECODE_CYCLES} -E 3 -D 3 + -p 15 -m ${FFT_THREADS} -L 200 -H 3000 + -a "${WORK_DIR}" + -t "${WORK_DIR}" + -r "${SOURCE_DIR}" + ${qso_arguments} + ${input_samples} + WORKING_DIRECTORY "${WORK_DIR}" + RESULT_VARIABLE decoder_result + OUTPUT_VARIABLE decoder_stdout + ERROR_FILE "${stderr_file}") + +file (WRITE "${actual_file}" "${decoder_stdout}") +file (READ "${stderr_file}" decoder_stderr) + +if (NOT "${decoder_result}" STREQUAL "0") + message (FATAL_ERROR + "jt9 MTD exited with ${decoder_result}\n" + "stdout:\n${decoder_stdout}\n" + "stderr:\n${decoder_stderr}") +endif () + +if (NOT "${decoder_stderr}" STREQUAL "") + message (FATAL_ERROR "jt9 MTD wrote to stderr:\n${decoder_stderr}") +endif () + +string (REGEX MATCHALL "<DecodeFinished>" completion_markers "${decoder_stdout}") +list (LENGTH completion_markers completion_count) +if (NOT completion_count EQUAL expected_completion_count) + message (FATAL_ERROR + "jt9 MTD completed ${completion_count} decode periods; " + "expected ${expected_completion_count}") +endif () + +file (READ "${EXPECTED}" expected_output) + +# OpenMP worker completion order and numeric decode metadata are not stable invariants. +function (extract_ft8_messages decoder_output output_variable) + set (required_period "${ARGV2}") + string (REPLACE "\r\n" "\n" normalized_output "${decoder_output}") + string (REPLACE "\n" ";" output_lines "${normalized_output}") + set (messages) + foreach (line IN LISTS output_lines) + if (NOT "${required_period}" STREQUAL "") + string (STRIP "${line}" stripped_line) + string (FIND "${stripped_line}" "${required_period} " period_position) + if (NOT period_position EQUAL 0) + continue () + endif () + endif () + string (FIND "${line}" "~" marker_position) + if (marker_position GREATER_EQUAL 0) + math (EXPR message_position "${marker_position} + 1") + string (SUBSTRING "${line}" ${message_position} -1 message) + string (STRIP "${message}" message) + if (NOT "${message}" STREQUAL "") + list (APPEND messages "${message}") + endif () + endif () + endforeach () + list (REMOVE_DUPLICATES messages) + list (SORT messages) + set (${output_variable} "${messages}" PARENT_SCOPE) +endfunction () + +extract_ft8_messages ("${expected_output}" expected_messages) +extract_ft8_messages ("${decoder_stdout}" actual_messages) + +if (CONSECUTIVE_PERIODS) + foreach (utc IN ITEMS 133430 133445 133500 133515) + extract_ft8_messages ("${decoder_stdout}" period_messages "${utc}") + if (NOT "${period_messages}" STREQUAL "${expected_messages}") + message (FATAL_ERROR + "jt9 MTD decoded message set differs in period ${utc}") + endif () + endforeach () +endif () + +if (NOT "${actual_messages}" STREQUAL "${expected_messages}") + string (REPLACE ";" "\n " expected_display "${expected_messages}") + string (REPLACE ";" "\n " actual_display "${actual_messages}") + message (FATAL_ERROR + "jt9 MTD decoded message set differs from ${EXPECTED}\n" + "expected:\n ${expected_display}\n" + "actual:\n ${actual_display}\n" + "preserved output: ${actual_file}") +endif () diff --git a/tests/integration/jt9/smoke_decoder_callback.cmake b/tests/integration/jt9/smoke_decoder_callback.cmake new file mode 100644 index 00000000..6a4e698f --- /dev/null +++ b/tests/integration/jt9/smoke_decoder_callback.cmake @@ -0,0 +1,47 @@ +foreach (required_variable JT9 SAMPLE EXPECTED_MESSAGE WORK_DIR SOURCE_DIR) + if (NOT DEFINED ${required_variable} OR "${${required_variable}}" STREQUAL "") + message (FATAL_ERROR "${required_variable} is required") + endif () +endforeach () + +file (MAKE_DIRECTORY "${WORK_DIR}") +set (actual_file "${WORK_DIR}/actual.txt") + +execute_process ( + COMMAND "${JT9}" + -a "${WORK_DIR}" + -t "${WORK_DIR}" + -r "${SOURCE_DIR}" + -8 + -d 1 + -x b + -L 1000 + -H 1400 + "${SAMPLE}" + WORKING_DIRECTORY "${WORK_DIR}" + RESULT_VARIABLE decoder_result + OUTPUT_VARIABLE decoder_stdout + ERROR_VARIABLE decoder_stderr) + +file (WRITE "${actual_file}" "${decoder_stdout}") + +if (NOT "${decoder_result}" STREQUAL "0") + message (FATAL_ERROR + "jt9 exited with ${decoder_result}\n" + "stdout:\n${decoder_stdout}\n" + "stderr:\n${decoder_stderr}") +endif () + +if (NOT "${decoder_stderr}" STREQUAL "") + message (FATAL_ERROR "jt9 wrote to stderr:\n${decoder_stderr}") +endif () + +string (FIND "${decoder_stdout}" "${EXPECTED_MESSAGE}" message_position) +string (FIND "${decoder_stdout}" "<DecodeFinished>" completion_position) +if (message_position LESS 0 OR completion_position LESS 0) + message (FATAL_ERROR + "jt9 did not complete the expected FT8 callback path\n" + "expected message: ${EXPECTED_MESSAGE}\n" + "actual:\n${decoder_stdout}\n" + "preserved output: ${actual_file}") +endif () diff --git a/tests/integration/jt9/verify_elf_stack.cmake b/tests/integration/jt9/verify_elf_stack.cmake new file mode 100644 index 00000000..30db932b --- /dev/null +++ b/tests/integration/jt9/verify_elf_stack.cmake @@ -0,0 +1,30 @@ +foreach (required_variable READELF EXECUTABLE) + if (NOT DEFINED ${required_variable} OR "${${required_variable}}" STREQUAL "") + message (FATAL_ERROR "${required_variable} is required") + endif () +endforeach () + +execute_process ( + COMMAND "${READELF}" -W -l "${EXECUTABLE}" + RESULT_VARIABLE readelf_result + OUTPUT_VARIABLE readelf_stdout + ERROR_VARIABLE readelf_stderr) + +if (NOT "${readelf_result}" STREQUAL "0") + message (FATAL_ERROR + "readelf exited with ${readelf_result}\n" + "stdout:\n${readelf_stdout}\n" + "stderr:\n${readelf_stderr}") +endif () + +string (REGEX MATCH "GNU_STACK[^\r\n]*" stack_header "${readelf_stdout}") +if (NOT stack_header) + message (FATAL_ERROR "${EXECUTABLE} has no GNU_STACK program header") +endif () + +if (stack_header MATCHES "[ \t]RWE([ \t]|$)" OR + NOT stack_header MATCHES "[ \t]RW([ \t]|$)") + message (FATAL_ERROR + "${EXECUTABLE} does not have a non-executable read/write stack:\n" + "${stack_header}") +endif () diff --git a/tests/integration/jt9/verify_jt4_12000_read_extent.cmake b/tests/integration/jt9/verify_jt4_12000_read_extent.cmake new file mode 100644 index 00000000..7011cc39 --- /dev/null +++ b/tests/integration/jt9/verify_jt4_12000_read_extent.cmake @@ -0,0 +1,67 @@ +foreach (required_variable JT9 JT4SIM WORK_DIR) + if (NOT DEFINED ${required_variable} OR "${${required_variable}}" STREQUAL "") + message (FATAL_ERROR "${required_variable} is required") + endif () +endforeach () + +file (MAKE_DIRECTORY "${WORK_DIR}") +execute_process ( + COMMAND "${JT4SIM}" "G3WDG OK1KIR RRR" F 1 0 0 1 99 + WORKING_DIRECTORY "${WORK_DIR}" + RESULT_VARIABLE simulator_result + OUTPUT_QUIET + ERROR_VARIABLE simulator_stderr) +if (NOT "${simulator_result}" STREQUAL "0") + message (FATAL_ERROR + "jt4sim exited with ${simulator_result}\n${simulator_stderr}") +endif () + +set (full_wav "${WORK_DIR}/000000_0001.wav") +set (truncated_wav "${WORK_DIR}/000000_0001_truncated.wav") +# Keep enough samples to distinguish a complete JT4 read from premature termination. +set (truncate_script [=[ +import struct +import sys + +sample_count = 580000 +file_size = 44 + 2 * sample_count +with open(sys.argv[1], "rb") as source_file: + wav_data = bytearray(source_file.read(file_size)) +if len(wav_data) != file_size: + raise RuntimeError("generated JT4 WAV is too short") +struct.pack_into("<I", wav_data, 4, file_size - 8) +struct.pack_into("<I", wav_data, 40, 2 * sample_count) +with open(sys.argv[2], "wb") as truncated_file: + truncated_file.write(wav_data) +]=]) +execute_process ( + COMMAND python3 -c "${truncate_script}" "${full_wav}" "${truncated_wav}" + RESULT_VARIABLE truncate_result + OUTPUT_QUIET + ERROR_VARIABLE truncate_stderr) +if (NOT "${truncate_result}" STREQUAL "0") + message (FATAL_ERROR "Failed to create truncated JT4 WAV\n${truncate_stderr}") +endif () + +execute_process ( + COMMAND "${JT9}" + -a "${WORK_DIR}" + -t "${WORK_DIR}" + --jt4 -b F -f 1000 -d 3 + "${truncated_wav}" + WORKING_DIRECTORY "${WORK_DIR}" + RESULT_VARIABLE decoder_result + OUTPUT_VARIABLE decoder_stdout + ERROR_VARIABLE decoder_stderr) +if (NOT "${decoder_result}" STREQUAL "0") + message (FATAL_ERROR + "jt9 exited with ${decoder_result}\n" + "stdout:\n${decoder_stdout}\n" + "stderr:\n${decoder_stderr}") +endif () +if (NOT "${decoder_stdout}" MATCHES "EOF on input file") + message (FATAL_ERROR + "jt9 did not read beyond the obsolete 570240-sample cutoff\n" + "stdout:\n${decoder_stdout}\n" + "stderr:\n${decoder_stderr}") +endif () |
