runtime-headers.sh (1733B)
1 #!/bin/sh 2 # Tier 1 system sentinel for runtime headers across the cheap target set. 3 4 set -u 5 6 script_dir=$(cd "$(dirname "$0")" && pwd) 7 repo_root=$(cd "$script_dir/../../.." && pwd) 8 manifest="$repo_root/test/tier1/manifests/system/runtime-headers.txt" 9 log_dir="${KIT_TIER1_LOG_DIR:-$repo_root/build/test/tier1/logs/system/runtime-headers}" 10 KIT="${KIT:-$repo_root/build/kit}" 11 12 mkdir -p "$log_dir" 13 14 run_step() { 15 name=$1 16 shift 17 log="$log_dir/$name.log" 18 printf 'tier1/runtime-headers: %s\n' "$name" 19 "$@" > "$log" 2>&1 20 rc=$? 21 if [ "$rc" -eq 0 ]; then 22 printf ' ok: %s\n' "$log" 23 return 0 24 fi 25 printf ' FAIL: %s (exit %s)\n' "$log" "$rc" >&2 26 tail -n 80 "$log" >&2 27 return "$rc" 28 } 29 30 if [ ! -f "$manifest" ]; then 31 printf 'tier1/runtime-headers: manifest missing: %s\n' "$manifest" >&2 32 exit 2 33 fi 34 35 targets= 36 count=0 37 while IFS= read -r target || [ -n "$target" ]; do 38 target=${target%%#*} 39 target=$(printf '%s' "$target" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') 40 [ -n "$target" ] || continue 41 if [ -n "$targets" ]; then 42 targets="$targets $target" 43 else 44 targets="$target" 45 fi 46 count=$((count + 1)) 47 done < "$manifest" 48 49 if [ "$count" -eq 0 ]; then 50 printf 'tier1/runtime-headers: manifest has no target triples: %s\n' "$manifest" >&2 51 exit 2 52 fi 53 54 for target in $targets; do 55 out="$repo_root/build/test/rt-headers/$target/smoke.o" 56 mkdir -p "$(dirname "$out")" 57 run_step "rt-header-$target" "$KIT" cc -target "$target" -Werror \ 58 -c "$repo_root/test/rt/smoke.c" -o "$out" || exit $? 59 if [ ! -s "$out" ]; then 60 printf 'tier1/runtime-headers: missing compiled header smoke: %s\n' "$out" >&2 61 exit 1 62 fi 63 done