mirror of
https://github.com/BurntSushi/jiff.git
synced 2025-12-23 08:47:45 +00:00
We split Windows out and also cut down on some redundancy in the longest running jobs. I'm not sure how much it will help, but hopefully some.
81 lines
3.3 KiB
Bash
Executable file
81 lines
3.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# This script is used to run a more exhaustive set of tests than what just
|
|
# `cargo test` or even `cargo test --all` will do. Specifically, we run tests
|
|
# under a number of different feature configurations.
|
|
#
|
|
# This is practically necessary because it is very easy to accidentally break
|
|
# a particular feature combination, especially `--no-default-features`.
|
|
|
|
set -e
|
|
|
|
# cd to the directory containing this crate's Cargo.toml so that we don't need
|
|
# to pass --manifest-path to every `cargo` command.
|
|
cd "$(dirname "$0")"
|
|
|
|
# This is a convenience script for running a broad swath of tests across
|
|
# features. We don't test the complete space, since the complete space is quite
|
|
# large.
|
|
echo "===== DEFAULT FEATURES ====="
|
|
cargo test --all
|
|
|
|
echo "===== DEFAULT FEATURES WITH STATIC ====="
|
|
cargo test --features static
|
|
|
|
# This one is useful because sometimes the bundled time zone database can
|
|
# behave differently than the system time zone database depending on the
|
|
# inputs. For example, the bundled database uses as few transitions as possible
|
|
# (this is tzdb's "slim" data model) and thus relies more heavily on POSIX
|
|
# time zone strings. So if there's a bug in POSIX time zone handling, you're
|
|
# likely to see it with the bundled database while missing it completely with
|
|
# the system database.
|
|
echo "===== WITH ONLY THE BUNDLED TIME ZONE DATABASE ====="
|
|
cargo test --no-default-features --features std,tz-system,tzdb-bundle-always
|
|
|
|
# We test core-only mode specially. Sadly, in core-only mode, error messages
|
|
# are quite a bit worse. And this wreaks havoc with Jiff's snapshot tests on
|
|
# error messages. We could `cfg` all of them, but that's a huge pain and it's
|
|
# not clear that it's worth it.
|
|
#
|
|
# Since we use snapshot tests for more than error messages, this technique also
|
|
# risks accidentally passing a test that doesn't involve error messages. Sigh.
|
|
# We accept this risk because this still runs a lot of tests, and the tests
|
|
# that aren't covered are run in other configurations. Still, it's not ideal.
|
|
echo "===== CORE ONLY ====="
|
|
cargo build --no-default-features
|
|
INSTA_FORCE_PASS=1 INSTA_UPDATE=no cargo test --lib --no-default-features
|
|
INSTA_FORCE_PASS=1 INSTA_UPDATE=no cargo test --test integration --no-default-features
|
|
|
|
# More core-only tests, when combined with compatible features.
|
|
features=(
|
|
"serde"
|
|
"logging"
|
|
"serde logging"
|
|
"static"
|
|
)
|
|
for f in "${features[@]}"; do
|
|
echo "===== COREONLY PLUS '$f' ====="
|
|
cargo build --no-default-features --features "$f"
|
|
INSTA_FORCE_PASS=1 INSTA_UPDATE=no cargo test --lib --no-default-features --features "$f"
|
|
INSTA_FORCE_PASS=1 INSTA_UPDATE=no cargo test --test integration --no-default-features --features "$f"
|
|
done
|
|
|
|
exit 0
|
|
features=(
|
|
"alloc"
|
|
"alloc tzdb-bundle-always"
|
|
"alloc serde"
|
|
"std"
|
|
"std tzdb-bundle-platform tzdb-bundle-always"
|
|
"std tzdb-bundle-platform tzdb-bundle-always tzdb-zoneinfo"
|
|
"std tzdb-bundle-platform tzdb-zoneinfo"
|
|
"std tzdb-bundle-always tzdb-zoneinfo"
|
|
"std tzdb-bundle-always logging"
|
|
"std tzdb-bundle-always serde"
|
|
)
|
|
for f in "${features[@]}"; do
|
|
echo "===== FEATURES: '$f' ====="
|
|
cargo build --no-default-features --features "$f"
|
|
cargo test --lib --no-default-features --features "$f"
|
|
cargo test --test integration --no-default-features --features "$f"
|
|
done
|