|
12 | 12 | import java.util.Comparator; |
13 | 13 | import java.util.List; |
14 | 14 |
|
15 | | -import org.junit.Assume; |
16 | 15 | import org.junit.Test; |
17 | 16 |
|
18 | 17 | import com.shimmerresearch.driver.FormatCluster; |
19 | 18 | import com.shimmerresearch.driver.ObjectCluster; |
20 | 19 |
|
21 | 20 | /** |
22 | | - * Keeps the Shimmer3 decode references of the Rust core ({@code ShimmerProtocolCore/tests/data/}) |
23 | | - * in step with the Java decoder (DEV-1134). The recorded Shimmer3 carries its own calibration and |
| 21 | + * Keeps the Shimmer3 decode references of the protocol core (the shimmer-protocol-core |
| 22 | + * repository's {@code tests/data/}) in step with the Java decoder (DEV-1134). The recorded Shimmer3 carries its own calibration and |
24 | 23 | * the newer sensors, so its replay never exercises a Shimmer3's default calibrations, the older |
25 | 24 | * sensors (KXRB5-2042, MPU9150, LSM303DLHC) or a calibration dump. Each case here takes the |
26 | 25 | * recorded device's config bytes with InfoMem calibration blanked, gives it an expansion board |
27 | 26 | * and a calibration dump, and decodes synthetic packets that also carry temperature and pressure, |
28 | 27 | * whose sizes differ from a Shimmer3R's. Each file holds the inputs as hex and every channel of |
29 | 28 | * every decoded packet. |
30 | 29 | * <p> |
31 | | - * Fails if a file is stale. The current output is always written to |
32 | | - * {@code build/rust-reference/}; copy it over the stale one. Skipped once the Rust core has moved |
33 | | - * out of this repository. |
| 30 | + * The current output is always written to {@code build/rust-reference/}. Where the team's layout |
| 31 | + * puts a checkout of shimmer-protocol-core beside this repository's ({@code C:\dev\} holding both |
| 32 | + * {@code java\Shimmer-Java-Android-API} and {@code shimmer-protocol-core}), this fails if the |
| 33 | + * files there are stale: copy the current output over them. Without that checkout, as in CI, only |
| 34 | + * the output is written. |
34 | 35 | */ |
35 | 36 | public class API_00031_Shimmer3DecodeReferenceTest { |
36 | 37 |
|
37 | | - private static final File DATA = new File("../ShimmerProtocolCore/tests/data"); |
| 38 | + private static final File DATA = new File("../../../shimmer-protocol-core/tests/data"); |
38 | 39 | private static final File CURRENT = new File("build/rust-reference"); |
39 | 40 |
|
40 | 41 | private static final int ANALOG_ACCEL = 2, MPU9X50_GYRO = 30, LSM303_MAG = 32; |
@@ -70,7 +71,6 @@ public void newerSensorsWithACalibrationDump() throws Exception { |
70 | 71 | } |
71 | 72 |
|
72 | 73 | private static void check(String name, byte[] expansionBoard, byte[] dump) throws Exception { |
73 | | - Assume.assumeTrue("the Rust core is not in this repository", DATA.getParentFile().isDirectory()); |
74 | 74 | LogAndStreamProtocol recorded = new LogAndStreamProtocol(); |
75 | 75 | ProtocolReplay.run(recorded, RecordedSession.load(API_00027_LogAndStreamProtocolMatchesDriverTest.SHIMMER3_SESSION)); |
76 | 76 | byte[] config = recorded.getDeviceModel().getShimmerInfoMemBytesOriginal().clone(); |
@@ -137,6 +137,9 @@ private static void check(String name, byte[] expansionBoard, byte[] dump) throw |
137 | 137 | current.getParentFile().mkdirs(); |
138 | 138 | Files.write(current.toPath(), text.getBytes(StandardCharsets.UTF_8)); |
139 | 139 |
|
| 140 | + if (!DATA.isDirectory()) { |
| 141 | + return; // no shimmer-protocol-core checkout beside this one |
| 142 | + } |
140 | 143 | // git may have checked the file out with CRLF line endings. |
141 | 144 | String committed = reference.isFile() |
142 | 145 | ? new String(Files.readAllBytes(reference.toPath()), StandardCharsets.UTF_8).replace("\r\n", "\n") |
|
0 commit comments