interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / tests / hw / run.sh

273 lines · 17768 bytes Raw Blame History
1#!/bin/sh
2# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3# Hardware capability manifest gate (DRA-400/401): builds hwman from backend/hw/*.om with the pinned
4# seeded omc, checks backend/hw/manifest.tsv, runs the full target lifecycle on every admitted row
5# (discover -> claim -> prepare -> submit -> complete -> quiesce -> release) and every refusal control.
6# Everything that decides is seeded Omega (hwman); this script only coordinates and compares with
7# independent oracles:
8# CPU values computed in the Wolfram Language (queries recorded below), compared through EXPECT
9# TPM tpm2_getcap properties-fixed (tpm2-tools, ESAPI) for manufacturer and firmware words
10# Results are CHIP_TESTED only for the device the run actually touched; every other row is unchanged.
11# The CPU runs must be pinned to one processor of the admitted row (default: processor 19, a
12# Cortex-X925 on GB10); HW_CPU selects another.
13#
14# usage: run.sh /abs/path/to/pinned-omc
15# Environment: HW_CPU (processor, default 19), HW_OUT (output dir to keep; default a new temp dir),
16# HW_NO_TPM=1 makes every TPM check NOT_RUN.
17# Fault injection for the state-persistence and fault-oracle controls uses strace -e inject (strace
18# 6.8, an outside test tool only; it never runs in hwman's production path). Without strace those
19# controls are NOT_RUN.
20# Exit: 0 HW PASS (NOT_RUN checks listed); 1 FAIL; 64 usage; 69 pin refused; 74 I/O;
21# 77 NOT_RUN (not Linux AArch64).
22set -u
23LC_ALL=C
24export LC_ALL
25
26if [ "$(uname -s)" != Linux ] || [ "$(uname -m)" != aarch64 ]; then
27 echo 'NOT_RUN: the hardware manifest gate needs Linux AArch64 and the pinned seeded omc' >&2
28 exit 77
29fi
30if [ "$#" -ne 1 ]; then echo 'usage: run.sh /absolute/path/to/pinned-omc' >&2; exit 64; fi
31omc=$1
32case $omc in /*) ;; *) echo 'usage: omc path must be absolute' >&2; exit 64 ;; esac
33# omc: omega-mv e5b32567 seed/out/omc, equal to its committed seed/out/omc.sha256.
34omc_pin=2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f
35digest() { d=$(sha256sum < "$1") || return 1; printf '%s\n' "${d%% *}"; }
36[ "$(digest "$omc")" = "$omc_pin" ] || { echo "REFUSED: $omc digest differs from pin $omc_pin" >&2; exit 69; }
37
38root=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd) || exit 74
39out=${HW_OUT:-$(mktemp -d "${TMPDIR:-/tmp}/cudapp-hw.XXXXXX")} || exit 74
40mkdir -p "$out" || exit 74
41cpu=${HW_CPU:-19}
42echo "PIN omc $omc_pin"
43echo "Outputs: $out"
44
45npass=0; nfail=0; nnr=0
46ok() { npass=$((npass + 1)); echo "PASS $*"; }
47bad() { nfail=$((nfail + 1)); echo "FAIL $*"; }
48notrun() { nnr=$((nnr + 1)); echo "NOT_RUN $*"; }
49# expect RC NAME cmd...: the command must exit RC (stdout+stderr kept in $out/NAME.log)
50expect() {
51 want=$1; name=$2; shift 2
52 "$@" > "$out/$name.log" 2>&1
53 got=$?
54 if [ "$got" -eq "$want" ]; then ok "$name exit=$got $(tail -n 1 "$out/$name.log")"; else bad "$name exit=$got want=$want $(tail -n 1 "$out/$name.log")"; fi
55}
56# mutate NAME AWKPROGRAM: write $out/NAME.tsv from the manifest through awk (tab-separated)
57mutate() { awk -F '\t' -v OFS='\t' "$2" "$M" > "$out/$1.tsv" || exit 74; }
58# says NAME PATTERN: the last line of $out/NAME.log must match the grep pattern (the refusal class)
59says() { tail -n 1 "$out/$1.log" | grep -q "$2" && ok "$1-class $2" || bad "$1-class want $2 got $(tail -n 1 "$out/$1.log")"; }
60
61# 1. Build hwman from the four units with the pinned omc.
62M=$root/backend/hw/manifest.tsv
63H=$out/hwman
64srcs="$root/backend/hw/core.om $root/backend/hw/cpu.om $root/backend/hw/tpm.om $root/backend/hw/main.om"
65# shellcheck disable=SC2086
66cat $srcs | timeout 120 "$omc" > "$H" 2> "$out/hwman.compile.err"
67rc=$?
68if [ "$rc" -ne 0 ] || [ -s "$out/hwman.compile.err" ] || [ ! -s "$H" ]; then
69 cat "$out/hwman.compile.err"; echo "FAIL compile hwman exit $rc"; exit 1
70fi
71chmod 700 "$H" || exit 74
72for s in $srcs "$M"; do echo "SRC ${s#"$root"/} $(digest "$s")"; done
73echo "COMPILE hwman bin=$(digest "$H")"
74P="taskset -c $cpu"
75
76# 2. Manifest: the checked-in register passes; every mutated copy is refused (exit 3).
77expect 0 manifest-check "$H" check "$M"
78expect 0 manifest-doctor "$H" doctor "$M"
79grep -q '^CHECK rows=[0-9]* families=21 admitted=2$' "$out/manifest-check.log" \
80 && ok "manifest-families $(cat "$out/manifest-check.log")" || bad "manifest-families $(cat "$out/manifest-check.log")"
81mutate m-schema 'NR==1{$0="hwman\t2"}1'; expect 3 neg-manifest-schema "$H" check "$out/m-schema.tsv"
82mutate m-header 'NR==2{$3="maker"}1'; expect 3 neg-manifest-header "$H" check "$out/m-header.tsv"
83mutate m-cols '$1=="tpm-ntc-npct75x"{NF=24}1'; expect 3 neg-manifest-fieldcount "$H" check "$out/m-cols.tsv"
84mutate m-empty '$1=="qpu-ibm"{$3=""}1'; expect 3 neg-manifest-emptyfield "$H" check "$out/m-empty.tsv"
85mutate m-idch '$1=="qpu-ibm"{$1="QPU_ibm"}1'; expect 3 neg-manifest-idcharset "$H" check "$out/m-idch.tsv"
86mutate m-dup '$1=="qpu-ibm"{$1="lpu-groq"}1'; expect 3 neg-manifest-duplicate "$H" check "$out/m-dup.tsv"
87mutate m-fam '$1=="qpu-ibm"{$2="QUANTUM"}1'; expect 3 neg-manifest-family "$H" check "$out/m-fam.tsv"
88mutate m-admit '$1=="cpu-gb10-a725"{$23="YES";$25="-"}1'; expect 3 neg-manifest-admit-without-evidence "$H" check "$out/m-admit.tsv"
89mutate m-blk '$1=="lpu-groq"{$25="-"}1'; expect 3 neg-manifest-blocked-without-blocker "$H" check "$out/m-blk.tsv"
90mutate m-unres '$1=="ppu-unresolved"{$22="BLOCKED_ACCESS"}1'; expect 3 neg-manifest-unresolved-route "$H" check "$out/m-unres.tsv"
91mutate m-tmo '$1=="cpu-gb10-x925"{$21="2s"}1'; expect 3 neg-manifest-timeout "$H" check "$out/m-tmo.tsv"
92mutate m-miss '$2!="BPU"'; expect 3 neg-manifest-missing-family "$H" check "$out/m-miss.tsv"
93# Runner binding: the closed runner table (core.om TRUN) refuses invented operations and runners.
94mutate m-cpuop '$1=="cpu-gb10-x925"{$12="sumsq64,fnv1a64,matmul"}1'
95expect 3 neg-manifest-cpu-op "$H" check "$out/m-cpuop.tsv"; says neg-manifest-cpu-op 'runner_op line='
96mutate m-tpmop '$1=="tpm-ntc-npct75x"{$12="props,getrandom,seal"}1'
97expect 3 neg-manifest-tpm-op "$H" check "$out/m-tpmop.tsv"; says neg-manifest-tpm-op 'runner_op line='
98mutate m-runner '$1=="cpu-gb10-x925"{$20="hwman-gpu"}1'
99expect 3 neg-manifest-unknown-runner "$H" check "$out/m-runner.tsv"; says neg-manifest-unknown-runner 'unknown_runner line='
100mutate m-famrun '$1=="tpm-ntc-npct75x"{$20="hwman-cpu"}1'
101expect 3 neg-manifest-runner-family "$H" check "$out/m-famrun.tsv"; says neg-manifest-runner-family 'runner_family_route line='
102mutate m-auth '$1=="cpu-gb10-x925"{$6="DIRECT_DEVICE"}1'
103expect 3 neg-manifest-runner-route "$H" check "$out/m-auth.tsv"; says neg-manifest-runner-route 'runner_family_route line='
104expect 74 neg-manifest-absent "$H" check "$out/absent.tsv"
105expect 2 neg-usage "$H" run "$M"
106
107# 3. Admission.
108expect 0 admit-cpu "$H" admit "$M" sumsq64 cpu-gb10-x925
109expect 4 neg-admit-unknown-target "$H" admit "$M" sumsq64 cpu-gb10-x926
110expect 5 neg-admit-unsupported-op "$H" admit "$M" getrandom cpu-gb10-x925
111expect 5 neg-admit-no-target "$H" admit "$M" matmul
112expect 6 neg-admit-not-admitted "$H" admit "$M" sumsq64 cpu-gb10-a725
113expect 6 neg-admit-gpu-lease "$H" admit "$M" cudapp-kernels gpu-gb10-sm121
114expect 3 neg-admit-runner-route "$H" admit "$out/m-auth.tsv" sumsq64 cpu-gb10-x925
115mutate m-off '$1=="cpu-gb10-x925"{$9="/sys/devices/system/nocpu"}1'
116expect 10 neg-admit-offline "$H" admit "$out/m-off.tsv" sumsq64 cpu-gb10-x925
117
118# 4. CPU lifecycle. Oracles, Wolfram Language (WolframLanguageEvaluator):
119# ss[n_]:=Mod[Sum[i^2,{i,0,n-1}],2^64]
120# fnv[n_]:=Fold[Mod[BitXor[#1,#2]*1099511628211,2^64]&,14695981039346656037,Mod[Range[0,n-1],251]]
121# {ss[1],ss[1000],ss[16777216],fnv[1],fnv[1000],fnv[1000000]} ->
122# {0,332833500,6148773953750958080,12638153115695167455,10432030352173600877,4529795169249947525}
123S=$out/cpu.state
124rm -f "$S"
125g=0
126for c in sumsq64:1:0 sumsq64:1000:332833500 sumsq64:16777216:6148773953750958080 \
127 fnv1a64:1:12638153115695167455 fnv1a64:1000:10432030352173600877 fnv1a64:1000000:4529795169249947525; do
128 op=${c%%:*}; r=${c#*:}; n=${r%%:*}; v=${r#*:}
129 expect 0 "cpu-$op-$n" $P "$H" run "$M" cpu-gb10-x925 "$op" "$n" "$g" "$S" "$v"
130 g=$((g + 1))
131done
132[ "$(cat "$S")" = "$g cpu-gb10-x925" ] && ok "cpu-handle generation=$g" || bad "cpu-handle $(cat "$S")"
133grep -q "midr_el1=0x410fd851" "$out/cpu-sumsq64-1.log" && ok "cpu-identity $(head -n 1 "$out/cpu-sumsq64-1.log")" \
134 || bad "cpu-identity $(head -n 1 "$out/cpu-sumsq64-1.log")"
135expect 7 neg-cpu-stale-replay $P "$H" run "$M" cpu-gb10-x925 sumsq64 1000 0 "$S" 332833500
136expect 12 neg-cpu-oracle-mismatch $P "$H" run "$M" cpu-gb10-x925 sumsq64 1000 "$g" "$S" 332833501
137g=$((g + 1))
138expect 14 neg-cpu-arg-zero $P "$H" run "$M" cpu-gb10-x925 sumsq64 0 "$g" "$S"
139expect 14 neg-cpu-arg-over $P "$H" run "$M" cpu-gb10-x925 fnv1a64 16777217 "$g" "$S"
140expect 14 neg-cpu-arg-malformed $P "$H" run "$M" cpu-gb10-x925 fnv1a64 12x "$g" "$S"
141expect 14 neg-cpu-gen-malformed $P "$H" run "$M" cpu-gb10-x925 fnv1a64 1 -1 "$S"
142expect 5 neg-cpu-unsupported-op $P "$H" run "$M" cpu-gb10-x925 getrandom 1 "$g" "$S"
143expect 4 neg-cpu-unknown-target $P "$H" run "$M" cpu-gb10-x9250 sumsq64 1 "$g" "$S"
144mutate m-midr '$1=="cpu-gb10-x925"{$8="midr_el1=0x410fd871"}1'
145expect 8 neg-cpu-wrong-device $P "$H" run "$out/m-midr.tsv" cpu-gb10-x925 sumsq64 1 "$g" "$S" 0
146expect 3 neg-cpu-runner-route $P "$H" run "$out/m-auth.tsv" cpu-gb10-x925 sumsq64 1 "$g" "$S" 0
147expect 10 neg-cpu-offline $P "$H" run "$out/m-off.tsv" cpu-gb10-x925 sumsq64 1 "$g" "$S" 0
148expect 6 neg-gpu-not-admitted $P "$H" run "$M" gpu-gb10-sm121 cudapp-kernels 1 0 "$out/gpu.state"
149says neg-gpu-not-admitted '^REFUSE not_admitted target=gpu-gb10-sm121 '
150[ ! -e "$out/gpu.state" ] && ok "gpu-no-claim state file never created" || bad "gpu-no-claim state file created"
151mutate m-t0 '$1=="cpu-gb10-x925"{$21="0"}1'
152expect 11 neg-cpu-timeout $P "$H" run "$out/m-t0.tsv" cpu-gb10-x925 sumsq64 16777216 "$g" "$S" 6148773953750958080
153says neg-cpu-timeout '^REFUSE timeout elapsed_ns=[0-9]* budget_ns=0$'
154g=$((g + 1))
155# busy: another process holds the handle lock
156flock -x "$S" sleep 3 &
157lp=$!
158sleep 1
159expect 9 neg-cpu-busy $P "$H" run "$M" cpu-gb10-x925 sumsq64 1 "$g" "$S" 0
160wait "$lp"
161expect 0 cpu-after-busy $P "$H" run "$M" cpu-gb10-x925 sumsq64 1 "$g" "$S" 0
162g=$((g + 1))
163printf '0 tpm-ntc-npct75x\n' > "$out/wrong.state"
164expect 7 neg-cpu-wrong-handle $P "$H" run "$M" cpu-gb10-x925 sumsq64 1 0 "$out/wrong.state" 0
165printf '7x cpu-gb10-x925\n' > "$out/corrupt.state"
166expect 7 neg-cpu-corrupt-handle $P "$H" run "$M" cpu-gb10-x925 sumsq64 1 7 "$out/corrupt.state" 0
167# Binding controls on the live handle: refused before discovery or claim, the handle never moves.
168cp "$S" "$out/cpu.before" || exit 74
169expect 3 neg-cpu-invented-op $P "$H" run "$out/m-cpuop.tsv" cpu-gb10-x925 matmul 1 "$g" "$S"
170expect 3 neg-cpu-invented-runner $P "$H" run "$out/m-runner.tsv" cpu-gb10-x925 sumsq64 1 "$g" "$S" 0
171cmp -s "$S" "$out/cpu.before" && ok "cpu-binding-no-advance $(cat "$S")" || bad "cpu-binding-no-advance $(cat "$S")"
172# State persistence: a fresh handle at generation 1, then the run that would advance it to 2 with a
173# fault injected into the handle file (strace -P STATE). hwman writes 'x' at byte 0 and syncs before
174# submission (pwrite64 1, fsync 1), then the record from byte 1 (pwrite64 2, fsync 2) and byte 0.
175# persist NAME INJECT: refuse 74, no PASS, byte 0 still 'x', and generations 0, 1, 2 all refused (7).
176persist() {
177 st=$out/$1.state
178 rm -f "$st"
179 $P "$H" run "$M" cpu-gb10-x925 sumsq64 1 0 "$st" 0 > "$out/$1.seed.log" 2>&1 || { bad "$1-seed"; return; }
180 expect 74 "$1" $P strace -qq -o "$out/$1.strace" -P "$st" -e trace=pwrite64,fsync -e "inject=$2" \
181 "$H" run "$M" cpu-gb10-x925 sumsq64 1000 1 "$st" 332833500
182 says "$1" '^REFUSE state_write_failed state='
183 grep -q 'outcome=PASS' "$out/$1.log" && bad "$1-no-pass" || ok "$1-no-pass"
184 [ "$(head -c 1 "$st")" = x ] && ok "$1-poisoned" || bad "$1-poisoned $(cat "$st")"
185 for rg in 0 1 2; do expect 7 "$1-replay-$rg" $P "$H" run "$M" cpu-gb10-x925 sumsq64 1 "$rg" "$st" 0; done
186}
187if command -v strace > /dev/null 2>&1; then
188 persist neg-persist-failed-write 'pwrite64:error=ENOSPC:when=2'
189 persist neg-persist-short-write 'pwrite64:retval=3:when=2'
190 persist neg-persist-failed-sync 'fsync:error=EIO:when=2'
191 # the in-flight mark itself fails: refused before submission, the handle is untouched
192 st=$out/neg-persist-inflight.state
193 rm -f "$st"
194 $P "$H" run "$M" cpu-gb10-x925 sumsq64 1 0 "$st" 0 > "$out/neg-persist-inflight.seed.log" 2>&1 || bad "neg-persist-inflight-seed"
195 expect 74 neg-persist-inflight $P strace -qq -o "$out/neg-persist-inflight.strace" -P "$st" -e trace=pwrite64,fsync \
196 -e 'inject=pwrite64:error=EIO:when=1' "$H" run "$M" cpu-gb10-x925 sumsq64 1000 1 "$st" 332833500
197 grep -q '^STEP submit' "$out/neg-persist-inflight.log" && bad "neg-persist-inflight-no-submit" || ok "neg-persist-inflight-no-submit"
198 expect 0 persist-inflight-handle-kept $P "$H" run "$M" cpu-gb10-x925 sumsq64 1000 1 "$st" 332833500
199else
200 notrun "neg-persist-*: strace absent (fault injection)"
201fi
202notrun "neg-cpu-unpinned: needs a CPU set wider than the one processor this run is allotted"
203notrun "cpu-gb10-a725: no Cortex-A725 processor allotted to this run"
204
205# 5. TPM lifecycle against tpm2_getcap (independent ESAPI client).
206T=$out/tpm.state
207rm -f "$T"
208if [ "${HW_NO_TPM:-0}" = 1 ] || [ ! -e /dev/tpmrm0 ]; then
209 notrun "tpm: HW_NO_TPM=1 or /dev/tpmrm0 absent"
210else
211 expect 0 admit-any-getrandom "$H" admit "$M" getrandom
212 expect 0 tpm-props $P "$H" run "$M" tpm-ntc-npct75x props 0 0 "$T"
213 if command -v tpm2_getcap > /dev/null 2>&1; then
214 tpm2_getcap -T device:/dev/tpmrm0 properties-fixed > "$out/tpm2_getcap.txt" 2>&1
215 raw() { awk -v k="$1:" '$1==k{getline; print tolower($2); exit}' "$out/tpm2_getcap.txt"; }
216 pad() { printf '0x%08x' "$1"; }
217 want="tpm_manufacturer=$(pad "$(raw TPM2_PT_MANUFACTURER)") firmware=$(pad "$(raw TPM2_PT_FIRMWARE_VERSION_1)").$(pad "$(raw TPM2_PT_FIRMWARE_VERSION_2)")"
218 grep -q "^RECEIPT .* $want " "$out/tpm-props.log" && ok "tpm-props-oracle $want" || bad "tpm-props-oracle want $want got $(tail -n 1 "$out/tpm-props.log")"
219 else
220 notrun "tpm-props-oracle: tpm2_getcap absent"
221 fi
222 expect 0 tpm-getrandom-a $P "$H" run "$M" tpm-ntc-npct75x getrandom 32 1 "$T"
223 expect 0 tpm-getrandom-b $P "$H" run "$M" tpm-ntc-npct75x getrandom 32 2 "$T"
224 ra=$(sed -n 's/^RECEIPT .* result=\([0-9a-f]*\) .*/\1/p' "$out/tpm-getrandom-a.log")
225 rb=$(sed -n 's/^RECEIPT .* result=\([0-9a-f]*\) .*/\1/p' "$out/tpm-getrandom-b.log")
226 [ "${#ra}" -eq 64 ] && [ "${#rb}" -eq 64 ] && [ "$ra" != "$rb" ] && ok "tpm-getrandom-distinct 32+32 bytes" \
227 || bad "tpm-getrandom-distinct a=$ra b=$rb"
228 expect 7 neg-tpm-stale-replay $P "$H" run "$M" tpm-ntc-npct75x getrandom 32 1 "$T"
229 expect 14 neg-tpm-arg-over $P "$H" run "$M" tpm-ntc-npct75x getrandom 33 3 "$T"
230 expect 14 neg-tpm-props-arg $P "$H" run "$M" tpm-ntc-npct75x props 1 3 "$T"
231 expect 5 neg-tpm-unsupported-op $P "$H" run "$M" tpm-ntc-npct75x sumsq64 1 3 "$T"
232 expect 0 tpm-fault-badsize $P "$H" fault "$M" tpm-ntc-npct75x badsize 3 "$T"
233 says tpm-fault-badsize ' kind=badsize layer=kernel errno=-22 outcome=PASS$'
234 expect 0 tpm-fault-badcc $P "$H" fault "$M" tpm-ntc-npct75x badcc 4 "$T"
235 says tpm-fault-badcc ' kind=badcc layer=tpmrm rc=0x000b0143 outcome=PASS$'
236 expect 5 neg-tpm-fault-kind $P "$H" fault "$M" tpm-ntc-npct75x badlen 5 "$T"
237 expect 5 neg-cpu-fault $P "$H" fault "$M" cpu-gb10-x925 badsize 0 "$out/cpu-fault.state"
238 [ "$(cat "$T")" = "5 tpm-ntc-npct75x" ] && ok "tpm-handle generation=5" || bad "tpm-handle $(cat "$T")"
239 mutate m-tid '$1=="tpm-ntc-npct75x"{$8="manufacturer=0x49465800"}1'
240 expect 8 neg-tpm-wrong-device $P "$H" run "$out/m-tid.tsv" tpm-ntc-npct75x props 0 5 "$T"
241 mutate m-toff '$1=="tpm-ntc-npct75x"{$9="/dev/tpmrm9"}1'
242 expect 10 neg-tpm-offline $P "$H" run "$out/m-toff.tsv" tpm-ntc-npct75x props 0 5 "$T"
243 mutate m-tt0 '$1=="tpm-ntc-npct75x"{$21="0"}1'
244 expect 11 neg-tpm-timeout $P "$H" run "$out/m-tt0.tsv" tpm-ntc-npct75x props 0 5 "$T"
245 says neg-tpm-timeout '^REFUSE timeout elapsed_ns=[0-9]* budget_ns=0$'
246 tg=6
247 # Binding controls: refused before discovery or claim, the handle never moves.
248 cp "$T" "$out/tpm.before" || exit 74
249 expect 3 neg-tpm-invented-op $P "$H" run "$out/m-tpmop.tsv" tpm-ntc-npct75x seal 1 "$tg" "$T"
250 expect 3 neg-tpm-runner-family $P "$H" run "$out/m-famrun.tsv" tpm-ntc-npct75x props 0 "$tg" "$T"
251 cmp -s "$T" "$out/tpm.before" && ok "tpm-binding-no-advance $(cat "$T")" || bad "tpm-binding-no-advance $(cat "$T")"
252 # Fault oracle: an unrelated failure injected on /dev/tpmrm0 (write 1 and read 1 are discovery,
253 # write 2 and read 2 the fault frame) must be a device error, never the expected refusal.
254 # fx NAME KIND INJECT RESULT
255 fx() {
256 expect 13 "$1" $P strace -qq -o /dev/null -P /dev/tpmrm0 -e trace=read,write -e "inject=$3" \
257 "$H" fault "$M" tpm-ntc-npct75x "$2" "$tg" "$T"
258 says "$1" "^REFUSE unexpected_fault_result kind=$2 result=$4 "
259 tg=$((tg + 1))
260 }
261 if command -v strace > /dev/null 2>&1; then
262 fx neg-fault-badsize-eio badsize 'write:error=EIO:when=2' -5
263 fx neg-fault-badcc-kernel-einval badcc 'write:error=EINVAL:when=2' -22
264 fx neg-fault-badcc-short-response badcc 'read:retval=4:when=2' -1000
265 [ "$(cat "$T")" = "$tg tpm-ntc-npct75x" ] && ok "tpm-fault-controls-advance generation=$tg" || bad "tpm-fault-controls-advance $(cat "$T")"
266 else
267 notrun "neg-fault-*: strace absent (fault injection)"
268 fi
269fi
270
271echo "HW pass=$npass fail=$nfail not_run=$nnr"
272[ "$nfail" -eq 0 ] || exit 1
273exit 0