diff --git a/engine/src/test/kotlin/io/flamenet/e2e/PublishedVectorsTest.kt b/engine/src/test/kotlin/io/flamenet/e2e/PublishedVectorsTest.kt index 8a4b554..2cc6de5 100644 --- a/engine/src/test/kotlin/io/flamenet/e2e/PublishedVectorsTest.kt +++ b/engine/src/test/kotlin/io/flamenet/e2e/PublishedVectorsTest.kt @@ -24,10 +24,30 @@ import kotlin.test.assertTrue class PublishedVectorsTest { private val vectors: JSONObject by lazy { - // From android/engine/ up to the repository root. - val file = File("../../engine/test/vectors/protocol-v1.json") - assertTrue(file.exists(), "published vectors not found at ${file.absolutePath}") - JSONObject(file.readText()) + // Where the vectors are depends on which checkout this is: android/ as a + // subtree of the app repo, or the extracted Android repo with + // flamenet-e2e cloned beside it. Resolved rather than assumed, because a + // hardcoded depth is how the harness stops testing anything. + // + // This FAILS rather than skips when it finds nothing, deliberately: the + // whole reason a third engine is worth writing is that it is checked + // against the published vectors, and one that quietly stops checking is + // worth less than no third engine at all. + val candidates = listOfNotNull( + System.getenv("FLAMENET_VECTORS"), + "../../engine/test/vectors/protocol-v1.json", // app repo subtree + "../../../flamenet-e2e/test/vectors/protocol-v1.json", // beside the engine repo + "../../flamenet-e2e/test/vectors/protocol-v1.json", + ).map { File(it) } + val file = candidates.firstOrNull { it.exists() } + assertTrue( + file != null, + "published vectors not found. Looked in: " + + candidates.joinToString(", ") { it.absolutePath } + + ". Clone https://gitlab.com/paulhitt/flamenet-e2e beside this repo, " + + "or set FLAMENET_VECTORS to protocol-v1.json.", + ) + JSONObject(file!!.readText()) } private fun JSONArray.bytesAt(i: Int) = Bytes.unb64(getString(i))