diff --git a/qt6-after/qt6-migrated-legatus/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/CMakeLists.txt index 9e090bdc4..649206e13 100755 --- a/qt6-after/qt6-migrated-legatus/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/CMakeLists.txt @@ -1121,6 +1121,43 @@ NGL_ADD_SUBDIR_GUARDED(Lts) # were removed from this branch; their add_subdirectory calls are gone with them.) #----------------------------------------------------------------------------------------------------- +# +# --- Relayout: all test / ctest executables go to bin/unit-test -------------- +# +# Naming convention: test_* | *_test | *_smoke | *Tests (module test apps +# such as pdmTests). The target property overrides the global +# EXECUTABLE_OUTPUT_PATH (bin/) set above. add_test() entries use +# $, so the ctest registry follows the new location +# automatically. +# +# The global RTI RUNPATH $ORIGIN entry (4 levels up) is correct for bin/ +# artifacts; from bin/unit-test/ the RTI libs are 5 levels up, so test +# executables additionally get a target-specific BUILD_RPATH entry. (Dead +# entries pointing at nonexistent dirs are harmless - the loader skips them.) +FILE(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/bin/unit-test") +# Collect the targets defined in this directory and all of its subdirectories. +# (The global property TARGETS is empty in CMake 4.x, so walk the directory +# tree instead. The macro expands in the caller's scope, so the list +# accumulates across the recursion.) +MACRO(_NGL_COLLECT_TARGETS _nngl_dir) + GET_PROPERTY(_nngl_dir_targets DIRECTORY ${_nngl_dir} PROPERTY BUILDSYSTEM_TARGETS) + LIST(APPEND _NGL_ALL_TARGETS ${_nngl_dir_targets}) + GET_PROPERTY(_nngl_subdirs DIRECTORY ${_nngl_dir} PROPERTY SUBDIRECTORIES) + FOREACH(_nngl_sub ${_nngl_subdirs}) + _NGL_COLLECT_TARGETS(${_nngl_sub}) + ENDFOREACH() +ENDMACRO() +SET(_NGL_ALL_TARGETS "") +_NGL_COLLECT_TARGETS(${CMAKE_SOURCE_DIR}) +FOREACH(_NGL_T ${_NGL_ALL_TARGETS}) + GET_TARGET_PROPERTY(_NGL_T_TYPE ${_NGL_T} TYPE) + IF(_NGL_T_TYPE STREQUAL "EXECUTABLE" AND + _NGL_T MATCHES "^(test_.*|.*(_test|_smoke|Tests))$") + SET_TARGET_PROPERTIES(${_NGL_T} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/unit-test" + BUILD_RPATH "$ORIGIN/../../../../../external/rti_connext_dds-7.7.0/resource/app/lib/x64Linux4gcc8.5.0") + ENDIF() +ENDFOREACH() # QAV analysis script dir (qav/) is not part of this branch. OPTION(BUILD_QAV "Build script for local QAV analysis" OFF) diff --git a/qt6-after/qt6-migrated-legatus/README.md b/qt6-after/qt6-migrated-legatus/README.md index c212158b0..b47fe3469 100644 --- a/qt6-after/qt6-migrated-legatus/README.md +++ b/qt6-after/qt6-migrated-legatus/README.md @@ -95,7 +95,8 @@ Output to inspect after the run: - `../build/release_build.log` — full make output (the build must end with **0 warnings**) -- `../build/bin/` — executables (apps + test binaries) +- `../build/bin/` — executables (apps) +- `../build/bin/unit-test/` — test and ctest binaries - `../build/lib/` — shared libraries To rebuild incrementally without a fresh tree, run `make` directly in an @@ -157,18 +158,18 @@ GUI-free tests need the offscreen Qt platform in a headless container: docker run --rm -it -v /path/to/pipeline-root:/workspace legatus-qt6:1.0 \ bash -c 'export QT_QPA_PLATFORM=offscreen cd /workspace/qt-migration-legatus/qt6-after/build -./bin/coprtcnv_unit_test # CoPrtCnv: telegrams, fragmentation, helpers -./bin/logview_unit_test # LogView: IntegerCalculator -./bin/prtcnv_unit_test # PrtCnv: PrtCnvMember fragmented-telegram handling -./bin/lts_coord_trans_unit_test -./bin/aes_crypt_test -./bin/test_nglpdfwidget +./bin/unit-test/coprtcnv_unit_test # CoPrtCnv: telegrams, fragmentation, helpers +./bin/unit-test/logview_unit_test # LogView: IntegerCalculator +./bin/unit-test/prtcnv_unit_test # PrtCnv: PrtCnvMember fragmented-telegram handling +./bin/unit-test/lts_coord_trans_unit_test +./bin/unit-test/aes_crypt_test +./bin/unit-test/test_nglpdfwidget # or everything registered: ctest --output-on-failure' ``` Each QtTest binary accepts a single slot name to run just one test, -e.g. `./bin/coprtcnv_unit_test radioTelegramFragmentationRoundtrip`. +e.g. `./bin/unit-test/coprtcnv_unit_test radioTelegramFragmentationRoundtrip`. ### 3.4 TetraIF unit tests (`TetraIF/unit-test/`) diff --git a/qt6-after/qt6-migrated-legatus/rpmbuild/make_rpm_ubuntu26.py b/qt6-after/qt6-migrated-legatus/rpmbuild/make_rpm_ubuntu26.py index e68d21b7d..992a07c07 100644 --- a/qt6-after/qt6-migrated-legatus/rpmbuild/make_rpm_ubuntu26.py +++ b/qt6-after/qt6-migrated-legatus/rpmbuild/make_rpm_ubuntu26.py @@ -128,9 +128,9 @@ def find_test_module_source(pkg_dir, test_name, release_dirs): def find_test_executables(pkg_dir, release_dirs): - """(executable, module) pairs for the test executables in build/bin/.""" + """(executable, module) pairs for the test executables in build/bin/unit-test/.""" test_executables = [] - build_bin_dir = os.path.join(pkg_dir, "build", "bin") + build_bin_dir = os.path.join(pkg_dir, "build", "bin", "unit-test") if not os.path.exists(build_bin_dir): warning(f"Build bin directory not found: {build_bin_dir}") return test_executables diff --git a/qt6-after/qt6-migrated-legatus/rpmbuild/make_rpm_ubuntu26_release2.py b/qt6-after/qt6-migrated-legatus/rpmbuild/make_rpm_ubuntu26_release2.py index 436bd4f29..ceec9cd5c 100644 --- a/qt6-after/qt6-migrated-legatus/rpmbuild/make_rpm_ubuntu26_release2.py +++ b/qt6-after/qt6-migrated-legatus/rpmbuild/make_rpm_ubuntu26_release2.py @@ -128,9 +128,9 @@ def find_test_module_source(pkg_dir, test_name, release_dirs): def find_test_executables(pkg_dir, release_dirs): - """(executable, module) pairs for the test executables in build/bin/.""" + """(executable, module) pairs for the test executables in build/bin/unit-test/.""" test_executables = [] - build_bin_dir = os.path.join(pkg_dir, "build", "bin") + build_bin_dir = os.path.join(pkg_dir, "build", "bin", "unit-test") if not os.path.exists(build_bin_dir): warning(f"Build bin directory not found: {build_bin_dir}") return test_executables @@ -472,9 +472,22 @@ def build_all_debs(source_dir, output_dir, version, build_number, cmake_flags, os.makedirs(dst_dir, exist_ok=True) shutil.copy2(src_path, os.path.join(dst_dir, entry)) staged += 1 + # Test / ctest executables live under bin/unit-test in the build tree; + # mirror that layout into the runtime package (usr/bin/unit-test/). + test_bin_dir = os.path.join(build_dir, "bin", "unit-test") + if os.path.isdir(test_bin_dir): + dst_dir = os.path.join(pkg1_dir, "usr", "bin", "unit-test") + os.makedirs(dst_dir, exist_ok=True) + for entry in sorted(os.listdir(test_bin_dir)): + src_path = os.path.join(test_bin_dir, entry) + if not os.path.isfile(src_path): + continue + shutil.copy2(src_path, os.path.join(dst_dir, entry)) + staged += 1 info(f"Staged {staged} artifacts from {build_dir}") install_lines_1 = [ "usr/bin/* usr/bin/", + "usr/bin/unit-test/* usr/bin/unit-test/", "usr/lib/* usr/lib/", ] build_deb(pkg_name="qt6-release-runtime", pkg_dir=pkg1_dir, output_dir=output_dir,