From 84def7ef19a04b01fee6f06a1147e9ff9c3454fb Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sat, 17 Sep 2022 13:52:02 -0400 Subject: chore(tvix/eval): Add deps on proptest+test_strategy It's proptest time! Add deps on the proptest and test_strategy crates, gated behind a new (default-enabled) "arbitrary" feature flag so that they don't affect dependencies of things like tvixbolt that depend on tvix. These are going in dependencies, not dev-dependencies, so that we can impl Arbitrary for stuff outside of test modules (which will be important for integration suites which want to run proptests) Change-Id: I1613bd3ea9a835e22986ad4e59700e8736007963 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6624 Autosubmit: grfn Tested-by: BuildkiteCI Reviewed-by: tazjin --- tvix/eval/Cargo.lock | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++- tvix/eval/Cargo.toml | 7 ++- 2 files changed, 151 insertions(+), 2 deletions(-) (limited to 'tvix') diff --git a/tvix/eval/Cargo.lock b/tvix/eval/Cargo.lock index beba1a7bf6d3..7fec8dac0596 100644 --- a/tvix/eval/Cargo.lock +++ b/tvix/eval/Cargo.lock @@ -43,6 +43,12 @@ version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + [[package]] name = "cast" version = "0.3.0" @@ -309,6 +315,15 @@ dependencies = [ "str-buf", ] +[[package]] +name = "fastrand" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +dependencies = [ + "instant", +] + [[package]] name = "fd-lock" version = "3.0.6" @@ -364,6 +379,15 @@ dependencies = [ "libc", ] +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + [[package]] name = "io-lifetimes" version = "0.7.3" @@ -536,6 +560,12 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + [[package]] name = "pretty_assertions" version = "1.3.0" @@ -566,6 +596,30 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0d9cc07f18492d879586c92b485def06bc850da3118075cd45d50e9c95b0e5" +dependencies = [ + "bitflags", + "byteorder", + "lazy_static", + "num-traits", + "quick-error", + "rand 0.8.5", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "tempfile", +] + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + [[package]] name = "quote" version = "0.6.13" @@ -607,6 +661,27 @@ dependencies = [ "winapi", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + [[package]] name = "rand_core" version = "0.3.1" @@ -622,6 +697,24 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core 0.6.4", +] + [[package]] name = "rayon" version = "1.5.3" @@ -849,6 +942,29 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" +[[package]] +name = "structmeta" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd9c2155aa89fb2c2cb87d99a610c689e7c47099b3e9f1c8a8f53faf4e3d2e3" +dependencies = [ + "proc-macro2 1.0.43", + "quote 1.0.21", + "structmeta-derive", + "syn 1.0.99", +] + +[[package]] +name = "structmeta-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bafede0d0a2f21910f36d47b1558caae3076ed80f6f3ad0fc85a91e6ba7e5938" +dependencies = [ + "proc-macro2 1.0.43", + "quote 1.0.21", + "syn 1.0.99", +] + [[package]] name = "syn" version = "0.15.44" @@ -886,10 +1002,24 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" dependencies = [ - "rand", + "rand 0.4.6", "remove_dir_all", ] +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", +] + [[package]] name = "termcolor" version = "1.1.3" @@ -911,6 +1041,18 @@ dependencies = [ "syn 0.15.44", ] +[[package]] +name = "test-strategy" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62d6408d1406657be2f9d1701fbae379331d30d2f6e92050710edb0d34eeb480" +dependencies = [ + "proc-macro2 1.0.43", + "quote 1.0.21", + "structmeta", + "syn 1.0.99", +] + [[package]] name = "text-size" version = "1.1.0" @@ -967,6 +1109,7 @@ dependencies = [ "itertools", "path-clean", "pretty_assertions", + "proptest", "rnix", "rowan", "rustyline", @@ -974,6 +1117,7 @@ dependencies = [ "tabwriter", "tempdir", "test-generator", + "test-strategy", ] [[package]] diff --git a/tvix/eval/Cargo.toml b/tvix/eval/Cargo.toml index 5ccfa632830f..a8d93ca0ecd7 100644 --- a/tvix/eval/Cargo.toml +++ b/tvix/eval/Cargo.toml @@ -21,6 +21,8 @@ tabwriter = "1.2" rowan = "*" # pinned by rnix codemap = "0.1.3" codemap-diagnostic = "0.1.1" +proptest = { version = "1.0.0", default_features = false, features = ["std", "alloc", "break-dead-code", "tempfile"], optional = true } +test-strategy = { version = "0.2.1", optional = true } # rnix has not been released in a while (as of 2022-09-01), we will # use it from git. @@ -36,7 +38,7 @@ itertools = "0.10.3" tempdir = "0.3.7" [features] -default = [ "repl" ] +default = [ "repl", "arbitrary" ] # Enables running the Nix language test suite from the original C++ # Nix implementation (at version 2.3) against Tvix. @@ -45,6 +47,9 @@ nix_tests = [] # Enables building the binary (tvix-eval REPL) repl = [ "dep:rustyline" ] +# Enables Arbitrary impls for internal types (required to run tests) +arbitrary = [ "proptest", "test-strategy" ] + [[bench]] name = "eval" harness = false -- cgit 1.4.1