Add per-module unit-test dirs for the Release 2 scope

One unit-test/ directory per module/target, mirroring the existing
TetraIF/unit-test/ layout (one QtTest executable per module, guarded by
BUILD_TESTING and the module target, each registered with ctest):

  Lts/Common/CodeGen      codegen_unit_test
  Lts/Common/LtsCoordinate ltscoordinate_unit_test
  Lts/Common/LtsSession   ltssession_unit_test
  Lts/DDS/Core            ddscore_unit_test
  Lts/DDS/QosProfile      ddsqos_unit_test
  Lts/Tools/LogViewer     logviewer_unit_test
  Lts/Tools/SqlBrowser    sqlbrowser_unit_test
  Z/src/NGLLogger         ngllogger_unit_test
  Z/src/WMS_Interface     wms_json_ds_unit_test
  Z/src/nglapplication    nglcoreapplication_unit_test
  Z/src/nglcompression    nglcompression_unit_test
  Z/src/nglsettings       nglsettings_unit_test
  Z/src/ngltranslator     ngltranslator_unit_test

Where a module is built with hidden visibility and has no export macro
(LogViewer, SqlBrowser, ngltranslator, NGLLogger, nglcompression,
nglsettings), its sources are compiled directly into the test
executable, the same pattern as prtcnv_unit_test.

ctest baseline in the container (QT_QPA_PLATFORM=offscreen): 20/23
passed (13 new + 7 pre-existing in-scope tests), 3 Not Run as before
(nglcomp_test, GrantleeParserSmoke, utils_test).

README: ctest baseline table extended to the 23 registered tests and
section 2.4 now documents the per-module test layout. ddsview has no
unit test (GUI tool, XmlHelper needs the DDS dynamic-xtypes runtime).
This commit is contained in:
berrux-dev committed 2026-11-15 01:08:17 +01:00
1 parent a62b729577
commit 09b6df8bc3
40 files changed
+4966 -17

No files matched your search

