Skip to content

DEV-1305: Java HIL rollover, idleStart and samplingRates scenarios - #336

Merged
JongChern merged 1 commit into
masterfrom
DEV-1305_java_hil_parity
Oct 23, 2026
Merged

JongChern merged 1 commit into
masterfrom
DEV-1305_java_hil_parity

Conversation

@JongChern

@JongChern JongChern commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

DEV-1305. The Java, C# and shimmer-logandstream HILs check the same firmware on the same bench, but each grew its own scenarios, so a defect one finds can go unchecked in another API. This adds the three the Java HIL lacked that one of the other two already runs. Companion PRs add the C# and shimmer-logandstream gaps: ShimmerResearch/Shimmer-C-API#222 and ShimmerResearch/shimmer-host-core#10.

samplingRates fails on master, because it found a driver bug (below). Until the driver is fixed, a -Report run, which needs every scenario to pass, will fail.

New scenarios

Scenario What it does Fails when
rollover Configures as streamRest does, then streams 600 s (hil.rolloverSeconds), across the 512 s wrap of the 3-byte timestamp. As the C# HIL's stream.rollover does. streamRest's checks, a parser error or command timeout, a lost link, or a raw counter that never wraps. The report records counterWraps
idleStart Configures, idles 60 s (hil.idleSeconds) with the driver's timers on, then streams 10 s. As C#'s link.idle_start and shimmer-logandstream's classic.idle_start do. A lost link, command timeout or parser error during the wait; streaming starting more than 500 ms after startStreaming(); or streamRest's checks. The report records startMs and statusRequestsWhileIdle
samplingRates Writes 51.2, 256 and 512 Hz in turn through configureAccelOnly (the Consensys path), streams 5 s at each, then writes the unit's own rate back. As shimmer-logandstream's config.sampling_rate does. A write doesn't take within 20 s, a stream fails the checks at its rate, or the unit's own rate isn't written back

All three use the watchdog and the DEV-1275 connect check. run-java-hil.ps1 runs all eight scenarios by default, and -Report requires all eight. TimestampWraps, the wrap counter, is unit-tested in CI.

On the bench

Run on a Shimmer3 (LogAndStream 1.1.7, RN4678) and a Shimmer3R (LogAndStream 1.1.22) over Classic:

Shimmer3 Shimmer3R
rollover pass: 600 s, 1 wrap pass: 600 s, 1 wrap
idleStart pass: streaming 254 ms after the call, 11 status requests while idle pass: 270 ms, 11 status requests
samplingRates fail: 256 Hz not written fail: the same

At 512 Hz, the Shimmer3 lost 5 samples in 2 gaps (0.20 %), and the Shimmer3R lost none. The C# and shimmer-logandstream HILs also see the Shimmer3 lose samples over Classic at 512 Hz, so that loss is the unit's own.

The bug samplingRates found

A configuration written straight after stopStreaming() loses its first InfoMem chunk.

  • What gets lost: the configuration goes as three 128-byte SET_INFOMEM_COMMANDs, and the first one holds the sampling rate.
  • When: the scenario stops streaming, then configures the next rate. That is the order an app or script would use.
  • What the driver log shows: the first chunk is never transmitted. The configure operation starts at progress counter 2, and the unit keeps its old rate.
  • How consistent: on both units, every configure queued in the ~400 ms before the stop's ACK lost chunk 0 (4 of 4). Every configure made on a quiet link sent it (4 of 4).
  • The likely cause: ShimmerBluetooth's handling of the stop's ACK while streaming (about line 845). It ends with removeInstruction(0), and by then the head of the instruction list is the first chunk queued after the stop.

This PR changes test code only and leaves the driver alone. A side effect on the bench: the failed write-back left both units at 512 Hz, until they were reconfigured.

🤖 Generated with Claude Code

Three checks the C# and shimmer-logandstream HILs already run on the same bench:

- rollover: streams 10 minutes, past the 512 s wrap of the unit's 3-byte timestamp counter, and
  fails on streamRest's checks or if the raw counter never wrapped. TimestampWraps counts the wraps
  from the TIMESTAMP channel's raw ticks, which HilSession now records with each sample.
- idleStart: leaves the link idle 60 s with the driver's timers on, then fails if the link was lost
  or a command timed out during the wait, if streaming starts more than 500 ms after
  startStreaming(), or on the stream checks.
- samplingRates: writes 51.2, 256 and 512 Hz in turn the Consensys way, streams 5 s at each and
  checks the rate, then writes the unit's own rate back.

run-java-hil.ps1 runs all eight scenarios by default, so -Report requires the new ones too.
TimestampWrapsTest runs in CI. No driver code changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JongChern
JongChern merged commit 86ab651 into master Oct 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant