Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/tools/ci/host-gates.sh # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / tools / ci / host-gates.sh` 539 lines · 18839 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 # Fresh-checkout host gates. Reads no GPU device node and does not run make hello-gpu. 4 # 5 # tools/ci/host-gates.sh --self-test checker negative controls (no compile) 6 # tools/ci/host-gates.sh --figures README figure byte check 7 # tools/ci/host-gates.sh make -j4 and the host commands below 8 # 9 # make test is the host-tests job in .github/workflows/ci.yml. This script does not repeat it. 10 # make test-runtime-api is .github/workflows/runtime-api.yml (#189). An x86-64 host-tests 11 # job is #196. Neither is started here. 12 set -euo pipefail 13 export LC_ALL=C 14 15 root=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd) 16 cd "$root" 17 out=build/host-gates 18 mkdir -p "$out" 19 20 # Simulator output of c = a + b over 2^20 floats. Measured by build/hello_gpu --sim. 21 # Pinned so a silent answer change fails even when the program still prints PASS. 22 output_sha='output sha256 `72d0c1b2928779e83518f0b4c7d101d933cf89f210cd4627e138c33c9ce9b6a6`' 23 24 fail=0 25 summary=$out/summary.txt 26 27 note() { printf '%s\n' "$*" | tee -a "$summary"; } 28 29 run_log() { 30 local log=$1 31 shift 32 set +e 33 "$@" >"$log" 2>&1 34 local rc=$? 35 set -e 36 cat "$log" 37 printf '%s\n' "$rc" >"$log.rc" 38 } 39 40 rc_of() { cat "$1.rc"; } 41 42 archives_ok() { 43 local rc=$1 dir=$2 44 [ "$rc" -eq 0 ] || return 1 45 [ -f "$dir/libomega_gpu.a" ] && [ -f "$dir/libcudapp.a" ] 46 } 47 48 artifact_ok() { 49 local rc=$1 log=$2 line 50 [ "$rc" -eq 0 ] || return 1 51 line=$(grep -E '^test_gpu_artifact_export: ' "$log" | tail -n 1 || true) 52 [[ "$line" =~ ^test_gpu_artifact_export:\ [0-9]+\ checks,\ 0\ failed$ ]] 53 } 54 55 zero_cuda_ok() { 56 local rc=$1 log=$2 57 [ "$rc" -eq 0 ] || return 1 58 grep -qF 'ZERO_CUDA SELF-TEST PASS (CUDA probe rejected, clean library accepted)' "$log" || return 1 59 grep -qF 'ZERO_CUDA FAIL' "$log" || return 1 60 grep -qF 'libcudart.so' "$log" || return 1 61 grep -qF 'cudaMalloc' "$log" || return 1 62 grep -qF 'ZERO_CUDA PASS build/hello_gpu needs=' "$log" || return 1 63 grep -qF 'ZERO_CUDA PASS build/gpu_matmul_api_test needs=' "$log" || return 1 64 grep -qF 'ZERO_CUDA SELF-TEST BROKEN' "$log" && return 1 65 return 0 66 } 67 68 sim_ok() { 69 local rc=$1 log=$2 70 [ "$rc" -eq 0 ] || return 1 71 grep -qF 'on the host simulator (no GPU)' "$log" || return 1 72 grep -qF 'checked `1048576` of `1048576` elements: 0 wrong, 0 never written' "$log" || return 1 73 grep -qF 'work: `12582912` bytes moved (`8388608` read, `4194304` written), `1048576` floating-point operations' "$log" || return 1 74 grep -qF "$output_sha" "$log" || return 1 75 grep -qxF 'PASS' "$log" || return 1 76 grep -qE '^machine code sha256 [0-9a-f]{64}$' "$log" || return 1 77 } 78 79 # The fault path exits 1 from inside the launch loop. It prints FAULT and does not print PASS. 80 past_end_ok() { 81 local rc=$1 log=$2 82 [ "$rc" -eq 1 ] || return 1 83 grep -qF 'FAULT at launch 8 of 8 of kernel vecadd (simulator): global load outside every buffer' "$log" || return 1 84 grep -qF '0 bytes past the end of buffer a' "$log" || return 1 85 grep -qF '0 wrong, 0 never written' "$log" && return 1 86 grep -qxF 'PASS' "$log" && return 1 87 return 0 88 } 89 90 gpu_bug_refused_ok() { 91 local rc=$1 log=$2 92 [ "$rc" -eq 2 ] || return 1 93 grep -qF -e '--bug=past-end is only for --sim: on the GPU it would write past a buffer' "$log" || return 1 94 } 95 96 # make's exit status is the decision. Exit 2 is the recipe refusal. Every other exit fails. 97 # The words "Error 1" in make's message are not part of the check. 98 # Every line matching ^[[:space:]]*FAIL([[:space:]]|:|$) is a problem line. 99 # It must equal one of the five missing-hardware lines, whole line, and it counts toward the five. 100 # A longer line, a prefix, or any other FAIL line fails. There must be exactly those five. 101 # The summary line must start with "NOT READY: 5 problems above." 102 doctor_fail_line() { 103 case $1 in 104 ' FAIL NVIDIA kernel module: not loaded (/proc/driver/nvidia/version does not exist)') 105 printf '%s\n' module ;; 106 ' FAIL device files: /dev/nvidiactl is missing') 107 printf '%s\n' ctl ;; 108 ' FAIL device files: /dev/nvidia0 is missing') 109 printf '%s\n' gpu0 ;; 110 ' FAIL device files: /dev/nvidia-uvm is missing') 111 printf '%s\n' uvm ;; 112 ' FAIL GPU: no NVIDIA GPU found in /sys/bus/pci/devices') 113 printf '%s\n' gpu ;; 114 *) 115 return 1 116 ;; 117 esac 118 } 119 120 doctor_ok() { 121 local rc=$1 log=$2 line kind n=0 module=0 ctl=0 gpu0=0 uvm=0 gpu=0 122 local ready_n any_ready 123 [ "$rc" -eq 2 ] || return 1 124 grep -qF 'cudapp doctor: is this machine ready for CUDA++?' "$log" || return 1 125 grep -qF 'NOT_RUN: the target table is seeded Omega' "$log" || return 1 126 if grep -qxF 'READY. Next: make hello-gpu' "$log"; then 127 return 1 128 fi 129 while IFS= read -r line || [ -n "$line" ]; do 130 if [[ "$line" =~ ^[[:space:]]*FAIL([[:space:]]|:|$) ]]; then 131 kind=$(doctor_fail_line "$line") || return 1 132 n=$((n + 1)) 133 case $kind in 134 module) module=$((module + 1)) ;; 135 ctl) ctl=$((ctl + 1)) ;; 136 gpu0) gpu0=$((gpu0 + 1)) ;; 137 uvm) uvm=$((uvm + 1)) ;; 138 gpu) gpu=$((gpu + 1)) ;; 139 *) return 1 ;; 140 esac 141 fi 142 done <"$log" 143 [ "$n" -eq 5 ] || return 1 144 [ "$module" -eq 1 ] && [ "$ctl" -eq 1 ] && [ "$gpu0" -eq 1 ] && [ "$uvm" -eq 1 ] && [ "$gpu" -eq 1 ] || return 1 145 ready_n=$(grep -cE '^NOT READY: 5 problems above\.' "$log" || true) 146 any_ready=$(grep -cE '^NOT READY:' "$log" || true) 147 [ "$ready_n" -eq 1 ] || return 1 148 [ "$any_ready" -eq 1 ] || return 1 149 return 0 150 } 151 152 # RUN when the binary can be executed. FAIL when make -j4 exited 0 and it is missing. 153 # NOT_RUN only when that build already failed. 154 hello_sim_rows() { 155 local make_rc=$1 hello=$2 156 if [ -x "$hello" ]; then 157 printf '%s\n' RUN 158 return 0 159 fi 160 if [ "$make_rc" -eq 0 ]; then 161 printf '%s\n' FAIL 162 return 0 163 fi 164 printf '%s\n' NOT_RUN 165 } 166 167 figures_ok() { 168 local rc=$1 log=$2 169 [ "$rc" -eq 0 ] || return 1 170 grep -qE '^figures current: [0-9]+$' "$log" || return 1 171 grep -qF 'stale figures' "$log" && return 1 172 return 0 173 } 174 175 expect_ok() { 176 local name=$1 177 shift 178 if "$@"; then 179 echo "PASS $name" 180 return 0 181 fi 182 echo "FAIL $name" 183 fail=1 184 return 0 185 } 186 187 expect_reject() { 188 local name=$1 189 shift 190 if "$@"; then 191 echo "FAIL $name (checker accepted a case that must be rejected)" 192 fail=1 193 return 0 194 fi 195 echo "PASS $name" 196 } 197 198 self_test() { 199 local t log 200 t=$(mktemp -d) 201 log=$t/log 202 203 mkdir -p "$t/both" 204 : >"$t/both/libomega_gpu.a" 205 : >"$t/both/libcudapp.a" 206 expect_ok archives-both archives_ok 0 "$t/both" 207 expect_reject archives-missing archives_ok 0 "$t" 208 expect_reject archives-bad-exit archives_ok 2 "$t/both" 209 210 printf '%s\n' 'test_gpu_artifact_export: 47 checks, 0 failed' >"$log" 211 expect_ok artifact-clean artifact_ok 0 "$log" 212 printf '%s\n' 'FAIL tamper caught' 'test_gpu_artifact_export: 47 checks, 0 failed' >"$log" 213 expect_ok artifact-fail-word-kept artifact_ok 0 "$log" 214 printf '%s\n' 'test_gpu_artifact_export: 47 checks, 1 failed' >"$log" 215 expect_reject artifact-failed-count artifact_ok 0 "$log" 216 printf '%s\n' 'test_gpu_artifact_export: 47 checks, 0 failed' >"$log" 217 expect_reject artifact-bad-exit artifact_ok 1 "$log" 218 219 cat >"$log" <<'EOF' 220 ZERO_CUDA FAIL /tmp/probe.so needs: libcudart.so.13 221 ZERO_CUDA FAIL /tmp/probe.so imports: cudaMalloc 222 ZERO_CUDA SELF-TEST PASS (CUDA probe rejected, clean library accepted) 223 ZERO_CUDA PASS build/hello_gpu needs=[libm.so.6 libc.so.6] 224 ZERO_CUDA PASS build/gpu_matmul_api_test needs=[libc.so.6] 225 EOF 226 expect_ok zero-cuda-with-visible-fail zero_cuda_ok 0 "$log" 227 expect_reject zero-cuda-bad-exit zero_cuda_ok 1 "$log" 228 printf '%s\n' 'ZERO_CUDA PASS build/hello_gpu needs=[libc.so.6]' >"$log" 229 expect_reject zero-cuda-hidden-control zero_cuda_ok 0 "$log" 230 231 cat >"$log" <"$log" 241 expect_reject sim-pass-only sim_ok 0 "$log" 242 cat >"$log" <"$log" <<'EOF' 253 FAULT at launch 8 of 8 of kernel vecadd (simulator): global load outside every buffer 254 address: 0x1000 (4 bytes), 0 bytes past the end of buffer a = [0x0, 0x1000) (`4194304` bytes) 255 EOF 256 expect_ok past-end past_end_ok 1 "$log" 257 printf '%s\n' \ 258 'FAULT at launch 8 of 8 of kernel vecadd (simulator): global load outside every buffer' \ 259 '0 bytes past the end of buffer a' \ 260 'checked `1048576` of `1048576` elements: 0 wrong, 0 never written' \ 261 'PASS' >"$log" 262 expect_reject past-end-continued past_end_ok 1 "$log" 263 expect_reject past-end-exit0 past_end_ok 0 "$log" 264 265 printf '%s\n' '--bug=past-end is only for --sim: on the GPU it would write past a buffer' >"$log" 266 expect_ok gpu-bug-refused gpu_bug_refused_ok 2 "$log" 267 expect_reject gpu-bug-exit0 gpu_bug_refused_ok 0 "$log" 268 269 cat >"$log" <<'EOF' 270 cudapp doctor: is this machine ready for CUDA++? 271 FAIL NVIDIA kernel module: not loaded (/proc/driver/nvidia/version does not exist) 272 FAIL device files: /dev/nvidiactl is missing 273 FAIL device files: /dev/nvidia0 is missing 274 FAIL device files: /dev/nvidia-uvm is missing 275 FAIL GPU: no NVIDIA GPU found in /sys/bus/pci/devices 276 NOT READY: 5 problems above. Fix the first FAIL line and run make doctor again. 277 NOT_RUN: the target table is seeded Omega and needs the pinned omc. 278 EOF 279 cp "$log" "$t/doctor-good" 280 expect_ok doctor-not-ready doctor_ok 2 "$log" 281 expect_reject doctor-exit0 doctor_ok 0 "$log" 282 printf '%s\n' 'make: *** [mk/dx-doctor.mk:14: doctor] Error 1' >>"$log" 283 expect_reject doctor-error-text-exit0 doctor_ok 0 "$log" 284 printf '%s\n' 'READY. Next: make hello-gpu' >>"$log" 285 expect_reject doctor-ready-line doctor_ok 2 "$log" 286 grep -qF 'NOT READY:' "$log" || { echo "FAIL doctor fixture lost NOT READY"; fail=1; } 287 288 cp "$t/doctor-good" "$t/doctor-extra" 289 printf '%s\n' ' FAIL device files: /dev/nvidia0 exists but this user cannot open it for reading and writing' >>"$t/doctor-extra" 290 expect_reject doctor-extra-fail doctor_ok 2 "$t/doctor-extra" 291 sed 's/^NOT READY: 5 problems above\./NOT READY: 6 problems above./' "$t/doctor-good" >"$t/doctor-count6" 292 expect_reject doctor-count-6 doctor_ok 2 "$t/doctor-count6" 293 grep -vxF ' FAIL device files: /dev/nvidia-uvm is missing' "$t/doctor-good" >"$t/doctor-missing" 294 expect_reject doctor-missing-allowlisted-line doctor_ok 2 "$t/doctor-missing" 295 expect_reject doctor-exit1 doctor_ok 1 "$t/doctor-good" 296 expect_reject doctor-exit3 doctor_ok 3 "$t/doctor-good" 297 cp "$t/doctor-good" "$t/doctor-noindent" 298 printf '%s\n' 'FAIL x' >>"$t/doctor-noindent" 299 expect_reject doctor-fail-noindent doctor_ok 2 "$t/doctor-noindent" 300 cp "$t/doctor-good" "$t/doctor-tab" 301 printf '\tFAIL x\n' >>"$t/doctor-tab" 302 expect_reject doctor-fail-tab doctor_ok 2 "$t/doctor-tab" 303 304 saved_fail=$fail 305 saved_summary=$summary 306 fail=0 307 summary=$t/missing-hello-summary.txt 308 : >"$summary" 309 record_hello_or_fail 0 "$t/no-such-hello" || true 310 rows=$(grep -c ' FAIL ' "$summary" || true) 311 if [ "$fail" -eq 1 ] && [ "$rows" -eq 3 ]; then 312 echo "PASS missing-hello-after-make" 313 else 314 echo "FAIL missing-hello-after-make (fail=$fail rows=$rows)" 315 saved_fail=1 316 fi 317 fail=0 318 : >"$summary" 319 : >"$t/hello_gpu" 320 chmod +x "$t/hello_gpu" 321 if record_hello_or_fail 0 "$t/hello_gpu"; then 322 echo "PASS hello-present-is-run" 323 else 324 echo "FAIL hello-present-is-run" 325 saved_fail=1 326 fi 327 fail=0 328 : >"$summary" 329 record_hello_or_fail 2 "$t/no-such-hello" || true 330 rows=$(grep -c ' NOT_RUN ' "$summary" || true) 331 bad_rows=$(grep -c ' FAIL ' "$summary" || true) 332 if [ "$fail" -eq 0 ] && [ "$rows" -eq 3 ] && [ "$bad_rows" -eq 0 ]; then 333 echo "PASS missing-hello-after-failed-make" 334 else 335 echo "FAIL missing-hello-after-failed-make (fail=$fail not_run=$rows fail_rows=$bad_rows)" 336 saved_fail=1 337 fi 338 fail=$saved_fail 339 summary=$saved_summary 340 341 printf '%s\n' 'figures current: 10' >"$log" 342 expect_ok figures-current figures_ok 0 "$log" 343 printf '%s\n' 'stale figures (run python3 tools/figures/make_figures.py): stack.svg' >"$log" 344 expect_reject figures-stale figures_ok 1 "$log" 345 printf '%s\n' 'figures current: 10' >"$log" 346 expect_reject figures-bad-exit figures_ok 1 "$log" 347 348 rm -rf "$t" 349 if [ "$fail" -ne 0 ]; then 350 echo "CUDA++ HOST GATES SELF-TEST FAIL" | tee "$out/self-test.txt" 351 exit 1 352 fi 353 echo "CUDA++ HOST GATES SELF-TEST PASS" | tee "$out/self-test.txt" 354 exit 0 355 } 356 357 finish() { 358 echo "----- summary -----" 359 cat "$summary" 360 if [ "$fail" -ne 0 ]; then 361 echo "CUDA++ HOST GATES FAIL" 362 exit 1 363 fi 364 echo "CUDA++ HOST GATES PASS" 365 exit 0 366 } 367 368 record() { 369 # name, exit, result, detail 370 note "$(printf '%s\texit=%s\t%s\t%s' "$1" "$2" "$3" "$4")" 371 if [ "$3" = FAIL ]; then 372 fail=1 373 fi 374 } 375 376 # Returns 0 only when the three simulator commands should run. 377 # A successful make -j4 with no build/hello_gpu records three FAILs. 378 record_hello_or_fail() { 379 local make_rc=$1 hello=$2 how 380 how=$(hello_sim_rows "$make_rc" "$hello") 381 if [ "$how" = RUN ]; then 382 return 0 383 fi 384 if [ "$how" = FAIL ]; then 385 record 'build/hello_gpu --sim' '-' FAIL 'make -j4 exited 0 and build/hello_gpu is missing' 386 record 'build/hello_gpu --sim --bug=past-end' '-' FAIL 'make -j4 exited 0 and build/hello_gpu is missing' 387 record 'build/hello_gpu --bug=past-end' '-' FAIL 'make -j4 exited 0 and build/hello_gpu is missing' 388 return 1 389 fi 390 record 'build/hello_gpu --sim' '-' NOT_RUN 'blocked: build/hello_gpu was not built' 391 record 'build/hello_gpu --sim --bug=past-end' '-' NOT_RUN 'blocked: build/hello_gpu was not built' 392 record 'build/hello_gpu --bug=past-end' '-' NOT_RUN 'blocked: build/hello_gpu was not built' 393 return 1 394 } 395 396 figures_mode() { 397 local log=$out/figures.log rc 398 : >"$summary" 399 run_log "$log" python3 tools/figures/make_figures.py --check 400 rc=$(rc_of "$log") 401 if figures_ok "$rc" "$log"; then 402 record 'python3 tools/figures/make_figures.py --check' "$rc" PASS "$(grep -E '^figures current: ' "$log")" 403 else 404 record 'python3 tools/figures/make_figures.py --check' "$rc" FAIL 'checker rejected the figure output' 405 fi 406 if command -v inkscape >/dev/null 2>&1; then 407 local legend=$out/stack-legend.log 408 run_log "$legend" python3 tools/figures/test_stack_legend.py -v 409 rc=$(rc_of "$legend") 410 if [ "$rc" -eq 0 ]; then 411 record 'python3 tools/figures/test_stack_legend.py' "$rc" PASS 'rendered legend' 412 else 413 record 'python3 tools/figures/test_stack_legend.py' "$rc" FAIL 'legend test failed' 414 fi 415 else 416 record 'python3 tools/figures/test_stack_legend.py' '-' NOT_RUN 'inkscape is not installed' 417 fi 418 finish 419 } 420 421 identity() { 422 { 423 echo "source_sha $(git rev-parse HEAD)" 424 if [ -n "${HOST_GATES_HEAD_SHA:-}" ]; then 425 echo "head_sha ${HOST_GATES_HEAD_SHA}" 426 fi 427 echo "uname $(uname -s -m -r)" 428 if [ -r /etc/os-release ]; then 429 # shellcheck disable=SC1091 430 . /etc/os-release 431 echo "os ${PRETTY_NAME:-unknown}" 432 fi 433 echo "gcc $(gcc --version | head -n 1)" 434 echo "make $(make --version | head -n 1)" 435 echo "python3 $(python3 --version 2>&1)" 436 echo "jobs 4" 437 echo "utc $(date -u +%Y-%m-%dT%H:%M:%SZ)" 438 } | tee "$out/identity.txt" 439 } 440 441 gates() { 442 local log rc make_rc 443 : >"$summary" 444 identity 445 note 'make test exit=- ENFORCED_ELSEWHERE CI job host-tests in .github/workflows/ci.yml' 446 note 'make test-runtime-api exit=- ENFORCED_ELSEWHERE .github/workflows/runtime-api.yml (#189)' 447 note 'x86-64 make test exit=- ENFORCED_ELSEWHERE job x86-host-tests in .github/workflows/host-x86.yml' 448 note 'make hello-gpu exit=- NOT_RUN no GB10 and no /dev/aien-gpu on this runner' 449 450 log=$out/make-j4.log 451 run_log "$log" make -j4 452 make_rc=$(rc_of "$log") 453 rc=$make_rc 454 if archives_ok "$rc" build; then 455 sha256sum build/libomega_gpu.a build/libcudapp.a | tee "$out/archives.sha256" 456 record 'make -j4' "$rc" PASS "$(sed -n '1,2p' "$out/archives.sha256" | tr '\n' ' ')" 457 else 458 record 'make -j4' "$rc" FAIL 'library archives were not produced' 459 fi 460 461 if [ -f build/libomega_gpu.a ]; then 462 log=$out/native-artifact.log 463 run_log "$log" make -j4 test-native-artifact 464 rc=$(rc_of "$log") 465 if artifact_ok "$rc" "$log"; then 466 record 'make test-native-artifact' "$rc" PASS "$(grep -E '^test_gpu_artifact_export: ' "$log" | tail -n 1)" 467 else 468 record 'make test-native-artifact' "$rc" FAIL 'exit code or summary line rejected' 469 fi 470 471 log=$out/zero-cuda.log 472 run_log "$log" make -j4 zero-cuda-gate 473 rc=$(rc_of "$log") 474 if zero_cuda_ok "$rc" "$log"; then 475 record 'make zero-cuda-gate' "$rc" PASS 'self-test FAIL lines kept; binaries PASS' 476 else 477 record 'make zero-cuda-gate' "$rc" FAIL 'exit code or ZERO_CUDA lines rejected' 478 fi 479 else 480 record 'make test-native-artifact' '-' NOT_RUN 'blocked: make -j4 did not produce the library' 481 record 'make zero-cuda-gate' '-' NOT_RUN 'blocked: make -j4 did not produce the library' 482 fi 483 484 if record_hello_or_fail "$make_rc" build/hello_gpu; then 485 log=$out/hello-sim.log 486 run_log "$log" build/hello_gpu --sim 487 rc=$(rc_of "$log") 488 local log2=$out/hello-sim-2.log 489 run_log "$log2" build/hello_gpu --sim 490 local rc2 491 rc2=$(rc_of "$log2") 492 local h1 h2 493 h1=$(grep -E '^(output|machine code) sha256 ' "$log" || true) 494 h2=$(grep -E '^(output|machine code) sha256 ' "$log2" || true) 495 if sim_ok "$rc" "$log" && sim_ok "$rc2" "$log2" && [ -n "$h1" ] && [ "$h1" = "$h2" ]; then 496 record 'build/hello_gpu --sim' "$rc" PASS 'two runs, same output and machine-code hashes' 497 else 498 record 'build/hello_gpu --sim' "$rc" FAIL "repeat exit $rc2; hashes differ or checks missed" 499 fi 500 501 log=$out/hello-past-end.log 502 run_log "$log" build/hello_gpu --sim --bug=past-end 503 rc=$(rc_of "$log") 504 if past_end_ok "$rc" "$log"; then 505 record 'build/hello_gpu --sim --bug=past-end' "$rc" PASS 'negative control: FAULT, exit 1, no PASS' 506 else 507 record 'build/hello_gpu --sim --bug=past-end' "$rc" FAIL 'negative control did not fail closed' 508 fi 509 510 log=$out/hello-bug-refused.log 511 run_log "$log" build/hello_gpu --bug=past-end 512 rc=$(rc_of "$log") 513 if gpu_bug_refused_ok "$rc" "$log"; then 514 record 'build/hello_gpu --bug=past-end' "$rc" PASS 'refused off the simulator' 515 else 516 record 'build/hello_gpu --bug=past-end' "$rc" FAIL 'GPU bug path was not refused' 517 fi 518 fi 519 520 log=$out/doctor.log 521 run_log "$log" make -j4 doctor 522 rc=$(rc_of "$log") 523 if doctor_ok "$rc" "$log"; then 524 record 'make doctor' "$rc" PASS 'NOT READY on this runner; chip qualification NOT_RUN' 525 else 526 record 'make doctor' "$rc" FAIL 'expected the no-GPU refusal, not READY' 527 fi 528 finish 529 } 530 531 case "${1:-}" in 532 --self-test) self_test ;; 533 --figures) figures_mode ;; 534 '') gates ;; 535 *) 536 echo "usage: $0 [--self-test|--figures]" >&2 537 exit 2 538 ;; 539 esac