+68 -17
View File
@@ -129,17 +129,33 @@ docker run --rm -it \
The driver runs `ctest --output-on-failure -j$(nproc)` (with
`QT_QPA_PLATFORM=offscreen` — the container is headless) after the compile.
Expected baseline (7 in-scope tests, all passed):
Expected baseline (23 registered, 20 in-scope tests passed, 3 Not Run):
| # | Test | Result |
|---|---|---|
| 1 | `coprtcnv_unit_test` | Passed |
| 2 | `logview_unit_test` | Passed |
| 3 | `prtcnv_unit_test` | Passed |
| 4 | `NGLToolsQtSmoke` | Passed |
| 5 | `test_nglpdfwidget` | Passed |
| 6 | `lts_coord_trans_unit_test` | Passed |
| 7 | `aes_crypt_test` | Passed |
| # | Test | Module | Result |
|---|---|---|---|
| 1 | `coprtcnv_unit_test` | TetraIF (CoPrtCnv) | Passed |
| 2 | `logview_unit_test` | TetraIF (LogView) | Passed |
| 3 | `prtcnv_unit_test` | TetraIF (PrtCnv) | Passed |
| 4 | `wms_json_ds_unit_test` | WMS_Interface | Passed |
| 5 | `nglcoreapplication_unit_test` | nglapplication | Passed |
| 6 | `nglcomp_test` | nglcompression | Not Run |
| 7 | `nglcompression_unit_test` | nglcompression | Passed |
| 8 | `nglsettings_unit_test` | nglsettings | Passed |
| 9 | `ngltranslator_unit_test` | ngltranslator | Passed |
| 10 | `NGLToolsQtSmoke` | NGLToolsQt | Passed |
| 11 | `test_nglpdfwidget` | NGLPDFWidget | Passed |
| 12 | `ngllogger_unit_test` | NGLLogger | Passed |
| 13 | `logviewer_unit_test` | LogViewer | Passed |
| 14 | `sqlbrowser_unit_test` | SqlBrowser | Passed |
| 15 | `ddsqos_unit_test` | DDS/QosProfile | Passed |
| 16 | `ddscore_unit_test` | DDS/Core | Passed |
| 17 | `GrantleeParserSmoke` | Grantlee | Not Run |
| 18 | `codegen_unit_test` | CodeGen | Passed |
| 19 | `lts_coord_trans_unit_test` | LtsCoordTrans | Passed |
| 20 | `ltscoordinate_unit_test` | LtsCoordinate | Passed |
| 21 | `aes_crypt_test` | Common (AES crypt) | Passed |
| 22 | `ltssession_unit_test` | LtsSession | Passed |
| 23 | `utils_test` | Common (LtsUtils) | Not Run |
A few tests registered by in-scope CMakeLists are not part of the 46
built targets and show up as `***Not Run` (`nglcomp_test`,
@@ -153,7 +169,13 @@ tests they registered are gone with them.)
B=$(ls -dt build4_* | head -1)
docker run --rm -v "$MIGRATE_PIPELINE_ROOT":/repo <image> \
bash -c "cd /repo/qt-migration-legatus/qt6-after/qt6-migrated-legatus/${B} \
&& ninja coprtcnv_unit_test logview_unit_test prtcnv_unit_test"
&& ninja coprtcnv_unit_test logview_unit_test prtcnv_unit_test \
codegen_unit_test ddscore_unit_test ddsqos_unit_test \
logviewer_unit_test sqlbrowser_unit_test \
ltscoordinate_unit_test ltssession_unit_test \
wms_json_ds_unit_test nglcompression_unit_test \
nglsettings_unit_test ngltranslator_unit_test \
ngllogger_unit_test nglcoreapplication_unit_test"
```
### 2.3 Run a test executable directly
@@ -178,15 +200,44 @@ ctest --output-on-failure"
Each QtTest binary accepts a single slot name to run just one test,
e.g. `./bin/coprtcnv_unit_test radioTelegramFragmentationRoundtrip`.
### 2.4 TetraIF unit tests (`TetraIF/unit-test/`)
### 2.4 Unit tests per module
| Test | Module covered | Note |
Each in-scope module has its own `unit-test/` directory (the original
`TetraIF/unit-test/` layout, one test executable per module, each
registered with ctest):
| Test | Module | Covers |
|---|---|---|
| `coprtcnv_unit_test` | `CoPrtCnv` — central & radio telegram header fields, payload access, length checks, fragmentation/reassembly roundtrip, id→string helpers | links `CoPrtCnv` |
| `logview_unit_test` | `LogView` — `IntegerCalculator` (arithmetic, precedence, error codes, variables) | compiles `LogView/IntegerCalculator.cpp` into the test (the class otherwise lives in the LogView executable) |
| `prtcnv_unit_test` | `PrtCnv` — `PrtCnvMember` state + fragmented-telegram add/reassembly | compiles `PrtCnv/PrtCnvMember.cpp` into the test because `PrtCnvLib` is built with hidden visibility (its symbols are not linkable from outside) |
| `coprtcnv_unit_test` | TetraIF | `CoPrtCnv` — telegram header fields, payload access, length checks, fragmentation/reassembly roundtrip, id→string helpers |
| `logview_unit_test` | TetraIF | `LogView` — `IntegerCalculator` (arithmetic, precedence, error codes, variables) |
| `prtcnv_unit_test` | TetraIF | `PrtCnv` — `PrtCnvMember` state + fragmented-telegram add/reassembly |
| `codegen_unit_test` | Common/CodeGen | name transforms, member/data/function/IDL wrappers, Grantlee wrapper getters (incl. JSON↔variant fallbacks), base data classes (`MemberInformation`/`CppData` `toString`) |
| `ddscore_unit_test` | DDS/Core | `ddsview`-independent DDS core helpers |
| `ddsqos_unit_test` | DDS/QosProfile | `DDS_DefaultQos` — default profile load, SHM/UDP/TCP participant QoS, default datawriter/datareader QoS, `print()` |
| `logviewer_unit_test` | Tools/LogViewer | `LogViewTableModel` (dimensions, roles, invalid index, header data, level colors, add/set data) + `SortFilterModel` (string/date filters, reset, date/level sort, `figureFilterOut`) |
| `sqlbrowser_unit_test` | Tools/SqlBrowser | `DataModel` (swap lists, role handling, tooltip timestamp, editability, set-data slots, delete lines) + `AddModel` (row creation, value stringification, remove/clear) |
| `ltscoordinate_unit_test` | Common/LtsCoordinate | constructors/geo accessors, validity checks, MGRS formatting, geo↔UTM roundtrips, UTM distances, angle degrees, elevation callback, `LtsCoordVector` |
| `ltssession_unit_test` | Common/LtsSession | session API roundtrips |
| `wms_json_ds_unit_test` | WMS_Interface | JSON dataset roundtrips (exercises, requirements, units) — `toJson`/`fromJson` fidelity |
| `nglcompression_unit_test` | nglcompression | `nglcomp` archive/tar filter helpers |
| `nglsettings_unit_test` | nglsettings | `NGL::Settings` + `NGL::Connections` (port offset, server hostname) |
| `ngltranslator_unit_test` | ngltranslator | `Translator` — catalog + `translate` (missing context, plural, disambiguation), JSON catalog import (valid/invalid, md5 cache, compressed), locale handling |
| `ngllogger_unit_test` | NGLLogger | `LoggerHierarchyHelper` naming/instance caching, log level ordering/enabled checks, bootstrap create/get, `AlreadyCreatedError` |
| `nglcoreapplication_unit_test` | nglapplication | `LoggerHandler` — `createLogger` naming (prefix/postfix), duplicate-root `AlreadyCreatedError` |
Sources are registered with ctest via `TetraIF/unit-test/CMakeLists.txt`.
Hidden-visibility note: the tree builds with `CMAKE_CXX_VISIBILITY_PRESET
hidden`, so classes without an export macro are not in the shared
library's dynamic symbol table. Where a module has no export macro
(`LogViewer`, `SqlBrowser`, `ngltranslator`, `NGLLogger`, `nglcompression`,
`nglsettings`), its test compiles the module source files directly into
the test executable (same pattern as `prtcnv_unit_test`).
`ddsview` has no unit test: it is a GUI tool whose `XmlHelper` needs the
DDS dynamic-xtypes runtime and a GUI model.
Sources are registered with ctest via each module's
`unit-test/CMakeLists.txt` (guarded by `BUILD_TESTING` and by the module
target existing).
## Step 3 — Produce the Release 2 DEB packages