source: ntrip/trunk/BNC/tests/README.md

Last change on this file was 11220, checked in by stuerze, 2 days ago

combination improved

File size: 18.9 KB
RevLine 
[11055]1# BNC regression tests
2
3Run BNC headless on fixed inputs and compare its outputs with stored reference
4outputs. No network access is needed.
5
6```
7tests/run_tests.py # all cases (parallel), exit code 1 on failure
8tests/run_tests.py ssr_ rinex_qc # only cases whose name contains a pattern
9tests/run_tests.py --list
10tests/run_tests.py --update NAME # accept current output as new reference
[11069]11 # (removes references of outputs no longer produced)
[11055]12```
13
[11059]14Build `./bnc` first. Each case runs in `tests/work/<case>/`,
[11055]15which has an `Input` symlink to `Example_Configs/Input` and an empty `Output`
16directory, so the example configurations run unchanged. On a failure, the
17full diff is at `tests/work/<case>/<output>.diff` and the exact command line
18is in `tests/work/<case>/command.txt`.
19
20## Layout
21
22| Path | Content |
23|---|---|
24| `run_tests.py` | runner; the `case.json` format is documented in its header |
25| `cases/<name>/case.json` | config, extra `-key` arguments, raw capture, outputs to compare |
26| `cases/<name>/expected/*.gz` | normalised reference outputs |
27| `data/*.raw` | short raw captures (BNC `rawOutFile` format) replayed via `--file` |
[11192]28| `data/rnx402_MO.rnx`, `data/rnx402_MN.rnx` | crafted RINEX 4.02 files: 3 BRUX epochs with receiver clock offset, pico-sec digits and `RCV CLOCK OFFS APPL`; GLONASS FDMA/L1OC/L3OC ephemerides and STO/EOP/ION examples of the RINEX 4.02 document (ION with subtypes KLOB/NEQN, ION J CNVX without subtype) |
29| `data/rnx402_events_MO.rnx` | `data/rnx402_MO.rnx` with event records (flags 1-6, blank epochs, pico-sec event epoch, events after the last epoch) and further header records (SYS / SCALE FACTOR, DCBS/PCVS APPLIED, CENTER OF MASS: XYZ, PRN / # OF OBS, an unknown record) |
[11200]30| `data/nav402_p?_MN.rnx`, `data/nav305_?_MN.rnx`, `data/nav211_?.26n` | navigation files for the concatenation: 3 overlapping pieces of the 1 h BRUX RINEX 4.01 file (with STO/ION records); 2 RINEX 3.05 and 2 RINEX 2.11 GPS files (converted by BNC) with added IONOSPHERIC CORR/TIME SYSTEM CORR/LEAP SECONDS resp. ION ALPHA/ION BETA/DELTA-UTC records, differing between the files |
31| `data/nav401_gps_MN.rnx` | GPS LNAV records of the daily BRUX RINEX 4.01 file incl. ION and STO records (conversion to RINEX 3/2 header records) |
32| `data/obs_p1_MO.rnx`, `data/obs_p2_MO.rnx` | epochs 0-14 and 10-24 of the 1 h BRUX observation file, the second with another receiver firmware and antenna |
33| `data/nav402_navic_MN.rnx` | NavIC STO IRUT records for UTC(NPLI) and UTCIRN (RINEX 4.02 examples) and one GPS ephemeris |
[11127]34| `tools/fakecaster.py` | local Ntrip caster recording an upload as a BNC raw file (case key `fakecaster`); optionally TLS and serving a stream |
35| `tools/bncraw.py` | `info` (streams, time span, RTCM3 message types), `slice` and `crs` (decode 1300/1301/1302) for raw captures |
[11124]36| `tools/mkcrafted.py` | writes `data/crafted_limits.raw`: crafted frames at the upper field limits |
37| `tools/ssr_harness.sh` | builds `tools/ssr_harness.cpp` with the SSR decoders under ASan/UBSan and runs it |
[11127]38| `tools/ssl_check.py` | TLS checks of the Ntrip 2s client and upload (not part of `run_tests.py`) |
[11130]39| `tools/net_check.py` | UDP/RTP sender filter and upload status checks on loopback (not part of `run_tests.py`) |
[11153]40| `tools/cred_check.py` | credentials files (`~/.netrc`, BNC format) for download and upload (not part of `run_tests.py`) |
[11187]41| `tools/logcheck.py` | structured logfile: JSON/logfmt syntax, both formats equal, `time` = classic GPS time stamp - leap seconds, optional `epoch`, `msg` = classic logfile |
[11055]42| `work/` | scratch output, not versioned |
43
44Before comparing, the runner removes content that changes with each run or
45BNC version: wall-clock log prefixes, `Start BNC` lines, the BNC version
46string, the RINEX `PGM / RUN BY / DATE` line, and the `Run by`/`Date` lines
47in reqc logs.
48
49## Cases
50
51* File-based examples: `rinex_concat`, `rinex_qc`, `sp3_compare`, `ppp_postproc`,
52 `ppp_osm` (04, 05, 21, 11, 12), plus the command-line variants `*_cli` and
53 `sp3_compare_exclude` (scripts 24, 23, 28). The QC cases use the 1 h BRUX
54 files instead of the full-day file.
55* `rinex_edit_minele`: Edit/Concatenate with a 10 deg elevation mask (1 h BRUX
56 files), covering the ephemeris selection for the elevation mask.
[11192]57* `rinex_edit_v402`: Edit/Concatenate of `data/rnx402_*` to RINEX 4.02 at
58 0.1 sec sampling: epoch clock offset and pico-sec digits kept unchanged, no
59 `SYS / PHASE SHIFT` records (deprecated in RINEX 4), L1OC/L3OC records
60 complete (incl. Beta, AODE/AODC order), non-EPH records skipped.
61* `rinex_edit_v402_to_v2`: the same observations as RINEX 2.11 (clock offset
62 F12.9 in columns 69-80; the pico-sec digits cannot be written there).
63* `rinex_edit_v402_events`, `rinex_edit_v402_events_to_v2`: Edit/Concatenate
64 of `data/rnx402_events_MO.rnx` to RINEX 4.02 and 2.11: events kept (in RINEX 2
65 without records not existing there, and without changes of the observation
66 types), scaled observations, header records kept, TIME OF LAST OBS,
67 # OF SATELLITES and PRN / # OF OBS of the written file.
[11200]68* `rinex_nav_concat_v4`, `rinex_nav_concat_v4_to_v3`, `rinex_nav_concat_v3`,
69 `rinex_nav_concat_v3_to_v4`, `rinex_nav_concat_v2`: navigation file
70 concatenation: duplicates removed, RINEX 4 STO/ION records and header
71 records (first one of a kind) kept, records not convertible to the output
72 version reported in the log; `rinex_nav_concat_v4` equals the edit of the
73 original 1 h file.
74* `rinex_nav_v4_gps_to_v2`, `rinex_nav_v4_gps_to_v3`, `rinex_nav_v2_to_v3`:
75 conversion of RINEX 4 ION/STO records to RINEX 2/3 header records (ION
76 ALPHA/BETA, DELTA-UTC resp. IONOSPHERIC CORR, TIME SYSTEM CORR) and of
77 RINEX 2 to RINEX 3 header records; `rinex_nav_concat_v4_to_v3` also covers
78 BDS (time mark, GEO/IGSO priority), Galileo, GLONASS.
79* `rinex_nav_navic_irut_to_v3`: of two NavIC IRUT offsets, the one to UTCIRN
80 becomes TIME SYSTEM CORR IRUT in RINEX 3.
81* `rinex_edit_long_marker`: marker name longer than 9 characters kept in RINEX 4.
82* `rinex_concat_overlap`: overlapping observation files (epochs written once)
83 with header changes between the files (event flag 4).
[11055]84* Stream replays of the real-time examples (`replay_*`), all from the 5 min
85 slice `data/wtzr_cnes_5min.raw` (BCEP00BKG0, WTZR00DEU0, SSRA00CNE1):
86 `replay_rinex_obs` (01, skeleton not mandatory as there is no caster offline),
87 `replay_rinex_eph` (02), `replay_feed_engine` (07, IP port disabled) and
88 `replay_save_sp3` (14, with SSRA00CNE1 instead of SSRA00BKG1).
[11136]89* `replay_rinex_eph_perstream`: 02 with 'File per stream' on `data/eph_perstream_260930_4min.raw`
90 (ephemeris messages of BCEP00BKG0, SSRA00EUH0, FFMJ00DEU0, WTZR00DEU0 cut from the
91 merged capture): one RINEX 4 navigation file per stream.
[11137]92* `replay_eph_cutover`: 02 on `data/eph_cutover_261023_20min.raw` (GPS ephemerides of
93 BCEP00BKG0, BCEP01JPL0, BCEP00CAS0, 23 Oct 2026 01:05-01:25): the G17 upload within the
94 fit interval (IOD 4, TOC 01:59:44, 16 s before IOD 148) is accepted, the data set mixed
95 from both uploads (IODE 4, IODC 148) rejected.
[11058]96* `replay_save_sp3_has`: 14 with Galileo HAS (SSRA00EUH0) only; its epochs are
97 off the SP3/CLK sampling grid and are written at the preceding grid epoch.
[11055]98* Real-time PPP replays (`ppp_rt_*`) from 11 min slices of the CNES and WHU
99 captures (`data/wtzr_cnes_11min.raw`, `data/wtzr_whu_11min.raw`):
[11058]100 `ppp_rt_float` (08), `ppp_rt_quickstart` (10, NMEA port disabled), `ppp_rt_ar_cnes` (29) and `ppp_rt_ar_whu`
[11055]101 (30), compared exactly.
[11179]102* `log_structured`: 10 as `ppp_rt_quickstart` with the structured logfile,
103 JSON in the main run and logfmt in the post step `lf`; `tools/logcheck.py`
104 compares both formats with each other and their `msg` with the classic log.
105 The latency events (`stream_latency`) are not covered: in `--file` replay
106 the latency check uses the wall clock, so no latencies are computed.
[11058]107* `ppp_rt_net` (09, two stations) and `ppp_rt_has` (13, Galileo HAS via
108 SSRA00EUH0) from `data/merged_260930_11min.raw`, a slice of two simultaneous
109 recordings merged by time (BCEP00BKG0, WTZR00DEU0, FFMJ00DEU0, SSRA00CNE1,
110 SSRA00EUH0).
[11069]111* Combination (`combi`, `combi_ppp`; 17 and 18 unchanged) from
112 `data/combi_261005_11min.raw` (SSRA00BKG1, SSRA00CNE1, SSRA00CHC1, BCEP00BKG0,
113 FFMJ00DEU0), upload to the caster disabled, SP3/CLK/BIA written to files.
114* `combi_multi`: 17 with the 7 ACs of an operational combination (BKG1, CHC1,
115 CNE1, GFZ1, GMV0, NRC0, SHA1; IGS-SSR and RTCM-SSR) from
116 `data/combi_multi_261002_5min.raw`. Covers legacy and erroneous epoch
117 encodings, missing reference-signal biases, inconsistent biases and
118 persistent outliers. The longest case (about 4 min).
[11218]119* `combi_bds_level`: 17 with the six inputs of the IGS03 combination (CAS01,
120 CHC00, GMV00, CNE00, BKG00, SHA01 without BDS; 10 s) from
121 `data/combi_bds_level_261121_13min.raw` (21 Nov 2026 18:50-19:03, cut from
122 the SSR QC recording). At 19:01:00 the master AC CAS01 refers C14 to an IOD
123 not yet received from BCEP00BKG0, C14 is missing in one epoch; the level of
124 the combined clocks must not jump (before: all BDS clocks -0.92 m and back).
125 `tools/clkjumps.py` lists common clock jumps > 0.1 m of the CLK file.
[11087]126* `combi_refsig`: `combi` with non-default reference signals (`ssrRefSignals
127 C:1P&5P`): BDS clock referral and code biases from the Bias SINEX file on
128 C1P/C5P (generic DCB derivation), CLK/BIA and the combination log compared.
[11060]129* Upload (`upload_*`; 16, 19, 20) from `data/upload_rtnet_5min.raw` (RTNET engine
130 output + BCEP00BKG0): BNC uploads to a local fake caster
131 (`tools/fakecaster.py`, Ntrip 1/2, chunked), and a `post` step decodes the
132 received stream again: `upload_rtnet` (IGS-SSR encoding, SP3/CLK/BIA files,
[11127]133 decoded `.ssr`, CRS messages 1300/1302 decoded by `bncraw.py crs` in a
134 `tool` post step), `upload_eph` (RTCM3 ephemerides to RINEX nav) and
[11083]135 `upload_raw` (raw forwarding to RINEX nav). `upload_rtnet_rtcm` encodes the same input to RTCM-SSR
136 (message numbers 1057-1068, 1240-1270) and decodes it again.
[11215]137 `upload_eph_vote` replays the ephemerides of 89 uploader input streams
138 (`data/eph_vote_261118_20min.raw`, 18 Nov 2026 17:43-18:03, BCEP00BKG0
139 removed) and compares the log with the majority vote replacements
140 (e.g. R06/R19/R20 Bn = 1 from RIO200ARG0); the uploaded stream depends on
141 the wall-clock timing and is not compared. `eph_out_of_range` replays 6 min of
142 the same input with a G39 copy of the G24 ephemerides of 3 stations
143 (`tools/mk_eph_g39.py`): the G39 data set is logged once as RINEX record, the
144 RINEX navigation file and the uploaded stream (`bncraw.py ephsats`) have no G39.
[11055]145* SSR decoding (`ssr_*`): 3 min slices of real streams replayed through
146 `03_BrdcCorr.bnc`. They compare the `.ssr` files and the `BNC_DEBUG_SSR`
147 stderr trace. On a build without that trace, the trace comparison is
148 reported as SKIP.
149 * `ssr_igs_SSRA00CNE1`: IGS-SSR 4076, `SsrCorrIgs`
150 * `ssr_rtcm_SSRA00CNE0`, `ssr_rtcm_WHU1_OSBC`: RTCM 1059-1270; these test
151 whichever class `RTCM3Decoder.cpp` selects for non-4076 SSR.
[11083]152* `ssr_weekchange`: 2 min across the GPS week change (SSRA00CNE1, SSRA00CHC1);
153 corrections of Saturday received after midnight must keep their epochs.
[11075]154* `ssr_qc`, `ssr_qc_select`: SSR QC (31_SsrQC, one file per stream, 5 min interval;
155 all streams resp. `ssrQcStreams SSRA00CNE1,SSRA00GMV0`) of the 7 AC streams of
[11087]156 `data/combi_multi_261002_5min.raw`. `ssr_qc_bias` adds the CAS DCB file as
157 'QC Bias File' (code bias check against the other ACs and the file).
[11152]158* `ssr_qc_ephmount`: `ssr_qc` with the general option 'Ephemeris streams' empty (31_SsrQC.bnc has
159 BCEP00BKG0): the ephemerides contained in SSRA00GMV0 are used too, so the GPS uploads within the
160 fit interval of G10, G22, G29 (only in SSRA00GMV0 on 2 Oct) are found.
[11137]161* `ssr_qc_iod`: IOD check of the SSR QC on `data/qc_iod_261015.raw` (made with
162 `tools/mk_qc_iod.py` from the QC capture of 15 Oct 2026: BCEP00BKG0 with each message only
163 at its first reception from 00:00, SSRA00WHU1/GMV1/CNE1 01:55-02:10): IODs received only
164 later (WHU1), never received (GMV1 G16, upload not in BCEP00BKG0), ephemeris outside its
165 validity (CNE1 GLONASS).
[11218]166* `ssr_qc_outage`: common outage of the input on `data/ssr_qc_outage_261002_5min.raw`
167 (`data/combi_multi_261002_5min.raw` without the chunks of all 7 AC streams 11:43:00-11:44:00,
168 BCEP00BKG0 kept, and without those of SSRA00CNE1 11:44:30-11:45:10): the outage is listed in
169 each report and not counted as gap, the own gap of CNE1 is. The IOD switch delays (after the
170 reception by BNC, BDS also after TOC) appear in all SSR QC cases.
171* `ssr_qc_bad_epoch`: `data/ssr_qc_bad_epoch_261122_10min.raw` (22 Nov 2026 00:10:30-00:21, cut
172 from the QC capture: BCEP00BKG0, SSRA00SHA1, SSRA00CNE1, SSRA00GMV0): SSRA00SHA1 sends a GLONASS
173 epoch 11758 s ahead; its 159 corrections are not used (counted in the report), the 5 min reports
174 continue normally.
[11220]175* `ssr_qc_has`: `data/merged_260930_11min.raw` with 31_SsrQC (SSRA00EUH0 Galileo HAS and
176 SSRA00CNE1): the HAS code biases keep their reference time 12876 s before reception and are
177 still evaluated (bias epochs are only rejected more than 900 s in the future).
[11148]178* `ssr_qc_glo_ln`: GLONASS health flag ln on `data/glo_ln_261015_1h.raw` (BCEP00BKG0 GLONASS
179 ephemerides 09:40-10:40 and SSRA00GMV0 GLONASS corrections 09:55-10:40 of 15 Oct 2026, merged
180 from two `bncraw.py slice` outputs; 'Ephemeris streams' BCEP00BKG0): the R14 data sets from
181 tb 13:15 Moscow time on have ln = 1 with Bn = 0, Cn = 1 and are unhealthy (ICD 5.1, 5.3).
[11212]182* `ssr_qc_phase_bias`: phase bias indicators and Melbourne-Wuebbena check on
183 `data/combi_multi_261002_5min.raw` (one MW epoch, 11:45): CHC1, CNE1, SHA1 (IGS-SSR) and NRC0
184 (old RTCM-SSR); MW consistency indicator 1 only for CNE1/NRC0, CNE1 vs NRC0 GPS 0.14 cycles
185 (G01 G04 G11 G23 G28 0.2-0.3 cycles, verified by hand from the decoded .ssr files), all other
186 pairs ~0.25 cycles; CNE1 BeiDou phase biases with integer indicator 0.
[11214]187* `ssr_qc_apc_com`: code biases of the APC stream SSRA00GMV0 vs. the CoM stream SSRC00GMV0 (old
188 RTCM-SSR) on `data/apc_com_gmv_261015_10min.raw` (with BCEP00BKG0, 15 Oct 2026 10:00-10:10,
189 `bncraw.py slice` of the QC capture), 'QC ANTEX File' igs20.atx: the GPS/Galileo/BDS biases of
190 the APC stream are shifted by the PCO differences z(f) - z(ref) (residuals 2/3/14 mm, verified
191 by hand from the decoded .ssr files: C06 C6I -0.42 m = z(B3I) - z(B1I)), GLONASS biases equal.
[11055]192
[11124]193* `decoder_limits`: crafted, CRC-valid frames from `tools/mkcrafted.py`
194 using the largest values the formats allow: VTEC with degree/order 16
195 (IGS-SSR 4076/201 and RTCM-SSR 1264, 2 and 4 layers) and RTCM 1300/1301/1302
196 with 31-character names, listed by the RTCM scan in the log. The
197 coefficients are C(d,o) = (100*d+o)/200 TECU and S = -C, both `.ssr` files
198 are identical apart from the station ID. These frames overflowed the
[11130]199 coefficient and name arrays; the 4-layer VTEC crashed BNC. Also two RTCM
200 1033: a complete one and one whose receiver descriptor length runs beyond
201 the message (rejected; before, stale buffer content was logged).
[11124]202
[11130]203* `rawfile_hostile`: raw file with hostile chunk headers from
204 `tools/mkcrafted.py --rawfile`: the station ID `../ESCAPE0` must give
205 `Output/.._ESCAPE0_*.ssr` (no file outside the output directory), a chunk
206 header announcing 2000000000 bytes is rejected with a log message.
207
[11124]208## Sanitizer check of the SSR decoders
209
210```
211tests/tools/ssr_harness.sh # crafted_limits.raw
212tests/tools/ssr_harness.sh tests/data/*.raw # real captures
213```
214
215In BNC all SSR target structs are members of one `RTCM3coDecoder` object,
216so a write beyond one struct corrupts the next member without any
217AddressSanitizer report. The harness decodes every frame with all three
218format classes into separately allocated structs, so ASan reports it. It
219also covers the new RTCM-SSR metadata (message 60 in
220`crafted_limits.raw`: 7 entries with additional parameters of 40 and 0 bits,
[11130]221and 31 entries, which must be rejected) and satellite antenna messages
222(BDS with mask bits in all four 16-bit quarters, GPS with shared blocks),
223which `RTCM3Decoder.cpp` does not dispatch at present. Every decoded VTEC, metadata and antenna message is
224encoded again with the `Make*` function of the same class and decoded once
225more; the result must be identical, for the antenna messages also the bytes. Exit code 0 only without sanitizer errors and
[11127]226differences.
[11124]227
[11127]228## TLS check
229
230```
231tests/tools/ssl_check.py [--bnc PATH]
232```
233
234Runs BNC against `tools/fakecaster.py` with TLS on port 443 (BNC uploads with
235Ntrip 2s always to 443) inside an unprivileged user and network namespace
236(`unshare -rn`), with a test CA, server and client certificates created by
237openssl in `work/ssl_check/`. Checks for upload and download: certificate of
238an unknown CA rejected, accepted with the CA in `sslCaCertPath`, accepted with
239`sslIgnoreErrors` and the ignored errors logged; for upload also a
240certificate for another host name (rejected) and a client certificate
241required by the caster, with and without `sslIgnoreErrors`. Takes about 3 min.
242
[11130]243## Network check
244
245```
246tests/tools/net_check.py [--bnc PATH]
247```
248
249Runs BNC live against fake servers on loopback addresses (no root needed).
250A second sender on another address sends spoofed datagrams to BNC's port: in
251the modes 'U' (Ntrip 2 UDP) and 'R' (RTSP/RTP) and in 'UN' with a sender
252address in the URL, BNC's raw output must contain only the server's data;
253'UN' with 127.0.0.1 accepts any sender, as before. An Ntrip 1 caster sending an endless
254response header is cut off, a normal Ntrip 1 stream still works. An upload
255answered with `HTTP/1.1 401` and a header containing `200` must be reported
256as broken. Takes about 2 min.
257
[11153]258## Credentials check
259
260```
261tests/tools/cred_check.py [--bnc PATH]
262```
263
264BNC against `tools/fakecaster.py --auth user:password` (other credentials
265rejected), each scenario with its own `HOME`: password in the configuration
266file (hint logged), `~/.netrc` with two users for the host, `$NETRC` with
267`machine host:port` preferred, BNC format file (`credentialsFile`) with exact
268port preferred over `*` and a quoted password, URL without user (no
269credentials sent), user without entry, `~/.netrc` readable for others and the
270netrc `default` entry (not used), Ntrip 1 download, Ntrip 2 upload and
271Ntrip 1 upload without user. Takes about 2 min.
272
[11055]273## Adding a replay case
274
275```
276tests/tools/bncraw.py info capture.raw
277tests/tools/bncraw.py slice capture.raw tests/data/new.raw --stations SSRA00XYZ0 \
278 --start 2026-09-28T12:00:00 --end 2026-09-28T12:03:00
279mkdir tests/cases/new && $EDITOR tests/cases/new/case.json # copy an ssr_* case
280tests/run_tests.py --update new
281```
282
283Before accepting a reference with `--update`, check it by hand; for decoder
284cases, hand-decode the raw bits. The reference records what BNC does, not what
285is correct.
286
287## Reproducibility of replays
288
289In batch post-processing (`--file`), BNC delivers decoded ephemerides and
290corrections synchronously to the PPP (`t_bncCore::decoderConnectionType`) and
291starts reading only after all PPP instances are connected
292(`t_pppThread::waitUntilReady`). Replays are therefore reproducible run to run,
293including PPP with ambiguity resolution. Live operation is not affected.
Note: See TracBrowser for help on using the repository browser.