Relocate all test and ctest executables to bin/unit-test

Test binaries (naming: test_* | *_test | *_smoke | *Tests - 26 targets
incl. the ctest-registered ones and pdmTests) now build into
<build>/bin/unit-test/ instead of <build>/bin/.

- CMakeLists: post-processing pass after all add_subdirectory calls sets
  RUNTIME_OUTPUT_DIRECTORY (overrides the legacy EXECUTABLE_OUTPUT_PATH)
  plus a 5-level $ORIGIN BUILD_RPATH entry (from bin/unit-test the RTI
  libs are one level further away than from bin/). Targets are collected
  by walking the SUBDIRECTORIES tree - the global TARGETS property is
  empty under CMake 4.x, which silently broke the first attempt.
- add_test() uses $<TARGET_FILE:...>, so the ctest registry follows the
  new location without changes.
- rpmbuild/make_rpm_ubuntu26*.py: test discovery points at
  build/bin/unit-test; the release2 runtime DEB mirrors the layout into
  usr/bin/unit-test/ so the test binaries stay in the package.
- README: bin/unit-test/ documented in the output list and snippets.

Verified (fresh /workspace-mount build): all 26 test executables in
bin/unit-test/, ctest 20/22 (same 2 pre-existing out-of-scope failures),
RUNPATH carries the 5-level $ORIGIN RTI entry and ddscore_unit_test runs
from bin/unit-test with no LD_LIBRARY_PATH / RTI_LICENSE; app binaries in
bin/ keep their 4-level entry.
This commit is contained in:
berrux-dev committed 2026-11-17 00:48:34 +01:00
1 parent dc2c3e358b
commit 9d0403817e
4 files changed
+63 -12

No files matched your search

@@ -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
@@ -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,