-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-everything.sh
More file actions
executable file
·108 lines (96 loc) · 4.2 KB
/
test-everything.sh
File metadata and controls
executable file
·108 lines (96 loc) · 4.2 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
set -euo pipefail
### CROSS-COMPILED PLATFORMS ###
# TODO: Introduce three tiers:
# 1. clippy + build crate with --no-default-features only (can be done
# even on a -none target, should be done on unsupported FP
# configurations like x86 without SSE)
# 2. clippy + build crate & tests (can be done on a cross -linux target))
# 3. clippy + build crate + run tests (native target)
# TODO: Try to run tests via qemu
# TODO: Add windows, wasi and none coverage
# TODO: Add tests (and, if needed, support) for mips, powerpc64, powerpc64le,
# s390x and sparc64
# Runs a cargo command with certain RUSTFLAGS, echoing it beforehand
# Arguments: rustflags command
function cargo_echo() {
command="cargo $2"
printf "\nRUSTFLAGS=\"$1\" $command\n"
RUSTFLAGS="$1" $command
}
# Arguments: target rustflags extra_features +nightly
function cross_build_base() {
for subcommand in 'clippy' 'clippy --tests' 'build' 'build --tests' doc; do
cargo_echo "$2" "$4 ${subcommand} --target=$1 $3"
done
}
# Arguments: target rustflags
# FIXME: Merge those to try nightly everywhere once appropriate toolchains
# and targets are installed
function cross_build() {
cross_build_base "$1" "$2" '--no-default-features' ''
cross_build_base "$1" "$2" '--no-default-features --features=alloc' ''
cross_build_base "$1" "$2" '' ''
cross_build_base "$1" "$2" '--features=safe_arch' ''
}
#
function cross_nightly_build() {
cross_build_base "$1" "$2" '--no-default-features --features=nightly' '+nightly'
cross_build_base "$1" "$2" '--no-default-features --features=nightly,alloc' '+nightly'
cross_build_base "$1" "$2" '--features=nightly' '+nightly'
cross_build_base "$1" "$2" '--features=nightly,safe_arch' '+nightly'
}
for rustflags in '' '-C target-feature=-neon' '-C target-feature=+neon'; do
cross_build aarch64-unknown-linux-gnu "$rustflags"
done
# FIXME: These tests build but do not link at the moment
set +e
for rustflags in '' '-C target-feature=-vfp2' '-C target-feature=+vfp2'; do
cross_build arm-unknown-linux-gnueabi "$rustflags"
done
set -e
# FIXME: These tests build but do not link at the moment
set +e
for rustflags in '' \
'-C target-feature=+sse' \
'-C target-feature=+sse -C target-feature=+sse2'; do
cross_build i586-unknown-linux-gnu "$rustflags"
done
set -e
# TODO: Would like to test riscv32, but no cross-compiler available
for rustflags in '' \
'-C target-feature=-f -C target-feature=-d' \
'-C target-feature=+f -C target-feature=-d' \
'-C target-feature=-f -C target-feature=+d' \
'-C target-feature=+f -C target-feature=+d'; do
cross_build riscv64gc-unknown-linux-gnu "$rustflags"
done
for rustflags in '-C target-feature=+avx512f' \
'-C target-feature=+avx512f -C target-feature=+avx512bw' \
'-C target-feature=+avx512f -C target-feature=+avx512vl' \
'-C target-feature=+avx512f -C target-feature=+avx512bw -C target-feature=+avx512vl' \
'-C target-feature=+avx512f -C target-feature=+avx512bf16' \
'-C target-feature=+avx512f -C target-feature=+avx512bf16 -C target-feature=+avx512vl'; do
cross_nightly_build x86_64-unknown-linux-gnu "$rustflags"
done
### NATIVE PLATFORM ###
for rustflags in '' \
'-C target-feature=+avx' \
'-C target-feature=+avx -C target-feature=+avx2'; do
for subcommand in clippy build; do
for features in '--no-default-features' '' '--features=safe_arch'; do
cargo_echo "$rustflags" "$subcommand $features"
done
done
for config in '' '--release -- --include-ignored'; do
for op in 'test --no-default-features' \
'test --no-default-features --features=alloc' \
'test' \
'+nightly test --no-default-features --features=nightly' \
'+nightly test --no-default-features --features=nightly,alloc' \
'+nightly test --features=nightly' \
'+nightly test --features=default_impl'; do
cargo_echo "$rustflags" "$op $config"
done
done
done