-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathtest
executable file
·69 lines (62 loc) · 2.81 KB
/
test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
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
# 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"
)
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
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