Changeset 11060 in ntrip


Ignore:
Timestamp:
Oct 1, 2026, 5:35:37 PM (3 hours ago)
Author:
stuerze
Message:

another test is added

Location:
trunk/BNC
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/upload/bncrawuploadcaster.cpp

    r10753 r11060  
    7373
    7474    if (_casters.contains(QString(staID))) {
    75       _casters[QString(staID)]->setOutBuffer(data);
     75      _casters[QString(staID)]->appendOutBuffer(data);
    7676    }
    7777}
  • trunk/BNC/src/upload/bncuploadcaster.h

    r9795 r11060  
    2424    QMutexLocker locker(&_mutex);
    2525    _outBuffer = outBuffer;
     26  }
     27  // Append data for streams forwarded chunk by chunk (raw upload): several
     28  // chunks may arrive between two sends of the upload thread (every 0.1 s)
     29  void appendOutBuffer(const QByteArray& data) {
     30    QMutexLocker locker(&_mutex);
     31    _outBuffer += data;
    2632  }
    2733
  • trunk/BNC/tests/README.md

    r11059 r11060  
    2525| `cases/<name>/expected/*.gz` | normalised reference outputs |
    2626| `data/*.raw` | short raw captures (BNC `rawOutFile` format) replayed via `--file` |
     27| `tools/fakecaster.py` | local Ntrip caster recording an upload as a BNC raw file (case key `fakecaster`) |
    2728| `tools/bncraw.py` | `info` (streams, time span, RTCM3 message types) and `slice` for raw captures |
    2829| `work/` | scratch output, not versioned |
    … …  
    5960  (SSRA00BKG1, SSRA00CNE1, BCEP00BKG0, FFMJ00DEU0), upload to the caster
    6061  disabled, SP3/CLK written to files.
     62* Upload (`upload_*`; 16, 19, 20) from `data/upload_rtnet_5min.raw` (RTNET engine
     63  output + BCEP00BKG0): BNC uploads to a local fake caster
     64  (`tools/fakecaster.py`, Ntrip 1/2, chunked), and a `post` step decodes the
     65  received stream again: `upload_rtnet` (IGS-SSR encoding, SP3/CLK/BIA files,
     66  decoded `.ssr`), `upload_eph` (RTCM3 ephemerides to RINEX nav) and
     67  `upload_raw` (raw forwarding to RINEX nav).
    6168* SSR decoding (`ssr_*`): 3 min slices of real streams replayed through
    6269  `03_BrdcCorr.bnc`. They compare the `.ssr` files and the `BNC_DEBUG_SSR`
  • trunk/BNC/tests/run_tests.py

    r11055 r11060  
    2424                 debug_trace  true for BNC_DEBUG_SSR stderr traces: reported as
    2525                            SKIP instead of FAIL if the build has no trace output
     26  fakecaster   optional local Ntrip caster for an upload during the run:
     27               {"port", "out" (raw file, relative to the work dir), "sta",
     28                "time" (epoch stamped on the raw file), "timeout"}
     29  post         optional list of further BNC runs after the main run, each
     30               {"dir" (subdirectory of the work dir), "config", "raw"
     31                (relative to the work dir), "args", "exit_code", "timeout"};
     32               outputs may refer to their files as "<dir>/Output/..."
    2633
    2734BNC runs in tests/work/<name>/, which contains an "Input" symlink to
    … …  
    146153
    147154
     155def run_bnc(bnc, workdir, spec, rawBase):
     156    """Run BNC once in workdir (created with Input link and Output dir); spec
     157    holds config, optional raw (relative to tests/, or to rawBase if given),
     158    args and timeout. Returns the exit code or None on timeout."""
     159    os.makedirs(os.path.join(workdir, "Output"), exist_ok=True)
     160    if not os.path.exists(os.path.join(workdir, "Input")):
     161        os.symlink(os.path.join(ROOT, "Example_Configs", "Input"), os.path.join(workdir, "Input"))
     162    cmd = [bnc, "--nw", "--platform", "offscreen", "--conf", resolve(ROOT, spec["config"])]
     163    if spec.get("raw"):
     164        cmd += ["--file", resolve(rawBase or TESTS, spec["raw"])]
     165    cmd += spec.get("args", [])
     166    env = dict(os.environ, QT_QPA_PLATFORM="offscreen", LC_ALL="C", TZ="UTC")
     167    with open(os.path.join(workdir, "stdout.txt"), "wb") as out, \
     168         open(os.path.join(workdir, "stderr.txt"), "wb") as err:
     169        try:
     170            code = subprocess.run(cmd, cwd=workdir, stdout=out, stderr=err, env=env,
     171                                  timeout=spec.get("timeout", 600)).returncode
     172        except subprocess.TimeoutExpired:
     173            code = None
     174    with open(os.path.join(workdir, "command.txt"), "w") as f:
     175        f.write(" ".join(cmd) + "\n")
     176    return code
     177
     178
    148179def run_case(name, bnc, update):
    149180    res = Result(name)
    … …  
    153184
    154185    shutil.rmtree(work, ignore_errors=True)
    155     os.makedirs(os.path.join(work, "Output"))
    156     os.symlink(os.path.join(ROOT, "Example_Configs", "Input"), os.path.join(work, "Input"))
    157 
    158     cmd = [bnc, "--nw", "--platform", "offscreen",
    159            "--conf", resolve(ROOT, case["config"])]
    160     if case.get("raw"):
    161         cmd += ["--file", resolve(TESTS, case["raw"])]
    162     cmd += case.get("args", [])
    163 
    164     env = dict(os.environ, QT_QPA_PLATFORM="offscreen", LC_ALL="C", TZ="UTC")
    165186    t0 = time.time()
    166     with open(os.path.join(work, "stdout.txt"), "wb") as out, \
    167          open(os.path.join(work, "stderr.txt"), "wb") as err:
     187
     188    # Optional local Ntrip caster receiving an upload (see tools/fakecaster.py)
     189    fc = case.get("fakecaster")
     190    fcProc = None
     191    if fc:
     192        os.makedirs(os.path.join(work, "Output"))
     193        fcProc = subprocess.Popen(
     194            [sys.executable, os.path.join(TESTS, "tools", "fakecaster.py"),
     195             "--port", str(fc["port"]), "--out", os.path.join(work, fc["out"]),
     196             "--sta", fc.get("sta", "CLOCK"), "--time", fc["time"],
     197             "--timeout", str(fc.get("timeout", 10))],
     198            stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
     199        fcProc.stdout.readline()  # "listening"
     200
     201    code = run_bnc(bnc, work, case, "")
     202    if fcProc:
    168203        try:
    169             proc = subprocess.run(cmd, cwd=work, stdout=out, stderr=err, env=env,
    170                                   timeout=case.get("timeout", 600))
    171             code = proc.returncode
     204            fcProc.communicate(timeout=fc.get("timeout", 10) + 60)
    172205        except subprocess.TimeoutExpired:
    173             code = None
    174     res.seconds = time.time() - t0
    175     with open(os.path.join(work, "command.txt"), "w") as f:
    176         f.write(" ".join(cmd) + "\n")
     206            fcProc.kill()
     207            res.fail("fake caster did not finish")
    177208
    178209    if code is None:
    … …  
    181212    if code != case.get("exit_code", 0):
    182213        res.fail("exit code %d, expected %d" % (code, case.get("exit_code", 0)))
     214
     215    # Optional further BNC runs, e.g. decoding the uploaded stream; each runs
     216    # in its own subdirectory of the work directory, raw relative to work/
     217    for post in case.get("post", []):
     218        pcode = run_bnc(bnc, os.path.join(work, post["dir"]), post, work)
     219        if pcode is None or pcode != post.get("exit_code", 0):
     220            res.fail("post step %s: exit code %s" % (post["dir"], pcode))
     221    res.seconds = time.time() - t0
    183222
    184223    # Collect (reference name, actual file, spec) triples
Note: See TracChangeset for help on using the changeset viewer.