blob: 074371515e45bb2152678d5faf54db6173f94b08 (
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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
#!/usr/bin/env bash
set -euo pipefail
. .github/scripts/linux-ci-image-inputs.sh
is_linux_ci_image_input() {
local profile=$1
local path=$2
local input inputs
if ! inputs="$(linux_ci_image_inputs "$profile")"; then
return 2
fi
while IFS= read -r input; do
if [ "$path" = "$input" ]; then
return 0
fi
done <<< "$inputs"
return 1
}
linux_ci_image_set_for_inputs() {
local normal=false tsan=false path
for path in "$@"; do
if is_linux_ci_image_input normal-noble "$path" ||
is_linux_ci_image_input normal-bookworm "$path" ||
is_linux_ci_image_input armhf-cross-bookworm "$path" ||
is_linux_ci_image_input armhf-runtime-bookworm "$path"; then
normal=true
fi
if is_linux_ci_image_input tsan-noble "$path"; then
tsan=true
fi
done
if [ "$normal" = true ] && [ "$tsan" = true ]; then
echo normal-and-tsan
elif [ "$normal" = true ]; then
echo normal
elif [ "$tsan" = true ]; then
echo tsan
else
echo none
fi
}
expect_input() {
if ! is_linux_ci_image_input "$1" "$2"; then
echo "self-test failed: expected $1 image input: $2" >&2
exit 1
fi
}
expect_non_input() {
if is_linux_ci_image_input "$1" "$2"; then
echo "self-test failed: unexpected $1 image input: $2" >&2
exit 1
fi
}
expect_image_set() {
local expected=$1
shift
local actual
actual="$(linux_ci_image_set_for_inputs "$@")"
if [ "$actual" != "$expected" ]; then
echo "self-test failed: expected image set $expected, got $actual" >&2
exit 1
fi
}
if [ "${1:-}" = "--self-test" ]; then
expect_input normal-noble ".github/images/linux-ci/Dockerfile.noble"
expect_input tsan-noble ".github/images/linux-ci/Dockerfile.noble"
expect_input normal-bookworm ".github/images/linux-ci/Dockerfile.bookworm"
expect_input armhf-cross-bookworm ".github/images/linux-ci/Dockerfile.armhf-cross"
expect_input armhf-runtime-bookworm ".github/images/linux-ci/Dockerfile.armhf-runtime"
expect_input armhf-runtime-bookworm ".github/images/linux-ci/install-armhf-runtime-packages.sh"
expect_non_input normal-noble ".github/images/linux-ci/install-armhf-runtime-packages.sh"
expect_input armhf-cross-bookworm ".github/images/linux-ci/armhf-cross-toolchain.config"
expect_non_input armhf-runtime-bookworm ".github/images/linux-ci/armhf-cross-toolchain.config"
expect_input armhf-cross-bookworm ".github/scripts/armhf-toolchain-config.sh"
expect_input armhf-runtime-bookworm ".github/scripts/armhf-toolchain-config.sh"
expect_input normal-noble ".github/scripts/build-hamlib-linux.sh"
expect_non_input tsan-noble ".github/scripts/build-hamlib-linux.sh"
expect_input tsan-noble ".github/scripts/build-qt-tsan-linux.sh"
expect_non_input normal-noble ".github/scripts/build-qt-tsan-linux.sh"
expect_input normal-noble ".github/scripts/verify-linux-ci-image.sh"
expect_input tsan-noble ".github/scripts/verify-linux-ci-image.sh"
expect_non_input normal-noble ".github/workflows/build-linux.yml"
expect_non_input tsan-noble "CMake/Sources.cmake"
expect_non_input normal-bookworm ".github/scripts/build-boost-macos.sh"
expect_image_set normal ".github/scripts/build-hamlib-linux.sh"
expect_image_set tsan ".github/scripts/build-qt-tsan-linux.sh"
expect_image_set normal-and-tsan ".github/scripts/verify-linux-ci-image.sh"
expect_image_set normal-and-tsan \
".github/scripts/build-hamlib-linux.sh" \
".github/scripts/build-qt-tsan-linux.sh"
expect_image_set none "CMake/Sources.cmake"
if is_linux_ci_image_input unsupported ".github/images/linux-ci/Dockerfile.noble" 2>/dev/null; then
echo "self-test failed: unsupported image profile was accepted" >&2
exit 1
elif [ "$?" -ne 2 ]; then
echo "self-test failed: unsupported image profile did not return status 2" >&2
exit 1
fi
exit 0
fi
if [ "${1:-}" = "--classify" ]; then
shift
if [ "$#" -eq 0 ]; then
echo "Usage: is-linux-ci-image-input.sh --classify PATH [PATH ...]" >&2
exit 2
fi
linux_ci_image_set_for_inputs "$@"
exit 0
fi
if [ "$#" -ne 2 ]; then
echo "Usage: is-linux-ci-image-input.sh PROFILE PATH | --classify PATH [PATH ...]" >&2
exit 2
fi
is_linux_ci_image_input "$1" "$2"
|