treefmt/ci.sh
a-kenji 6e5f58862e fix: flaky tests
Fix flaky tests that use `std::env::set_var`.

`std::env::set_var` is not safe to be used in parallel.

Reproducer:
``` bash
for _ in {0..100}; do
  cargo t current_dir || exit 1
done
```
Will fail very fast.

Doesn't fail:
```bash
for _ in {0..100}; do
  cargo t current_dir_prefers_pwd_env_var || exit 1
  cargo t current_dir_uses_dereferenced_path_when_pwd_env_var_not_set || exit 1
done
```

Reference: https://github.com/rust-lang/rust/issues/27970
2023-09-28 15:29:35 +02:00

14 lines
347 B
Bash
Executable File

#!/usr/bin/env bash
# nix-shell loads the devshell making rust and all the formatters available.
set -exuo pipefail
# Quick sanity check
cargo test
cargo test -- --ignored --test-threads=1
# Check that no code needs reformatting. Acts as a minimal integration test.
cargo run -- --fail-on-change
# Build the nix package
nix-build --no-out-link