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
CUDApp / tests / dagsim / mutant_lifetime.sh
| 1 | #!/bin/sh |
| 2 | # Drop the inverted-lifetime check and require the named assertion to fail. |
| 3 | # A mutant that still prints a passing inverted_lifetime_masks_overflow is a miss. |
| 4 | set -eu |
| 5 | ROOT=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd) |
| 6 | cd "$ROOT" |
| 7 | src=tools/dagsim/dagsim.c |
| 8 | grep -q 'LIFETIME_ORDER_CHECK' "$src" |
| 9 | tmp=$(mktemp -d) |
| 10 | trap 'rm -rf "$tmp"' EXIT |
| 11 | sed '/LIFETIME_ORDER_CHECK/d' "$src" > "$tmp/dagsim.c" |
| 12 | grep -q 'LIFETIME_ORDER_CHECK' "$tmp/dagsim.c" && { echo "mutant: check still present"; exit 1; } |
| 13 | grep -q 'reject_inverted_lifetimes' "$tmp/dagsim.c" || { echo "mutant: deleted more than the call"; exit 1; } |
| 14 | |
| 15 | CC=${CC:-cc} |
| 16 | # -Wno-unused-function: deleting the call leaves reject_inverted_lifetimes unreferenced. |
| 17 | # The mutant has to run. The kill is the named assertion, not a compile error. |
| 18 | cflags="-std=gnu11 -Wall -Wextra -Werror -Wno-unused-function -D_GNU_SOURCE -O2 -ffp-contract=off -DCUDAPP_MIGRATION_PENDING_C_TOOLS -DCUDAPP_MIGRATION_PENDING_C_DAGSIM_RESOLVE=1 -Isrc -Itools/dagsim" |
| 19 | $CC $cflags -c -o "$tmp/dagsim.o" "$tmp/dagsim.c" |
| 20 | $CC $cflags -ffp-contract=off -c -o "$tmp/rx_costmodel.o" src/runtime/rx_costmodel.c |
| 21 | # CUDA++ has no src/omega_om_units.c; src/sha256.c is sha256_hash on every host and calls the core_sha unit (Makefile DS_SHA_SRC). |
| 22 | sha=src/sha256.c |
| 23 | $CC $cflags -o "$tmp/unit" tests/dagsim/dagsim_unit.c "$tmp/dagsim.o" "$tmp/rx_costmodel.o" "$sha" src/cudapp_om_core_sha.c src/cudapp_om_cm_sort.c src/cudapp_om_cm_math.c src/cudapp_om_cm_fit.c src/cudapp_om_cm_stats.c src/cudapp_om_cm_features.c src/cudapp_om_cm_quantile.c src/cudapp_om_cm_decision.c src/cudapp_om_cm_prediction.c src/cudapp_om_cm_calibration.c src/cudapp_om_cm_blob.c src/cudapp_om_cm_digest.c src/cudapp_om_cm_route.c src/cudapp_om_dag_parse.c src/cudapp_om_dag_fmt.c -Wl,--wrap=rx_cm_predict -lm |
| 24 | set +e |
| 25 | "$tmp/unit" > "$tmp/out" 2>&1 |
| 26 | rc=$? |
| 27 | set -e |
| 28 | if [ "$rc" -eq 0 ]; then |
| 29 | echo "mutant survived: unit suite passed after dropping LIFETIME_ORDER_CHECK" |
| 30 | exit 1 |
| 31 | fi |
| 32 | if ! grep -q 'inverted_lifetime_masks_overflow' "$tmp/out"; then |
| 33 | echo "mutant did not fail named assertion inverted_lifetime_masks_overflow" |
| 34 | cat "$tmp/out" |
| 35 | exit 1 |
| 36 | fi |
| 37 | echo "mutant killed: inverted_lifetime_masks_overflow" |