From 5f980cc3c37957fc3b679e355d88e7db964c3215 Mon Sep 17 00:00:00 2001 From: Kinflou Date: Sun, 1 Nov 2026 02:39:14 +0800 Subject: [PATCH 1/2] conformance: run an encoding's implementation against its package's vectors `comline conformance --impl ""` runs a process speaking the conformance ops protocol (as comline-reference does) against the vectors each declared encoding ships beside its profile (`profiles/x.json` -> `profiles/x.vectors.json`), or, with `--corpus`, a runtime-style corpus for the official encodings. It reports which profile facts are proven and which cases failed, with byte diffs, and exits 1 on any failure. The process runs once, through the external generators' runner: cleared environment, time limit, capped output. The runner itself is ComlineProject/runtime's comline-runtime-conformance, pinned by git rev. Closes #106 --- .github/workflows/ci.yml | 2 + Cargo.lock | 291 +++++++++++ Cargo.toml | 3 + README.md | 1 + docs/cli.md | 73 +++ src/cli.rs | 41 ++ src/commands/conformance.rs | 408 +++++++++++++++ src/commands/mod.rs | 1 + src/external.rs | 10 +- src/main.rs | 12 + tests/cli/conformance.rs | 180 +++++++ tests/cli/main.rs | 1 + tests/fixtures/conformance/Cargo.lock | 491 ++++++++++++++++++ tests/fixtures/conformance/Cargo.toml | 16 + tests/fixtures/conformance/src/bin/flipper.rs | 29 ++ tests/fixtures/conformance/src/bin/lines.rs | 118 +++++ .../fixtures/conformance/src/bin/reference.rs | 5 + tests/fixtures/conformance_package/config.idp | 9 + .../conformance_package/profiles/lines.json | 8 + .../profiles/lines.vectors.json | 69 +++ .../fixtures/conformance_package/src/api.ids | 3 + 21 files changed, 1767 insertions(+), 4 deletions(-) create mode 100644 src/commands/conformance.rs create mode 100644 tests/cli/conformance.rs create mode 100644 tests/fixtures/conformance/Cargo.lock create mode 100644 tests/fixtures/conformance/Cargo.toml create mode 100644 tests/fixtures/conformance/src/bin/flipper.rs create mode 100644 tests/fixtures/conformance/src/bin/lines.rs create mode 100644 tests/fixtures/conformance/src/bin/reference.rs create mode 100644 tests/fixtures/conformance_package/config.idp create mode 100644 tests/fixtures/conformance_package/profiles/lines.json create mode 100644 tests/fixtures/conformance_package/profiles/lines.vectors.json create mode 100644 tests/fixtures/conformance_package/src/api.ids diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca68719..faca40a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,3 +43,5 @@ jobs: run: cargo clippy --all-targets --no-default-features --features gen-rust,gen-typescript -- -D warnings - name: rustfmt (fixture generators) run: cargo fmt --check --manifest-path tests/fixtures/generators/Cargo.toml + - name: rustfmt (fixture conformance implementations) + run: cargo fmt --check --manifest-path tests/fixtures/conformance/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index d52bdab..40f9aff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,54 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "abi_stable" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d6512d3eb05ffe5004c59c206de7f99c34951504056ce23fc953842f12c445" +dependencies = [ + "abi_stable_derive", + "abi_stable_shared", + "const_panic", + "core_extensions", + "crossbeam-channel", + "generational-arena", + "libloading 0.7.4", + "lock_api", + "parking_lot", + "paste", + "repr_offset", + "rustc_version", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "abi_stable_derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7178468b407a4ee10e881bc7a328a65e739f0863615cca4429d43916b05e898" +dependencies = [ + "abi_stable_shared", + "as_derive_utils", + "core_extensions", + "proc-macro2", + "quote", + "rustc_version", + "syn 1.0.109", + "typed-arena", +] + +[[package]] +name = "abi_stable_shared" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b5df7688c123e63f4d4d649cba63f2967ba7f7861b1664fca3f77d3dad2b63" +dependencies = [ + "core_extensions", +] + [[package]] name = "addr2line" version = "0.25.1" @@ -153,6 +201,18 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +[[package]] +name = "as_derive_utils" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff3c96645900a44cf11941c111bd08a6573b0e2f9f69bc9264b179d8fae753c4" +dependencies = [ + "core_extensions", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "assert_cmd" version = "2.1.2" @@ -264,6 +324,26 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + [[package]] name = "bytes" version = "1.12.1" @@ -460,6 +540,7 @@ dependencies = [ "comline-codegen-rust", "comline-codegen-typescript", "comline-core", + "comline-runtime-conformance", "eyre", "indicatif", "libc", @@ -542,6 +623,30 @@ name = "comline-core-stdlib" version = "0.1.0" source = "git+https://github.com/ComlineProject/core?rev=98d64faedfc48ab4d2c93722e2b099debedd503c#98d64faedfc48ab4d2c93722e2b099debedd503c" +[[package]] +name = "comline-runtime" +version = "0.1.0" +source = "git+https://github.com/ComlineProject/runtime?rev=3a9b600ad971fc05ce5a64d00ff1c23a21406659#3a9b600ad971fc05ce5a64d00ff1c23a21406659" +dependencies = [ + "abi_stable", + "bytemuck", + "libloading 0.8.9", + "rmp", + "rmp-serde", + "serde", + "serde_json", +] + +[[package]] +name = "comline-runtime-conformance" +version = "0.1.0" +source = "git+https://github.com/ComlineProject/runtime?rev=3a9b600ad971fc05ce5a64d00ff1c23a21406659#3a9b600ad971fc05ce5a64d00ff1c23a21406659" +dependencies = [ + "comline-runtime", + "serde", + "serde_json", +] + [[package]] name = "concolor" version = "0.1.1" @@ -575,6 +680,15 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "const_panic" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9603f79528ece8163c496f8932121cb36cfe46259e9c907bb3d8205139d7caa3" +dependencies = [ + "typewit", +] + [[package]] name = "constant_time_eq" version = "0.4.2" @@ -587,6 +701,21 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" +[[package]] +name = "core_extensions" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42bb5e5d0269fd4f739ea6cedaf29c16d81c27a7ce7582008e90eb50dcd57003" +dependencies = [ + "core_extensions_proc_macros", +] + +[[package]] +name = "core_extensions_proc_macros" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "533d38ecd2709b7608fb8e18e4504deb99e9a72879e6aa66373a76d8dc4259ea" + [[package]] name = "cpp_demangle" version = "0.5.1" @@ -1039,6 +1168,15 @@ dependencies = [ "slab", ] +[[package]] +name = "generational-arena" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877e94aff08e743b651baaea359664321055749b398adff8740a7399af7796e7" +dependencies = [ + "cfg-if", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -1456,6 +1594,26 @@ version = "0.2.191" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + [[package]] name = "libm" version = "0.2.16" @@ -1474,6 +1632,15 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.29" @@ -1701,6 +1868,35 @@ version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "percent-encoding" version = "2.3.2" @@ -1893,6 +2089,15 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.1", +] + [[package]] name = "regalloc2" version = "0.15.2" @@ -1937,6 +2142,34 @@ version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +[[package]] +name = "repr_offset" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb1070755bd29dffc19d0971cab794e607839ba2ef4b69a9e6fbc8733c1b72ea" +dependencies = [ + "tstr", +] + +[[package]] +name = "rmp" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ba8be72d372b2c9b35542551678538b562e7cf86c3315773cae48dfbfe7790c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "rmp-serde" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f81bee8c8ef9b577d1681a70ebbc962c232461e397b22c208c43c04b67a155" +dependencies = [ + "rmp", + "serde", +] + [[package]] name = "roff" version = "1.1.1" @@ -2004,6 +2237,15 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "1.1.6" @@ -2606,18 +2848,45 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae62f7eae5eb549c71b76658648b72cc6111f2d87d24a1e31fa907f4943e3ce" +[[package]] +name = "tstr" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8e0294f14baae476d0dd0a2d780b2e24d66e349a9de876f5126777a37bdba7" +dependencies = [ + "tstr_proc_macros", +] + +[[package]] +name = "tstr_proc_macros" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78122066b0cb818b8afd08f7ed22f7fdbc3e90815035726f0840d0d26c0747a" + [[package]] name = "twox-hash" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c" +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + [[package]] name = "typenum" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +[[package]] +name = "typewit" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "214ca0b2191785cbc06209b9ca1861e048e39b5ba33574b3cedd58363d5bb5f6" + [[package]] name = "ucd-trie" version = "0.1.7" @@ -3109,6 +3378,22 @@ dependencies = [ "wiggle-generate", ] +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + [[package]] name = "winapi-util" version = "0.1.11" @@ -3118,6 +3403,12 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + [[package]] name = "windows-link" version = "0.2.1" diff --git a/Cargo.toml b/Cargo.toml index 01eb205..6ded5bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,6 +41,9 @@ comline-core = { git = "https://github.com/ComlineProject/core", rev = "98d64fae comline-codegen = { git = "https://github.com/ComlineProject/generation", rev = "b116831182c32e70fb4452ff9fce4b463ce4bd99" } comline-codegen-rust = { git = "https://github.com/ComlineProject/comline-rust", rev = "0e5c60ebdfab9cd172f23691a18084d651bfb33a", optional = true } comline-codegen-typescript = { git = "https://github.com/ComlineProject/comline-typescript", rev = "765fc2d1177d0044498b00160000ac5084540af2", optional = true } +# `comline conformance`: the conformance runner (corpus loading, judging, +# profile proofs) and its case format, a public spec. Pinned by git rev. +comline-runtime-conformance = { git = "https://github.com/ComlineProject/runtime", rev = "3a9b600ad971fc05ce5a64d00ff1c23a21406659" } # Runs a `generator = ".wasm"` target (see src/external.rs): no # preopened directories, no environment, no network. Exact pins, bumped # together. diff --git a/README.md b/README.md index b4bfa2e..96ca8f8 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ comline generate # write generated code for each configured target | `comline build [--release] [--watch]` | Compile, validate, and freeze a new immutable version into `.comline/`. Prints the changelog and the version bump. | | `comline generate [--target ] [--out ] [--layout ] [--mode ] [--watch]` | Validate (no freeze), then write generated code. Output location/layout come from `comline.toml` `[generate]`; targets from there or `config.idp`. | | `comline diff ` | Show the schema changes between two built versions. Each argument is a version (`0.2.0`), a commit hash, or `HEAD` (the default for ``). | +| `comline conformance --impl [--encoding ] [--corpus ]` | Run an encoding's implementation (a process speaking the conformance ops protocol) against the vectors its package ships beside each profile (`profiles/x.json` → `profiles/x.vectors.json`). Reports proven facts and failed cases with byte diffs; exits `1` on any failure. | | `comline clean [--dry-run]` | Remove the `generate` output (the output root, or the individual files). Leaves `.comline/` alone. | | `comline reset [--force] [--dry-run]` | Discard the version history: delete `.comline/` and generated code. Asks for confirmation on a terminal; needs `--force` otherwise. No undo — the next build restarts at `0.0.1`. | | `comline completions ` | Print a shell completion script to stdout. | diff --git a/docs/cli.md b/docs/cli.md index c196936..428c41f 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -19,6 +19,7 @@ This is the long-form reference. For a two-minute tour see the - [`build`](#comline-build) - [`generate`](#comline-generate) - [`diff`](#comline-diff) + - [`conformance`](#comline-conformance) - [`clean`](#comline-clean) - [`reset`](#comline-reset) - [`completions`](#comline-completions) @@ -373,6 +374,78 @@ comline diff 0.0.1 HEAD Fails with exit `2` if the project has never been built, and exit `1` if an argument matches no stored version (the error lists the versions that exist). +### `comline conformance` + +``` +comline conformance --impl "" [--encoding ]... [--corpus ] [--timeout ] +``` + +Run an implementation of an encoding against its vectors, the way the +official runtimes are proven against the official corpus. A package that +declares an encoding under `encodings` in `config.idp` ships its vectors +**beside its profile**: the profile's path with `.json` replaced by +`.vectors.json`. + +``` +encodings = { + "com.acme.lines@1" = { kind = "framing" profile = "profiles/lines.json" } +} +``` + +``` +profiles/lines.json the profile: facts, each naming the cases that prove it +profiles/lines.vectors.json the vectors: {"feature": ..., "cases": [...]} +``` + +The vectors file and the profile are in the conformance corpus's case +format, a public spec (version 0.1, early days), documented in +ComlineProject/runtime's `runtime/conformance/README.md`. Every case in the +file is run, and each profile fact's `proven_by` names cases in it. + +The implementation is a process speaking the conformance **ops protocol**, +as `comline-reference` does: newline-delimited JSON requests on stdin, one +reply line each on stdout, exit 0 when stdin ends. Its `version` reply lists +the encodings it implements under `formats` and `framings`. It runs once, +with every question sent up front (a case's questions never depend on the +answers), under the same rules as an external generator: a cleared +environment, a time limit (`--timeout`, 60 seconds by default) and a capped +stdout; its stderr is shown, prefixed with its name. The command line is +split on whitespace (no shell quoting); a bare program name is looked up on +`PATH`. + +The report, on stderr, gives per encoding the cases that pass, each profile +fact as proven or not (and why), and each failed case, an encode with a +byte diff: + +``` +com.acme.lines@1 (framing): 4/5 case(s) pass + proven calls: by_name +error unproven errors: by_ordinal — case `lines/error` failed +error lines/error failed: encodes wrong: + expected: 455252203720322036653666 + got: 455252203720332036653666 + ^^ byte 6 differs +``` + +A failed case, a case the implementation reports as not implemented, or an +unproven fact makes the exit code `1`. + +- `--impl `: the implementation. +- `--encoding `: only this encoding (repeatable). Default: every + encoding the package declares. +- `--corpus `: run a corpus laid out like ComlineProject/runtime's + `runtime/conformance` (`profiles/.json`, `vectors/*.json`) instead + of the package's declarations: the official encodings (`packed@1`, + `datagram@2`, ...), whose vectors live there. Each encoding runs every + case of the features its profile's facts name. +- `--timeout `: how long the implementation may take for all the + cases together. + +```bash +comline conformance --impl ./target/release/acme-lines-conformance +comline conformance --impl comline-reference --corpus ../runtime/runtime/conformance --encoding packed@1 +``` + ### `comline clean` ``` diff --git a/src/cli.rs b/src/cli.rs index f082933..126329b 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -321,6 +321,47 @@ Examples: yes: bool, }, + /// Run an encoding's implementation against its vectors + #[command(long_about = "\ +Run an implementation of the package's encodings against the vectors they \ +ship, the way the official runtimes are proven against the official corpus. \ +Each encoding declared under `encodings` in config.idp ships its vectors \ +beside its profile: `profiles/lines.json` has `profiles/lines.vectors.json`, \ +in the conformance corpus's case format. + +The implementation is a process speaking the conformance ops protocol (as \ +`comline-reference` does): request lines on stdin, a reply line each on \ +stdout, exit when stdin ends. It runs once, with a cleared environment, a \ +time limit and an output cap. The report says which profile facts are \ +proven and which cases failed, with byte diffs; the exit code is 1 on any \ +failure. + +`--corpus` runs a corpus laid out like ComlineProject/runtime's \ +`runtime/conformance` (`profiles/`, `vectors/`) instead, for the official \ +encodings. + +Examples: + comline conformance --impl ./target/release/acme-lines-conformance + comline conformance --impl \"node conformance.js\" --encoding com.acme.lines@1 + comline conformance --impl comline-reference --corpus runtime/conformance --encoding packed@1")] + Conformance { + /// The implementation's command line: a program and its arguments, split on whitespace + #[arg(long = "impl", value_name = "COMMAND")] + implementation: String, + + /// Only this encoding (repeatable); default: every encoding the package declares + #[arg(long, value_name = "NAME")] + encoding: Vec, + + /// Run a runtime-style corpus directory (profiles/, vectors/) instead of the package's encodings + #[arg(long, value_name = "DIR")] + corpus: Option, + + /// Seconds the implementation may take for every case together [default: 60] + #[arg(long, value_name = "SECS")] + timeout: Option, + }, + /// Print a shell completion script to stdout #[command(long_about = "\ Write a completion script for the given shell to stdout. diff --git a/src/commands/conformance.rs b/src/commands/conformance.rs new file mode 100644 index 0000000..81fee61 --- /dev/null +++ b/src/commands/conformance.rs @@ -0,0 +1,408 @@ +//! `comline conformance --impl ""`: an encoding's +//! implementation, run against the vectors its package ships, the way the +//! official runtimes are proven against the official corpus. +//! +//! **Where the vectors are:** an encoding declared in `config.idp`'s +//! `encodings` with `profile = "profiles/lines.json"` ships its vectors +//! beside the profile, at `profiles/lines.vectors.json`: the profile's path +//! with `.json` replaced by `.vectors.json`. The file is a corpus vectors +//! file (`{"feature": ..., "cases": [...]}`), in the conformance spec's case +//! format (ComlineProject/runtime `runtime/conformance/README.md`). Every +//! case in it is run, and the profile's `proven_by` names cases in it. +//! +//! **The official encodings** (`packed@1`, ...) aren't declared by a package +//! and their vectors live in the runtime's corpus: `--corpus ` runs a +//! corpus laid out like `runtime/conformance` (`profiles/.json`, +//! `vectors/*.json`) instead of the package's declarations. +//! +//! **The implementation** is a process speaking the ops protocol, as +//! `comline-reference` does: request lines on stdin, a reply line each on +//! stdout, exit when stdin ends. It's run once, through the same runner as +//! external generators ([`crate::external::native`]): a cleared +//! environment, a time limit and an output cap. Every question goes in up +//! front, since a case's questions never depend on the answers; the first +//! line asks `version`, and a protocol other than the runner's is refused. + +use std::collections::BTreeMap; +use std::fmt::Write as _; +use std::path::{Path, PathBuf}; +use std::time::Duration; + +use comline_core::package::config::idl::grammar::{Congregation, Key, Value}; +use comline_core::package::config::ir::frozen::FrozenUnit; +use comline_runtime_conformance::runner::{ + self, judge, parse_reply, questions, Corpus, FactProof, OPS_PROTOCOL, +}; +use comline_runtime_conformance::{Answer, Case, Outcome, Profile}; +use miette::{miette, Result}; +use serde_json::{json, Value as Json}; + +use crate::commands::{core_err, ensure_project}; +use crate::external::{native, DEFAULT_TIMEOUT}; +use crate::ui; + +/// One encoding to prove: its profile and the cases that bear on it. +struct Subject { + profile: Profile, + cases: Vec, +} + +pub fn run( + work_dir: &Path, + implementation: &str, + encodings: &[String], + corpus: Option<&Path>, + timeout: Option, +) -> Result<()> { + let subjects = match corpus { + Some(dir) => from_corpus(dir, encodings)?, + None => from_package(work_dir, encodings)?, + }; + let timeout = timeout.map_or(DEFAULT_TIMEOUT, Duration::from_secs); + + let words: Vec = implementation + .split_whitespace() + .map(str::to_string) + .collect(); + let Some((program, args)) = words.split_first() else { + return Err(miette!( + "`--impl` is empty: give the implementation's command line" + )); + }; + let program = resolve(program)?; + let name = program + .file_name() + .map(|n| n.to_string_lossy().into_owned()) + .unwrap_or_else(|| program.display().to_string()); + + // Line 0 asks `version`; line 1 + i asks case i's questions, as a batch. + let all: Vec<&Case> = subjects.iter().flat_map(|s| &s.cases).collect(); + let mut input = json!({ "id": "version", "op": "version" }).to_string(); + input.push('\n'); + for (i, case) in all.iter().enumerate() { + let batch: Vec = questions(case) + .iter() + .enumerate() + .map(|(j, q)| q.request(json!(format!("{i}.{j}")))) + .collect(); + input.push_str(&Json::Array(batch).to_string()); + input.push('\n'); + } + + ui::step(format!( + "Running `{implementation}` against {} case(s) of {} encoding(s)", + all.len(), + subjects.len() + )); + let output = native::run(&program, args, &name, input.as_bytes(), timeout).map_err(|e| { + if e.starts_with("didn't finish") { + miette!( + "`{name}` didn't answer within {}s and was stopped (raise it with `--timeout`)", + timeout.as_secs_f64() + ) + } else { + miette!("`{name}` {e}") + } + })?; + let output = + String::from_utf8(output).map_err(|_| miette!("`{name}` wrote output that isn't UTF-8"))?; + let mut lines = output.lines(); + + let version = lines + .next() + .and_then(|l| serde_json::from_str::(l).ok()) + .ok_or_else(|| miette!("`{name}` didn't answer `version`"))?; + let version = &version["version"]; + if version["protocol"] != json!(OPS_PROTOCOL) { + return Err(miette!( + "`{name}` speaks ops protocol {}, but this runner speaks {OPS_PROTOCOL}", + version["protocol"] + )); + } + let claimed = |name: &str| { + ["formats", "framings", "handshakes"].iter().any(|key| { + version[key] + .as_array() + .is_some_and(|names| names.iter().any(|n| n == name)) + }) + }; + + let mut outcomes = BTreeMap::new(); + for (i, case) in all.iter().enumerate() { + let outcome = match lines.next() { + None => Outcome::Fail("no reply line".into()), + Some(line) => answers(line, i).map_or_else(Outcome::Fail, |a| judge(case, &a)), + }; + outcomes.insert(case.id.clone(), outcome); + } + + let mut failures = 0; + for subject in &subjects { + failures += report(subject, &outcomes, claimed(&subject.profile.name)); + } + if failures > 0 { + return Err(miette!("conformance failed: {failures} problem(s)")); + } + ui::success(format!( + "`{name}` conforms to every encoding it was run against" + )); + Ok(()) +} + +/// The answers on one reply line: the batch for case `i`. +fn answers(line: &str, i: usize) -> std::result::Result, String> { + let reply: Json = + serde_json::from_str(line).map_err(|e| format!("a reply that isn't JSON: {e}"))?; + let Json::Array(replies) = reply else { + return Err(format!("a batch got a reply that isn't an array: {reply}")); + }; + replies + .iter() + .enumerate() + .map(|(j, r)| { + let (id, answer) = parse_reply(r)?; + if id != json!(format!("{i}.{j}")) { + return Err(format!("reply {j} has id {id}")); + } + Ok(answer) + }) + .collect() +} + +/// Prints one encoding's results; the number of problems. +fn report(subject: &Subject, outcomes: &BTreeMap, claimed: bool) -> usize { + let profile = &subject.profile; + let kind = serde_json::to_value(profile.kind).unwrap_or_default(); + let passed = subject + .cases + .iter() + .filter(|c| outcomes.get(&c.id) == Some(&Outcome::Pass)) + .count(); + ui::group(format!( + "{} ({}): {passed}/{} case(s) pass", + profile.name, + kind.as_str().unwrap_or_default(), + subject.cases.len() + )); + let mut problems = 0; + if !claimed { + ui::note(format!( + "the implementation's `version` doesn't list `{}`", + profile.name + )); + } + let case = |id: &str| subject.cases.iter().find(|c| c.id == id); + for FactProof { + fact, + value, + result, + } in runner::prove(profile, case, outcomes) + { + match result { + Ok(()) => ui::detail(format!("proven {fact}: {value}")), + Err(why) => { + problems += 1; + ui::error(format!("unproven {fact}: {value} — {why}")); + } + } + } + for case in &subject.cases { + match &outcomes[&case.id] { + Outcome::Pass => {} + Outcome::Fail(why) => { + problems += 1; + ui::error(format!("{} failed: {}", case.id, indent(why))); + } + Outcome::NotImplemented(what) => { + problems += 1; + ui::error(format!("{} not implemented: {what}", case.id)); + } + } + } + problems +} + +fn indent(text: &str) -> String { + let mut out = String::new(); + for (i, line) in text.lines().enumerate() { + if i > 0 { + out.push_str("\n "); + } + let _ = write!(out, "{line}"); + } + out +} + +/// A program as a shell would find it: a path as given, or a bare name on +/// `PATH`. The implementation runs with a cleared environment, so the name +/// is resolved here. +fn resolve(program: &str) -> Result { + let path = Path::new(program); + if path.components().count() > 1 || path.is_absolute() { + return Ok(path.to_path_buf()); + } + std::env::var_os("PATH") + .into_iter() + .flat_map(|paths| std::env::split_paths(&paths).collect::>()) + .map(|dir| dir.join(program)) + .find(|candidate| candidate.is_file()) + .ok_or_else(|| miette!("`{program}` isn't on PATH: give its path")) +} + +/// The encodings in a runtime-style corpus: its profiles (all, or those +/// named), each with the cases of the features its facts are proven from. +fn from_corpus(dir: &Path, names: &[String]) -> Result> { + let corpus: Corpus = + runner::load_corpus(dir).map_err(|e| miette!("loading the corpus: {e}"))?; + if corpus.profiles.is_empty() { + return Err(miette!("{} has no profiles/*.json", dir.display())); + } + let chosen: Vec<&Profile> = if names.is_empty() { + corpus.profiles.values().collect() + } else { + names + .iter() + .map(|n| { + corpus + .profiles + .get(n) + .ok_or_else(|| miette!("the corpus has no profile for `{n}`")) + }) + .collect::>()? + }; + Ok(chosen + .into_iter() + .map(|profile| Subject { + cases: corpus.cases_for(profile).into_iter().cloned().collect(), + profile: profile.clone(), + }) + .collect()) +} + +/// The encodings the package declares (all, or those named), each with its +/// profile and the vectors beside it. +fn from_package(work_dir: &Path, names: &[String]) -> Result> { + ensure_project(work_dir)?; + let context = comline_core::package::build::compile_package(work_dir) + .map_err(|e| core_err("the package doesn't compile", e))?; + let declared: Vec = context + .config_frozen + .iter() + .flatten() + .filter_map(|unit| match unit { + FrozenUnit::Encoding { name, .. } => Some(name.clone()), + _ => None, + }) + .collect(); + let paths = profile_paths(&context.config); + + let chosen: Vec = if names.is_empty() { + if declared.is_empty() { + return Err(miette!( + "the package declares no encodings (`encodings` in config.idp); to run an official \ + encoding's vectors, pass `--corpus `" + )); + } + declared + } else { + for n in names { + if !declared.contains(n) { + let hint = if comline_core::encodings::is_bare(n) { + "; an official encoding's vectors are in the runtime's corpus: pass \ + `--corpus `" + } else { + "" + }; + return Err(miette!("the package doesn't declare `{n}`{hint}")); + } + } + names.to_vec() + }; + + chosen + .into_iter() + .map(|name| { + let profile_path = paths + .get(&name) + .ok_or_else(|| miette!("can't find `{name}`'s profile in config.idp"))?; + let profile_path = work_dir.join(profile_path); + let profile = runner::load_profile(&profile_path).map_err(|e| miette!("{e}"))?; + let vectors_path = vectors_beside(&profile_path); + if !vectors_path.exists() { + return Err(miette!( + "`{name}` has no vectors: expected {} beside its profile", + vectors_path.display() + )); + } + let vectors = runner::load_vectors(&vectors_path).map_err(|e| miette!("{e}"))?; + Ok(Subject { + profile, + cases: vectors.cases, + }) + }) + .collect() +} + +/// Where an encoding's vectors are: its profile's path with `.json` +/// replaced by `.vectors.json` (`profiles/lines.json` → +/// `profiles/lines.vectors.json`). +pub fn vectors_beside(profile: &Path) -> PathBuf { + let stem = profile + .file_stem() + .map(|s| s.to_string_lossy().into_owned()) + .unwrap_or_default(); + profile.with_file_name(format!("{stem}.vectors.json")) +} + +/// Each declared encoding's `profile` path, as `config.idp` writes it. Core +/// has already checked every entry. +fn profile_paths(config: &Congregation) -> BTreeMap { + let mut paths = BTreeMap::new(); + for top in &config.assignments { + if top.value.key.text() != "encodings" { + continue; + } + let Value::Dictionary(entries) = &top.value.value else { + continue; + }; + for entry in &entries.assignments { + let Value::Dictionary(fields) = &entry.value.value else { + continue; + }; + for field in &fields.assignments { + if let (Key::Identifier(k), Value::String(s)) = + (&field.value.key, &field.value.value) + { + if k.value == "profile" { + paths.insert(entry.value.key.text(), unquote(&s.value)); + } + } + } + } + } + paths +} + +fn unquote(s: &str) -> String { + s.strip_prefix('"') + .and_then(|s| s.strip_suffix('"')) + .unwrap_or(s) + .to_string() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn vectors_sit_beside_the_profile() { + assert_eq!( + vectors_beside(Path::new("/p/profiles/lines.json")), + Path::new("/p/profiles/lines.vectors.json") + ); + assert_eq!( + vectors_beside(Path::new("x@1.json")), + Path::new("x@1.vectors.json") + ); + } +} diff --git a/src/commands/mod.rs b/src/commands/mod.rs index f4f4d62..78113e3 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -7,6 +7,7 @@ pub mod build; pub mod check; pub mod clean; pub mod completions; +pub mod conformance; pub mod diff; pub mod generate; pub mod new; diff --git a/src/external.rs b/src/external.rs index 2e2bdf0..0b9818f 100644 --- a/src/external.rs +++ b/src/external.rs @@ -109,7 +109,7 @@ impl External { fn call(&self, request: &Request) -> Result { let input = protocol::encode(request).map_err(|e| miette!("{e}"))?; let output = match &self.runner { - Runner::Native => native::run(&self.path, &self.name, &input, self.timeout), + Runner::Native => native::run(&self.path, &[], &self.name, &input, self.timeout), #[cfg(feature = "gen-wasm")] Runner::Wasm(compiled) => compiled.run(&self.name, &input, self.timeout), } @@ -376,11 +376,11 @@ fn timed_out(timeout: Duration) -> String { ) } -mod native { +pub(crate) mod native { use super::*; - /// Runs the executable at `path` with `input` on stdin, and returns its - /// stdout once it exits successfully. + /// Runs the executable at `path` with `args` and `input` on stdin, and + /// returns its stdout once it exits successfully. /// /// The environment is cleared. `PATH` isn't kept: a generator gets its /// request on stdin and has no reason to find other programs. On @@ -388,12 +388,14 @@ mod native { /// system libraries every program needs. pub fn run( path: &Path, + args: &[String], name: &str, input: &[u8], timeout: Duration, ) -> std::result::Result, String> { let mut command = Command::new(path); command + .args(args) .env_clear() .stdin(Stdio::piped()) .stdout(Stdio::piped()) diff --git a/src/main.rs b/src/main.rs index 462fb26..963f5e0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -168,6 +168,18 @@ fn run(cli: Cli) -> Result<()> { reason, yes, } => commands::release::run(&work_dir, version.as_deref(), raise, reason, yes), + Commands::Conformance { + implementation, + encoding, + corpus, + timeout, + } => commands::conformance::run( + &work_dir, + &implementation, + &encoding, + corpus.as_deref(), + timeout, + ), Commands::Completions { shell } => commands::completions::run(shell), Commands::Targets { features, json } => commands::targets::run(features, json), } diff --git a/tests/cli/conformance.rs b/tests/cli/conformance.rs new file mode 100644 index 0000000..152cd58 --- /dev/null +++ b/tests/cli/conformance.rs @@ -0,0 +1,180 @@ +//! `comline conformance --impl`: implementations from +//! `tests/fixtures/conformance` (built here) run against the official +//! corpus, at the runtime rev the CLI pins, and against a package's own +//! vectors. + +use std::path::{Path, PathBuf}; +use std::process::Command as StdCommand; +use std::sync::OnceLock; + +use predicates::prelude::*; + +use crate::util::*; + +/// The fixture implementations' release directory. +fn built() -> &'static PathBuf { + static BUILT: OnceLock = OnceLock::new(); + BUILT.get_or_init(|| { + let manifest = + Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/conformance/Cargo.toml"); + let target_dir = Path::new(env!("CARGO_TARGET_TMPDIR")).join("conformance"); + let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".into()); + let status = StdCommand::new(&cargo) + .args(["build", "--release", "--manifest-path"]) + .arg(&manifest) + .arg("--target-dir") + .arg(&target_dir) + .status() + .expect("cargo runs"); + assert!( + status.success(), + "building the fixture implementations failed" + ); + target_dir.join("release") + }) +} + +fn implementation(bin: &str) -> String { + built() + .join(format!("{bin}{}", std::env::consts::EXE_SUFFIX)) + .to_str() + .unwrap() + .to_string() +} + +/// The runtime corpus the CLI's `comline-runtime-conformance` comes with: +/// that crate's directory, from `cargo metadata`. +fn corpus() -> &'static PathBuf { + static CORPUS: OnceLock = OnceLock::new(); + CORPUS.get_or_init(|| { + let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".into()); + let output = StdCommand::new(cargo) + .args(["metadata", "--format-version", "1", "--manifest-path"]) + .arg(Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml")) + .output() + .expect("cargo metadata runs"); + assert!(output.status.success()); + let metadata: serde_json::Value = serde_json::from_slice(&output.stdout).unwrap(); + let manifest = metadata["packages"] + .as_array() + .unwrap() + .iter() + .find(|p| p["name"] == "comline-runtime-conformance") + .expect("comline-runtime-conformance is a dependency")["manifest_path"] + .as_str() + .unwrap() + .to_string(); + Path::new(&manifest).parent().unwrap().to_path_buf() + }) +} + +#[test] +fn the_reference_passes_every_official_encoding() { + comline_cmd() + .args([ + "conformance", + "--impl", + &implementation("reference"), + "--corpus", + ]) + .arg(corpus()) + .assert() + .success() + .stderr(predicate::str::contains("packed@1 (format): ")) + .stderr(predicate::str::contains("failed").not()) + .stderr(predicate::str::contains("unproven").not()) + .stderr(predicate::str::contains( + "proven struct_fields: by_position", + )) + .stderr(predicate::str::contains("conforms to every encoding")); +} + +#[test] +fn a_flipped_byte_fails_with_a_diff() { + comline_cmd() + .args(["conformance", "--impl", &implementation("flipper")]) + .args(["--encoding", "datagram@1", "--corpus"]) + .arg(corpus()) + .assert() + .code(1) + .stderr(predicate::str::contains( + "unproven calls: by_index — case `framing-datagram/request` failed", + )) + .stderr(predicate::str::contains( + "framing-datagram/request failed: encodes wrong", + )) + .stderr(predicate::str::contains("expected: 03002a")) + .stderr(predicate::str::contains("got: fc002a")) + .stderr(predicate::str::contains("^^ byte 0 differs")); +} + +/// A package declaring a namespaced framing, with its vectors beside its +/// profile, and a stub implementing it. +#[test] +fn a_package_proves_its_own_framing() { + let temp = tempfile::tempdir().unwrap(); + let project = copy_fixture("conformance_package", temp.path()); + copy_dir_all( + &Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/conformance_package/profiles"), + &project.join("profiles"), + ); + + comline_cmd() + .current_dir(&project) + .args(["conformance", "--impl", &implementation("lines")]) + .assert() + .success() + .stderr(predicate::str::contains( + "com.acme.lines@1 (framing): 5/5 case(s) pass", + )) + .stderr(predicate::str::contains("proven calls: by_name")) + .stderr(predicate::str::contains("proven errors: by_ordinal")); + + // The reference doesn't implement it: every case is not implemented. + comline_cmd() + .current_dir(&project) + .args(["conformance", "--impl", &implementation("reference")]) + .args(["--encoding", "com.acme.lines@1"]) + .assert() + .code(1) + .stderr(predicate::str::contains("doesn't list `com.acme.lines@1`")) + .stderr(predicate::str::contains("lines/request not implemented")); + + // Without vectors beside the profile, it says where they belong. + std::fs::remove_file(project.join("profiles/lines.vectors.json")).unwrap(); + comline_cmd() + .current_dir(&project) + .args(["conformance", "--impl", &implementation("lines")]) + .assert() + .code(1) + .stderr(predicate::str::contains( + "lines.vectors.json beside its profile", + )); +} + +#[test] +fn an_official_name_points_at_the_corpus() { + let temp = tempfile::tempdir().unwrap(); + let project = fixture_project(temp.path()); + comline_cmd() + .current_dir(&project) + .args([ + "conformance", + "--impl", + "/bin/true", + "--encoding", + "packed@1", + ]) + .assert() + .code(1) + .stderr(predicate::str::contains("doesn't declare `packed@1`")) + .stderr(predicate::str::contains("--corpus")); +} + +fn copy_dir_all(from: &Path, to: &Path) { + std::fs::create_dir_all(to).unwrap(); + for entry in std::fs::read_dir(from).unwrap() { + let entry = entry.unwrap(); + std::fs::copy(entry.path(), to.join(entry.file_name())).unwrap(); + } +} diff --git a/tests/cli/main.rs b/tests/cli/main.rs index 182eca9..c408d87 100644 --- a/tests/cli/main.rs +++ b/tests/cli/main.rs @@ -11,6 +11,7 @@ mod add; mod build; mod check; mod clean; +mod conformance; mod diff; mod end_to_end; mod external; diff --git a/tests/fixtures/conformance/Cargo.lock b/tests/fixtures/conformance/Cargo.lock new file mode 100644 index 0000000..dbb5a54 --- /dev/null +++ b/tests/fixtures/conformance/Cargo.lock @@ -0,0 +1,491 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "abi_stable" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d6512d3eb05ffe5004c59c206de7f99c34951504056ce23fc953842f12c445" +dependencies = [ + "abi_stable_derive", + "abi_stable_shared", + "const_panic", + "core_extensions", + "crossbeam-channel", + "generational-arena", + "libloading 0.7.4", + "lock_api", + "parking_lot", + "paste", + "repr_offset", + "rustc_version", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "abi_stable_derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7178468b407a4ee10e881bc7a328a65e739f0863615cca4429d43916b05e898" +dependencies = [ + "abi_stable_shared", + "as_derive_utils", + "core_extensions", + "proc-macro2", + "quote", + "rustc_version", + "syn 1.0.109", + "typed-arena", +] + +[[package]] +name = "abi_stable_shared" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b5df7688c123e63f4d4d649cba63f2967ba7f7861b1664fca3f77d3dad2b63" +dependencies = [ + "core_extensions", +] + +[[package]] +name = "as_derive_utils" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff3c96645900a44cf11941c111bd08a6573b0e2f9f69bc9264b179d8fae753c4" +dependencies = [ + "core_extensions", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "comline-reference" +version = "0.1.0" +source = "git+https://github.com/ComlineProject/runtime?rev=3a9b600ad971fc05ce5a64d00ff1c23a21406659#3a9b600ad971fc05ce5a64d00ff1c23a21406659" +dependencies = [ + "comline-runtime", + "comline-runtime-conformance", + "serde", + "serde_json", +] + +[[package]] +name = "comline-runtime" +version = "0.1.0" +source = "git+https://github.com/ComlineProject/runtime?rev=3a9b600ad971fc05ce5a64d00ff1c23a21406659#3a9b600ad971fc05ce5a64d00ff1c23a21406659" +dependencies = [ + "abi_stable", + "bytemuck", + "libloading 0.8.9", + "rmp", + "rmp-serde", + "serde", + "serde_json", +] + +[[package]] +name = "comline-runtime-conformance" +version = "0.1.0" +source = "git+https://github.com/ComlineProject/runtime?rev=3a9b600ad971fc05ce5a64d00ff1c23a21406659#3a9b600ad971fc05ce5a64d00ff1c23a21406659" +dependencies = [ + "comline-runtime", + "serde", + "serde_json", +] + +[[package]] +name = "comline-test-conformance" +version = "0.0.0" +dependencies = [ + "comline-reference", + "serde_json", +] + +[[package]] +name = "const_panic" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9603f79528ece8163c496f8932121cb36cfe46259e9c907bb3d8205139d7caa3" +dependencies = [ + "typewit", +] + +[[package]] +name = "core_extensions" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42bb5e5d0269fd4f739ea6cedaf29c16d81c27a7ce7582008e90eb50dcd57003" +dependencies = [ + "core_extensions_proc_macros", +] + +[[package]] +name = "core_extensions_proc_macros" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "533d38ecd2709b7608fb8e18e4504deb99e9a72879e6aa66373a76d8dc4259ea" + +[[package]] +name = "crossbeam-channel" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "generational-arena" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877e94aff08e743b651baaea359664321055749b398adff8740a7399af7796e7" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "repr_offset" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb1070755bd29dffc19d0971cab794e607839ba2ef4b69a9e6fbc8733c1b72ea" +dependencies = [ + "tstr", +] + +[[package]] +name = "rmp" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ba8be72d372b2c9b35542551678538b562e7cf86c3315773cae48dfbfe7790c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "rmp-serde" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f81bee8c8ef9b577d1681a70ebbc962c232461e397b22c208c43c04b67a155" +dependencies = [ + "rmp", + "serde", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "smallvec" +version = "1.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tstr" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8e0294f14baae476d0dd0a2d780b2e24d66e349a9de876f5126777a37bdba7" +dependencies = [ + "tstr_proc_macros", +] + +[[package]] +name = "tstr_proc_macros" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78122066b0cb818b8afd08f7ed22f7fdbc3e90815035726f0840d0d26c0747a" + +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + +[[package]] +name = "typewit" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "214ca0b2191785cbc06209b9ca1861e048e39b5ba33574b3cedd58363d5bb5f6" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/tests/fixtures/conformance/Cargo.toml b/tests/fixtures/conformance/Cargo.toml new file mode 100644 index 0000000..f1b9dcc --- /dev/null +++ b/tests/fixtures/conformance/Cargo.toml @@ -0,0 +1,16 @@ +# Implementations the integration tests run under `comline conformance` +# (tests/cli/conformance.rs), built there. Its own workspace: not part of the +# CLI's build. +[package] +name = "comline-test-conformance" +version = "0.0.0" +edition = "2021" +publish = false + +[workspace] + +[dependencies] +# The runtime rev the CLI pins `comline-runtime-conformance` at, so the +# reference answers as the vectors the CLI reads were blessed. +comline-reference = { git = "https://github.com/ComlineProject/runtime", rev = "3a9b600ad971fc05ce5a64d00ff1c23a21406659" } +serde_json = "1.0" diff --git a/tests/fixtures/conformance/src/bin/flipper.rs b/tests/fixtures/conformance/src/bin/flipper.rs new file mode 100644 index 0000000..3e60c9c --- /dev/null +++ b/tests/fixtures/conformance/src/bin/flipper.rs @@ -0,0 +1,29 @@ +//! A planted bad implementation: `comline-reference`, except that every +//! request frame it encodes has its first byte flipped. + +use std::io::{BufRead, Write}; + +use serde_json::Value; + +fn main() { + let stdout = std::io::stdout(); + let mut out = stdout.lock(); + for line in std::io::stdin().lock().lines() { + let line = line.unwrap(); + let mut reply: Value = + serde_json::from_str(&comline_reference::handle_line(&line)).unwrap(); + let request: Value = serde_json::from_str(&line).unwrap_or(Value::Null); + if let (Value::Array(requests), Value::Array(replies)) = (&request, &mut reply) { + for (request, reply) in requests.iter().zip(replies) { + if request["op"] == "request" && request.get("bytes").is_none() { + if let Some(Value::String(hex)) = reply.get_mut("bytes") { + let first = u8::from_str_radix(&hex[..2], 16).unwrap() ^ 0xff; + hex.replace_range(..2, &format!("{first:02x}")); + } + } + } + } + writeln!(out, "{reply}").unwrap(); + out.flush().unwrap(); + } +} diff --git a/tests/fixtures/conformance/src/bin/lines.rs b/tests/fixtures/conformance/src/bin/lines.rs new file mode 100644 index 0000000..4762ffd --- /dev/null +++ b/tests/fixtures/conformance/src/bin/lines.rs @@ -0,0 +1,118 @@ +//! A stub implementation of a third-party framing, `com.acme.lines@1`: a +//! request is `REQ `, a response +//! `OK `, `ERR ` +//! or `FAULT `, each as ASCII. + +use std::io::{BufRead, Write}; + +use serde_json::{json, Map, Value}; + +const NAME: &str = "com.acme.lines@1"; + +fn hex(bytes: &[u8]) -> String { + bytes.iter().map(|b| format!("{b:02x}")).collect() +} + +fn unhex(s: &str) -> Option> { + (0..s.len()) + .step_by(2) + .map(|i| u8::from_str_radix(s.get(i..i + 2)?, 16).ok()) + .collect() +} + +fn encode(op: &str, input: &Value) -> Option { + let id = input["request_id"].as_str()?; + Some(match op { + "request" => format!( + "REQ {id} {} {}", + input["method"].as_str()?, + serde_json::to_string(&input["params"]).ok()? + ), + "response" => match input["kind"].as_str()? { + "ok" => format!("OK {id} {}", input["payload"].as_str()?), + "err" => format!("ERR {id} {} {}", input["id"], input["body"].as_str()?), + "fault" => format!("FAULT {id}"), + _ => return None, + }, + _ => return None, + }) +} + +/// The input `text` decodes to, the fields the wire doesn't carry taken +/// from `input`; `None` to refuse. +fn decode(op: &str, input: &Value, text: &str) -> Option { + let mut out: Map = Map::new(); + out.insert("framing".into(), json!(NAME)); + let words: Vec<&str> = text.splitn(4, ' ').collect(); + match (op, words.as_slice()) { + ("request", ["REQ", id, method, params]) => { + for key in ["call_id", "format"] { + out.insert(key.into(), input.get(key)?.clone()); + } + out.insert("request_id".into(), json!(id)); + out.insert("method".into(), json!(method)); + out.insert("params".into(), serde_json::from_str(params).ok()?); + } + ("response", ["OK", id, payload]) => { + unhex(payload)?; + out.insert("request_id".into(), json!(id)); + out.insert("kind".into(), json!("ok")); + out.insert("payload".into(), json!(payload)); + } + ("response", ["ERR", id, error, body]) => { + unhex(body)?; + out.insert("request_id".into(), json!(id)); + out.insert("kind".into(), json!("err")); + out.insert("id".into(), json!(error.parse::().ok()?)); + out.insert("body".into(), json!(body)); + } + ("response", ["FAULT", id]) => { + out.insert("request_id".into(), json!(id)); + out.insert("kind".into(), json!("fault")); + } + _ => return None, + } + Some(Value::Object(out)) +} + +fn answer(request: &Value) -> Value { + let id = request["id"].clone(); + let op = request["op"].as_str().unwrap_or_default(); + let input = &request["input"]; + if op == "version" { + return json!({ "id": id, "version": { + "protocol": 1, "ops": ["request", "response", "version"], + "formats": [], "framings": [NAME], + }}); + } + if !matches!(op, "request" | "response") || input["framing"] != NAME { + return json!({ "id": id, "not_implemented": format!("{op} on {}", input["framing"]) }); + } + match request.get("bytes").and_then(Value::as_str) { + None => match encode(op, input) { + Some(text) => json!({ "id": id, "bytes": hex(text.as_bytes()) }), + None => json!({ "id": id, "error": "malformed input" }), + }, + Some(bytes) => { + let text = unhex(bytes).and_then(|b| String::from_utf8(b).ok()); + match text.and_then(|t| decode(op, input, &t)) { + Some(input) => json!({ "id": id, "accept": true, "input": input }), + None => json!({ "id": id, "accept": false }), + } + } + } +} + +fn main() { + let stdout = std::io::stdout(); + let mut out = stdout.lock(); + for line in std::io::stdin().lock().lines() { + let reply = match serde_json::from_str::(&line.unwrap()) { + Ok(Value::Array(requests)) => Value::Array(requests.iter().map(answer).collect()), + Ok(request) => answer(&request), + Err(_) => json!({ "id": null, "error": "not JSON" }), + }; + writeln!(out, "{reply}").unwrap(); + out.flush().unwrap(); + } +} diff --git a/tests/fixtures/conformance/src/bin/reference.rs b/tests/fixtures/conformance/src/bin/reference.rs new file mode 100644 index 0000000..acda714 --- /dev/null +++ b/tests/fixtures/conformance/src/bin/reference.rs @@ -0,0 +1,5 @@ +//! `comline-reference`, built from the pinned runtime rev. + +fn main() -> std::io::Result<()> { + comline_reference::serve(std::io::stdin().lock(), std::io::stdout().lock()) +} diff --git a/tests/fixtures/conformance_package/config.idp b/tests/fixtures/conformance_package/config.idp new file mode 100644 index 0000000..6ebc30f --- /dev/null +++ b/tests/fixtures/conformance_package/config.idp @@ -0,0 +1,9 @@ +congregation acme_lines +specification_version = 1 + +encodings = { + "com.acme.lines@1" = { + kind = "framing" + profile = "profiles/lines.json" + } +} diff --git a/tests/fixtures/conformance_package/profiles/lines.json b/tests/fixtures/conformance_package/profiles/lines.json new file mode 100644 index 0000000..5f948c8 --- /dev/null +++ b/tests/fixtures/conformance_package/profiles/lines.json @@ -0,0 +1,8 @@ +{ + "name": "com.acme.lines@1", + "kind": "framing", + "facts": { + "calls": { "value": "by_name", "proven_by": ["lines/request"] }, + "errors": { "value": "by_ordinal", "proven_by": ["lines/error"] } + } +} diff --git a/tests/fixtures/conformance_package/profiles/lines.vectors.json b/tests/fixtures/conformance_package/profiles/lines.vectors.json new file mode 100644 index 0000000..ed37f99 --- /dev/null +++ b/tests/fixtures/conformance_package/profiles/lines.vectors.json @@ -0,0 +1,69 @@ +{ + "feature": "lines", + "cases": [ + { + "id": "lines/request", + "op": "request", + "input": { + "call_id": 3, + "format": "json@1", + "framing": "com.acme.lines@1", + "method": "greet", + "params": { + "array": [ + { + "u32": 7 + }, + { + "string": "x" + } + ] + }, + "request_id": "42" + }, + "bytes": "524551203432206772656574207b226172726179223a5b7b22753332223a377d2c7b22737472696e67223a2278227d5d7d" + }, + { + "id": "lines/ok", + "op": "response", + "input": { + "framing": "com.acme.lines@1", + "kind": "ok", + "payload": "6869", + "request_id": "7" + }, + "bytes": "4f4b20372036383639" + }, + { + "id": "lines/error", + "op": "response", + "input": { + "body": "6e6f", + "framing": "com.acme.lines@1", + "id": 2, + "kind": "err", + "request_id": "7" + }, + "bytes": "455252203720322036653666" + }, + { + "id": "lines/fault", + "op": "response", + "input": { + "framing": "com.acme.lines@1", + "kind": "fault", + "request_id": "9" + }, + "bytes": "4641554c542039" + }, + { + "id": "lines/reject-unknown-kind", + "op": "response", + "input": { + "framing": "com.acme.lines@1" + }, + "bytes": "4d415942452039", + "expect": "reject" + } + ] +} diff --git a/tests/fixtures/conformance_package/src/api.ids b/tests/fixtures/conformance_package/src/api.ids new file mode 100644 index 0000000..6a4fa04 --- /dev/null +++ b/tests/fixtures/conformance_package/src/api.ids @@ -0,0 +1,3 @@ +struct Greeting { + text: string +} From 32fb20a02f25c23ef6cbcc4d496a9ffd4f1f448c Mon Sep 17 00:00:00 2001 From: Kinflou Date: Sun, 1 Nov 2026 02:48:15 +0800 Subject: [PATCH 2/2] conformance: pin the runtime to runtime#69's merge (6f8f73a) --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- tests/fixtures/conformance/Cargo.lock | 6 +++--- tests/fixtures/conformance/Cargo.toml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 40f9aff..b79de82 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -626,7 +626,7 @@ source = "git+https://github.com/ComlineProject/core?rev=98d64faedfc48ab4d2c9372 [[package]] name = "comline-runtime" version = "0.1.0" -source = "git+https://github.com/ComlineProject/runtime?rev=3a9b600ad971fc05ce5a64d00ff1c23a21406659#3a9b600ad971fc05ce5a64d00ff1c23a21406659" +source = "git+https://github.com/ComlineProject/runtime?rev=6f8f73a247f0aa4ac8b7041b2fdc4b02bce0e0d6#6f8f73a247f0aa4ac8b7041b2fdc4b02bce0e0d6" dependencies = [ "abi_stable", "bytemuck", @@ -640,7 +640,7 @@ dependencies = [ [[package]] name = "comline-runtime-conformance" version = "0.1.0" -source = "git+https://github.com/ComlineProject/runtime?rev=3a9b600ad971fc05ce5a64d00ff1c23a21406659#3a9b600ad971fc05ce5a64d00ff1c23a21406659" +source = "git+https://github.com/ComlineProject/runtime?rev=6f8f73a247f0aa4ac8b7041b2fdc4b02bce0e0d6#6f8f73a247f0aa4ac8b7041b2fdc4b02bce0e0d6" dependencies = [ "comline-runtime", "serde", diff --git a/Cargo.toml b/Cargo.toml index 6ded5bc..d938378 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ comline-codegen-rust = { git = "https://github.com/ComlineProject/comline-rust", comline-codegen-typescript = { git = "https://github.com/ComlineProject/comline-typescript", rev = "765fc2d1177d0044498b00160000ac5084540af2", optional = true } # `comline conformance`: the conformance runner (corpus loading, judging, # profile proofs) and its case format, a public spec. Pinned by git rev. -comline-runtime-conformance = { git = "https://github.com/ComlineProject/runtime", rev = "3a9b600ad971fc05ce5a64d00ff1c23a21406659" } +comline-runtime-conformance = { git = "https://github.com/ComlineProject/runtime", rev = "6f8f73a247f0aa4ac8b7041b2fdc4b02bce0e0d6" } # Runs a `generator = ".wasm"` target (see src/external.rs): no # preopened directories, no environment, no network. Exact pins, bumped # together. diff --git a/tests/fixtures/conformance/Cargo.lock b/tests/fixtures/conformance/Cargo.lock index dbb5a54..eb50361 100644 --- a/tests/fixtures/conformance/Cargo.lock +++ b/tests/fixtures/conformance/Cargo.lock @@ -103,7 +103,7 @@ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" [[package]] name = "comline-reference" version = "0.1.0" -source = "git+https://github.com/ComlineProject/runtime?rev=3a9b600ad971fc05ce5a64d00ff1c23a21406659#3a9b600ad971fc05ce5a64d00ff1c23a21406659" +source = "git+https://github.com/ComlineProject/runtime?rev=6f8f73a247f0aa4ac8b7041b2fdc4b02bce0e0d6#6f8f73a247f0aa4ac8b7041b2fdc4b02bce0e0d6" dependencies = [ "comline-runtime", "comline-runtime-conformance", @@ -114,7 +114,7 @@ dependencies = [ [[package]] name = "comline-runtime" version = "0.1.0" -source = "git+https://github.com/ComlineProject/runtime?rev=3a9b600ad971fc05ce5a64d00ff1c23a21406659#3a9b600ad971fc05ce5a64d00ff1c23a21406659" +source = "git+https://github.com/ComlineProject/runtime?rev=6f8f73a247f0aa4ac8b7041b2fdc4b02bce0e0d6#6f8f73a247f0aa4ac8b7041b2fdc4b02bce0e0d6" dependencies = [ "abi_stable", "bytemuck", @@ -128,7 +128,7 @@ dependencies = [ [[package]] name = "comline-runtime-conformance" version = "0.1.0" -source = "git+https://github.com/ComlineProject/runtime?rev=3a9b600ad971fc05ce5a64d00ff1c23a21406659#3a9b600ad971fc05ce5a64d00ff1c23a21406659" +source = "git+https://github.com/ComlineProject/runtime?rev=6f8f73a247f0aa4ac8b7041b2fdc4b02bce0e0d6#6f8f73a247f0aa4ac8b7041b2fdc4b02bce0e0d6" dependencies = [ "comline-runtime", "serde", diff --git a/tests/fixtures/conformance/Cargo.toml b/tests/fixtures/conformance/Cargo.toml index f1b9dcc..6cb30a5 100644 --- a/tests/fixtures/conformance/Cargo.toml +++ b/tests/fixtures/conformance/Cargo.toml @@ -12,5 +12,5 @@ publish = false [dependencies] # The runtime rev the CLI pins `comline-runtime-conformance` at, so the # reference answers as the vectors the CLI reads were blessed. -comline-reference = { git = "https://github.com/ComlineProject/runtime", rev = "3a9b600ad971fc05ce5a64d00ff1c23a21406659" } +comline-reference = { git = "https://github.com/ComlineProject/runtime", rev = "6f8f73a247f0aa4ac8b7041b2fdc4b02bce0e0d6" } serde_json = "1.0"