Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# `cargo nextest run` runs each test in its own process and every binary at once. The threads of one process take turns at its one session (`src/eval.rs`), so separate processes are what run tests in parallel.
[profile.default]
# A test running past 5 s is reported as slow. One still running at 30 s is stopped and fails.
slow-timeout = { period = "5s", terminate-after = 6 }
fail-fast = false

[test-groups]
timed = { max-threads = 1 }

# The reference runner starts one child process per core. It starts first and runs with nothing beside it, so no timing runs beside it.
[[profile.default.overrides]]
filter = 'binary(reference)'
threads-required = 'num-cpus'
priority = 100

# Memory-bound timings run with nothing beside them.
[[profile.default.overrides]]
filter = 'binary(speed) and test(=timed_images)'
threads-required = 'num-cpus'
test-group = 'timed'
priority = -100

# Other timings run one at a time, beside light correctness tests, after every other test has started.
[[profile.default.overrides]]
filter = 'binary(speed) and test(/^timed_/)'
test-group = 'timed'
priority = -100

# Optional selection excluding timings, used by focused cross-repo diagnostics. It gives reference one slot because this selection contains no timing tests.
[profile.untimed]
default-filter = 'not (binary(speed) and test(/^timed_/))'

[[profile.untimed.overrides]]
filter = 'binary(reference)'
threads-required = 1

# Optional timing-only selection. An explicit cross-repo ('untimed', 'timed', 'speed') run uses this after correctness and before rustymath timings. Plain run_tests uses default and includes everything.
[profile.timed]
default-filter = 'binary(speed) and test(/^timed_/)'
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
# `tests/highlighting.mjs` reads the TextMate grammar through `shiki`, which `package.json` pins.
- run: npm ci
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@nextest
# The repository has no `Cargo.lock`. Creating one first makes rust-cache's key change when a dependency publishes a new version.
- run: cargo generate-lockfile
- uses: Swatinem/rust-cache@v2
Expand All @@ -30,7 +31,7 @@ jobs:
- run: node tests/input.mjs
- run: node tests/highlighting.mjs
if: ${{ !cancelled() }}
- run: cargo test --release
- run: cargo nextest run --cargo-profile release -E 'not binary(speed)'
if: ${{ !cancelled() }}
- run: pytest -q
if: ${{ !cancelled() }}
Expand Down
36 changes: 17 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["cli", "py", "wasm", "xtask"]
members = ["cli", "image", "jit", "py", "testkit", "wasm", "xtask"]
default-members = [".", "cli", "py"]

[workspace.metadata.fastfmt]
Expand All @@ -12,14 +12,16 @@ rust-version = "1.98"
license = "Apache-2.0"

[workspace.dependencies]
rustymath = { version = ">=0.1.55, <1", default-features = false }
rustymath = { version = ">=0.1.56, <1", default-features = false }
rustymath-buffer = ">=0.1.55, <1"
rustymath-timing = ">=0.1.56, <1"
pyo3 = ">=0.29.2, <1"
pyo3-build-config = ">=0.29.2, <1"
ctrlc = ">=3.5.2, <4"
kernmini = ">=0.1.22, <1"
# Custom bindings override Emacs Alt-digit prefixes in this fork.
rustyline = { git = "https://github.com/AnswerDotAI/rustyline.git", branch = "master", default-features = false, features = ["custom-bindings", "with-file-history"] }
flate2 = { version = ">=1.1.10, <2", default-features = false, features = ["zlib"] }

[package]
name = "basedpl"
Expand All @@ -34,11 +36,6 @@ doctest = false
# Without a unit-test build, `cargo test` compiles the library only once.
test = false

# Plain `cargo test` skips the timing suite; `cargo test --test speed` runs it.
[[test]]
name = "speed"
test = false

[profile.test]
inherits = "release"

Expand All @@ -52,6 +49,10 @@ incremental = true
# Line tables change with every shifted line and recompile the code below it.
debug = false

[profile.quick]
inherits = "release"
lto = "off"

[profile.dist]
inherits = "release"
lto = "thin"
Expand All @@ -76,11 +77,12 @@ serde = ">=1.0.229, <2"
serde_json = { version = "1", features = ["arbitrary_precision", "preserve_order"] }
unicode-width = { version = ">=0.2.2, <1", default-features = false }
num-rational = ">=0.4.2, <1"
num-complex = { version = ">=0.4.6, <1", features = ["bytemuck"] }
num-complex = ">=0.4.6, <1"
num-bigint = ">=0.4.6, <0.5"
num-traits = ">=0.2.19, <1"
half = { version = ">=2.7.1, <3", features = ["num-traits", "bytemuck"] }
half = { version = ">=2.7.1, <3", features = ["num-traits"] }
rustymath.workspace = true
basedpl-image = { path = "image" }
strength_reduce = ">=0.2.4, <1"
rand = { version = ">=0.10.2, <1", features = ["chacha"] }
# AnswerDotAI's fork measures text with a canvas, which works in a Web Worker: plotters-rs/plotters#746.
Expand All @@ -101,26 +103,18 @@ nix = { version = ">=0.31.3, <1", default-features = false, features = ["user"]

[target.'cfg(target_vendor = "apple")'.dependencies]
# The Mac build links the zlib that macOS ships, in place of compiling `miniz_oxide`.
flate2 = { version = ">=1.1.10, <2", default-features = false, features = ["zlib"] }
flate2.workspace = true

[target.'cfg(not(target_vendor = "apple"))'.dependencies]
flate2 = ">=1.1.10, <2"
# Macs decode and encode images through ImageIO instead.
image = { version = ">=0.25.6, <1", default-features = false, features = ["png", "jpeg"] }
png = ">=0.18.1, <1"

[target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dependencies]
chrono = { version = ">=0.4.45, <0.5", features = ["unstable-locales"] }
icu_normalizer = ">=2, <3"
fancy-regex = "0.20"
walkdir = ">=2.5.0, <3"
globset = ">=0.4.20, <1"
# Cranelift compiles a typed program's loops while BPL runs. The browser build has no JIT.
cranelift-codegen = { version = "0.137", default-features = false, features = ["std", "host-arch"] }
cranelift-frontend = "0.137"
cranelift-jit = "0.137"
cranelift-module = "0.137"
cranelift-native = "0.137"
basedpl-jit = { path = "jit" }

# The browser build. `build.rs` sets `cfg(web)` for the same target.
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
Expand All @@ -133,5 +127,9 @@ wasm-bindgen = ">=0.2.129, <0.3"
# `eval::room` reads the stack pointer for the room left on the browser's main stack, where stacker reports none.
psm = ">=0.1.32, <0.2"

[dev-dependencies]
basedpl-testkit = { path = "testkit" }
rustymath-timing.workspace = true

[build-dependencies]
serde_json = "1"
Loading