forked from bytecodealliance/cranelift
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest-all.sh
executable file
·66 lines (55 loc) · 1.78 KB
/
test-all.sh
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
#!/bin/bash
set -euo pipefail
# This is the top-level test script:
#
# - Make a debug build.
# - Make a release build.
# - Run unit tests for all Rust crates (including the filetests)
# - Build API documentation.
#
# All tests run by this script should be passing at all times.
# Disable generation of .pyc files because they cause trouble for vendoring
# scripts, and this is a build step that isn't run very often anyway.
export PYTHONDONTWRITEBYTECODE=1
# Repository top-level directory.
cd $(dirname "$0")
topdir=$(pwd)
function banner() {
echo "====== $@ ======"
}
# Run rustfmt if we have it.
if $topdir/check-rustfmt.sh; then
banner "Rust formatting"
$topdir/format-all.sh --write-mode=diff
fi
# Check if any Python files have changed since we last checked them.
tsfile=$topdir/target/meta-checked
if [ -f $tsfile ]; then
needcheck=$(find $topdir/lib/cretonne/meta -name '*.py' -newer $tsfile)
else
needcheck=yes
fi
if [ -n "$needcheck" ]; then
banner "$(python --version 2>&1), $(python3 --version 2>&1)"
$topdir/lib/cretonne/meta/check.sh
touch $tsfile || echo no target directory
fi
# Make sure the code builds in debug mode.
banner "Rust debug build"
cargo build
# Make sure the code builds in release mode, and run the unit tests. We run
# these in release mode for speed, but note that the top-level Cargo.toml file
# does enable debug assertions in release builds.
banner "Rust release build and unit tests"
cargo test --all --release
# Make sure the documentation builds.
banner "Rust documentation: $topdir/target/doc/cretonne/index.html"
cargo doc
# Run clippy if we have it.
banner "Rust linter"
if $topdir/check-clippy.sh; then
$topdir/clippy-all.sh --write-mode=diff
else
echo "\`cargo +nightly install clippy\` for optional rust linting"
fi
banner "OK"