- #!/bin/ksh93
- #
- # multitorture1.ksh - torture system with many many parallel processes
- #
- # Used to trigger MCE errors on specific hardware
- #
- function dmesg_count_mces
- {
- nameref c=$1
- c.msgs="${ dmesg | fgrep 'mce:' ; }"
- c.count=${ wc -l <<<"${c.msgs}" ; }
- return 0
- }
- #
- # compound variable to store filtered dmesg(1) output and
- # statistics/counts
- #
- compound dmsg_mces=(
- compound before=(
- typeset msgs
- integer count
- )
- compound after=(
- typeset msgs
- integer count
- )
- )
- #
- # main
- #
- export PATH='/bin:/usr/bin'
- builtin cat
- builtin wc
- typeset x
- integer i j
- set -o bgnice # background jobs will be nice'ed
- printf $"# Start.\n"
- #
- # get a horribly large string
- #
- x="$( for ((i=0 ; i < 60000 ; i++)) ; do printf "%d\n" i; done )"
- dmesg_count_mces dmsg_mces.before
- for ((j=0 ; j < 50 ; j++)) ; do
- printf $"\n# Starting child processes (cycle %d) ...\n" j
- for ((i=0 ; i < 100 ; i++)) ; do
- {
- printf '.'
- # sleep, so parent process has enough time
- # to |fork()| the other children
- sleep 5
- #
- # torture!!
- #
- sort <<<"$x" | \
- sort -r | \
- sort | \
- sort -r -n | \
- sort -n | \
- sort -u | openssl sha512
- } &
- done
- sleep 3
- printf '\n'
- # wait until all children are done
- wait
- dmesg_count_mces dmsg_mces.after
- if (( dmsg_mces.after.count > dmsg_mces.before.count )) ; then
- printf $"# Congratulations: You have new mce entries in dmesg (\u[2620]) after %d cycles\n" j
- diff -u <( cat <<<"${dmsg_mces.before.msgs}" ) <( cat <<<"${dmsg_mces.after.msgs}" )
- break
- fi
- done
- printf $"# Done.\n"
- exit 0
- # EOF.
multitorture1.ksh - torture system with many many parallel processes
Posted by Anonymous on Wed 26th Jul 2023 14:37
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.