forked from bytecodealliance/cranelift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-all.sh
executable file
·65 lines (54 loc) · 1.48 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
#!/bin/bash
# This is the top-level test script:
#
# - Build documentation for Rust code in 'src/tools/target/doc'.
# - Run unit tests for all Rust crates.
# - Make a debug build of all crates.
# - Make a release build of cton-util.
# - Run file-level tests with the release build of cton-util.
#
# All tests run by this script should be passing at all times.
# Exit immediately on errors.
set -e
# 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)
$topdir/lib/cretonne/meta/check.sh
touch $tsfile || echo no target directory
fi
PKGS="cretonne cretonne-reader cretonne-tools filecheck"
cd "$topdir"
for PKG in $PKGS
do
banner "Rust $PKG unit tests"
cargo test -p $PKG
done
# Build cton-util for parser testing.
cd "$topdir"
banner "Rust documentation"
echo "open $topdir/target/doc/cretonne/index.html"
cargo doc
banner "Rust release build"
cargo build --release
export CTONUTIL="$topdir/target/release/cton-util"
cd "$topdir"
banner "File tests"
"$CTONUTIL" test filetests docs
banner "OK"