diff --git a/ShimmerAndroidInstrumentDriver/shimmerHilTest/src/androidTest/java/com/shimmerresearch/hiltest/HilScenariosTest.java b/ShimmerAndroidInstrumentDriver/shimmerHilTest/src/androidTest/java/com/shimmerresearch/hiltest/HilScenariosTest.java index bcd88f4..35252a0 100644 --- a/ShimmerAndroidInstrumentDriver/shimmerHilTest/src/androidTest/java/com/shimmerresearch/hiltest/HilScenariosTest.java +++ b/ShimmerAndroidInstrumentDriver/shimmerHilTest/src/androidTest/java/com/shimmerresearch/hiltest/HilScenariosTest.java @@ -273,9 +273,12 @@ public void midStreamSet() throws Exception { boolean started = session.startSdLogging(); report.check(started, "cycle " + i + ": startSDLogging did not complete: it threw, hung or was skipped after a hung call (see the events)"); if (started) { - report.check(session.waitFor(() -> session.state() == BT_STATE.STREAMING_AND_SDLOGGING, 5000), - "cycle " + i + ": SD logging did not start while streaming (state " + session.state() - + "; is there an SD card? With a link CRC on, DEV-1148)"); + boolean logging = session.waitFor(() -> session.state() == BT_STATE.STREAMING_AND_SDLOGGING, 5000); + report.check(logging, "cycle " + i + ": SD logging did not start while streaming (state " + session.state() + + "; is there an SD card? With a link CRC on, DEV-1148)"); + if (logging) { + sdMoments.add(session.nowMs()); + } } Thread.sleep(2000); sdMoments.add(session.nowMs()); @@ -310,7 +313,10 @@ public void midStreamSet() throws Exception { // Loss around SD logging start/stop is reported, not failed: with no parser error and // logging starting, the unit itself did not send those samples while it opened or closed // its file, which is firmware behaviour for the firmware HIL bench to judge. Loss around a - // battery read, or anywhere else, is the Android API's. + // battery read, or anywhere else, is the Android API's. A start counts from both the + // command and the unit confirming it: the unit pauses 0.35 to 0.71 s after it confirms, + // which is up to 1.17 s after the command on the first start (a Shimmer3 on LogAndStream + // v1.1.7), so a window around the command alone missed that pause. int[] attributed = a.attribute(new double[][] {toArray(sdMoments), toArray(batteryMoments)}, 1000); int nearSd = attributed[0]; int nearBattery = attributed[1]; @@ -412,9 +418,12 @@ public void inStream() throws Exception { sdMoments.add(session.nowMs()); report.check(session.stopSdLogging() && session.startSdLogging(), what + ": stopSDLogging or startSDLogging did not complete (see the events)"); - report.check(session.waitFor(() -> session.state() == BT_STATE.STREAMING_AND_SDLOGGING && session.queuedInstructions() == 0, 5000), - what + ": logging did not restart after a stop and a start back to back (state " + session.state() - + ", " + session.queuedInstructions() + " instructions queued)"); + boolean restarted = session.waitFor(() -> session.state() == BT_STATE.STREAMING_AND_SDLOGGING && session.queuedInstructions() == 0, 5000); + report.check(restarted, what + ": logging did not restart after a stop and a start back to back (state " + session.state() + + ", " + session.queuedInstructions() + " instructions queued)"); + if (restarted) { + sdMoments.add(session.nowMs()); + } } Thread.sleep(1000); sdMoments.add(session.nowMs()); @@ -540,6 +549,10 @@ private boolean startSdLoggingWhileStreaming(String what, List sdMoments boolean started = session.startSdLogging() && session.waitFor(() -> session.state() == BT_STATE.STREAMING_AND_SDLOGGING && session.queuedInstructions() == 0, 5000); report.check(started, what + ": SD logging did not start while streaming (state " + session.state() + "; is there an SD card?)"); + if (started) { + // as in midStreamSet, the unit pauses its stream up to 0.71 s after it confirms a start + sdMoments.add(session.nowMs()); + } return started; } diff --git a/tools/hil/README.md b/tools/hil/README.md index 53191e1..a36281e 100644 --- a/tools/hil/README.md +++ b/tools/hil/README.md @@ -53,7 +53,7 @@ To find regressions before release day, schedule step 2 nightly with Windows Tas | Scenario | What it does | Fails when | |---|---|---| | `streamRest` | Connects, writes an accel-only config at `-Rate` (default 256 Hz), streams for `-Seconds` (default 30) with the unit lying still, then stops and disconnects. | It can't connect or configure; more than `-MaxLossPercent` (1 %) of packets are lost; a timestamp doesn't increase, or leaps more than a second ahead of when it arrived (a bad unwrap, not loss); the timestamps give no rate, or one more than 1 % off the configured rate; the stream goes silent for over a second before the test stops it; accel is more than 1 m/s² from 9.81; or the API logs a "Packet syncing problem". | -| `midStreamSet` | While streaming, starts and stops SD logging and reads the battery, three times. | One of those calls fails, or a battery reply isn't decoded within 5 s; logging doesn't start or stop (the DEV-1148 symptom with a link CRC on); a packet is lost around a battery read, or more than `-MaxLossPercent` away from the SD transitions; the timestamps fail the same rate and silence checks as `streamRest`; or there's a parser error. Packets missing around SD logging start/stop are reported, not failed: the unit itself pauses while it opens its file, which is for the firmware HIL bench to judge. Needs an SD card in the unit, off the dock and USB. | +| `midStreamSet` | While streaming, starts and stops SD logging and reads the battery, three times. | One of those calls fails, or a battery reply isn't decoded within 5 s; logging doesn't start or stop (the DEV-1148 symptom with a link CRC on); a packet is lost around a battery read, or more than `-MaxLossPercent` away from the SD transitions; the timestamps fail the same rate and silence checks as `streamRest`; or there's a parser error. Packets missing within 1 s of an SD logging start or stop are reported, not failed: the unit itself pauses while it opens its file, which is for the firmware HIL bench to judge. A start counts from both the command and the unit confirming it (here and in `inStream`): the pause comes up to 0.71 s after the confirmation, which can be more than 1 s after the command. Needs an SD card in the unit, off the dock and USB. | | `reconnectLoop` | Connects, streams for 5 s and disconnects, five times. | Any cycle fails to connect within 30 s, loses packets, fails the rate and silence checks, or logs a parser error. | | `inStream` | While streaming, three times: starts SD logging, stops it, and reads the battery and the status every 40 ms for 400 ms, so some reads land in the ~100 ms the unit pauses its data packets while it closes its file (DEV-1291). Then, three times, stops and starts logging back to back, so the queued start goes out in that pause. | A battery read isn't answered, or fewer status replies than reads are decoded; logging doesn't stop or restart, or a command stays queued; a command times out; there's a parser error; more than `-MaxLossPercent` of packets are lost away from the SD transitions and the reads; or the timestamps fail the same rate and silence checks as `streamRest`. Loss near the reads is reported, not failed: a Shimmer3 now and then skips a sample around a battery read itself. The report's `repliesInAPause` counts the replies that came with no data packet before them. Needs an SD card in the unit, off the dock and USB. | | `connectReady` | Connects to the unit idle, starts SD logging, disconnects and connects again while it logs, then stops logging. | The unit is reported ready (a CONNECTED or SDLOGGING state message, or that state in the API) more than 250 ms before `NOTIFICATION_SHIMMER_FULLY_INITIALIZED`, which marks the end of the connect sequence (DEV-1275); or the connect doesn't end in CONNECTED, or SDLOGGING while logging. Needs an SD card in the unit, off the dock and USB. |