mirror of
https://github.com/ebrandi/FDD-book.git
synced 2026-12-06 00:23:30 +00:00
29 lines
623 B
Bash
29 lines
623 B
Bash
|
|
#!/bin/sh
|
||
|
|
#
|
||
|
|
# Repeatedly load and unload the myfirst module to look for leaks or
|
||
|
|
# crashes that only show up over many cycles. Run from the same
|
||
|
|
# directory as your built myfirst.ko.
|
||
|
|
#
|
||
|
|
# Usage: sudo ./stress_test.sh [iterations]
|
||
|
|
|
||
|
|
set -e
|
||
|
|
|
||
|
|
ITERATIONS="${1:-100}"
|
||
|
|
MODULE="myfirst"
|
||
|
|
|
||
|
|
if [ ! -f "./${MODULE}.ko" ]; then
|
||
|
|
echo "stress_test.sh: ./${MODULE}.ko not found" >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
i=1
|
||
|
|
while [ "$i" -le "$ITERATIONS" ]; do
|
||
|
|
echo "Iteration $i / $ITERATIONS"
|
||
|
|
kldload "./${MODULE}.ko"
|
||
|
|
sleep 0.1
|
||
|
|
kldunload "${MODULE}"
|
||
|
|
i=$((i + 1))
|
||
|
|
done
|
||
|
|
|
||
|
|
echo "Stress test completed: ${ITERATIONS} cycles without errors."
|