1#!/usr/bin/env bash 2# shellcheck disable=SC2035 3# shellcheck disable=SC2061 4# shellcheck disable=SC2086 # we want word splitting 5 6while true; do 7 devcds=$(find /sys/devices/virtual/devcoredump/ -name data 2>/dev/null) 8 for i in $devcds; do 9 echo "Found a devcoredump at $i." 10 if cp $i $RESULTS_DIR/first.devcore; then 11 echo 1 > $i 12 echo "Saved to the job artifacts at /first.devcore" 13 exit 0 14 fi 15 done 16 i915_error_states=$(find /sys/devices/ -path */drm/card*/error) 17 for i in $i915_error_states; do 18 tmpfile=$(mktemp) 19 cp "$i" "$tmpfile" 20 filesize=$(stat --printf="%s" "$tmpfile") 21 # Does the file contain "No error state collected" ? 22 if [ "$filesize" = 25 ]; then 23 rm "$tmpfile" 24 else 25 echo "Found an i915 error state at $i size=$filesize." 26 if cp "$tmpfile" $RESULTS_DIR/first.i915_error_state; then 27 rm "$tmpfile" 28 echo 1 > "$i" 29 echo "Saved to the job artifacts at /first.i915_error_state" 30 exit 0 31 fi 32 fi 33 done 34 sleep 10 35done 36