blob: 972e0986f4f167e0ef87610d33e8180e5ba1ece0 (
plain)
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
70
71
|
#!/bin/sh
#
# Run the automated tests for the project.
set -eu
die() {
echo "$@" >&1
exit 1
}
hideok=chronic
image=''
if ! command -v chronic >/dev/null; then
hideok=
fi
while [ "$#" -gt 0 ]; do
case "$1" in
-v | --verbose)
hideok=
shift
;;
-i | --image)
shift
if [ "$#" = 0 ]; then
die "--image MUST have an argument"
fi
image="$1"
shift
;;
*)
break
;;
esac
done
require_cmd() {
if ! command -v "$1" >/dev/null; then
echo "Need to have $1 installed, but can't find it" 1>&2
return 1
fi
}
got_cargo_cmd() {
cargo "$1" --help >/dev/null
}
require_cmd rustc
require_cmd cc
require_cmd cargo
require_cmd python3
require_cmd subplot
$hideok cargo --version
$hideok rustc --version
got_cargo_cmd clippy && cargo clippy --all-targets -q
$hideok cargo build --all-targets
got_cargo_cmd fmt && $hideok cargo fmt -- --check
$hideok cargo test
subplot docgen ambient-driver.subplot -o ambient-driver.html
target="$(cargo metadata --format-version=1 | python3 -c 'import sys, json; o = json.load(sys.stdin); print(o["target_directory"])')"
subplot codegen ambient-driver.subplot -o test.py
rm -f test.log
$hideok python3 test.py --log test.log --env "CARGO_TARGET_DIR=$target" --env "IMAGE=$image" "$@"
echo "Everything seems to be in order."
|