diff --git a/stress-tests/Dockerfile b/stress-tests/Dockerfile index 4f152f5..0fe639e 100644 --- a/stress-tests/Dockerfile +++ b/stress-tests/Dockerfile @@ -4,9 +4,9 @@ ARG IMAGE_TAG=2-bullseye FROM --platform=$IMAGE_ARCH torizon/debian:$IMAGE_TAG RUN apt-get update \ - && apt-get install -y --no-install-recommends iperf3 rt-tests \ + && apt-get install -y --no-install-recommends iperf3 rt-tests iputils-ping \ && rm -rf /var/lib/apt/lists/* -COPY / / +COPY stress-tests.sh /stress-tests.sh CMD ["/stress-tests.sh"] diff --git a/stress-tests/stress-tests.sh b/stress-tests/stress-tests.sh index 286669c..3a5fe9b 100755 --- a/stress-tests/stress-tests.sh +++ b/stress-tests/stress-tests.sh @@ -1,5 +1,7 @@ #!/bin/sh +echo "Setting up stress tests..." + # CPU load while true; do hackbench >/dev/null 2>&1; done & @@ -9,9 +11,15 @@ while true; do find / -name a* >/dev/null 2>&1; done & # I/O load (USB read/write) if mount | grep /mnt/pendrive >/dev/null; then - cd /mnt/pendrive - tar -cf file.tar -C /var/log --exclude=lost+found -p . - while true; do rm -rf output; mkdir -p output; tar xfv file.tar -C output/ >/dev/null 2>&1; done & + if [ -e /mnt/pendrive/file.tar ]; then + cd /mnt/pendrive + tar -cf file.tar -C /var/log --exclude=lost+found -p . + while true; do rm -rf output; mkdir -p output; tar xfv file.tar -C output/ >/dev/null 2>&1; done & + else + echo "Warning: Archive file.tar not found in /mnt/pendrive. USB read/write stress test will not run." + fi +else + echo "Warning: pendrive not mounted. USB read/write stress test will not run." fi # RTC read/write @@ -19,7 +27,15 @@ while true; do hwclock >/dev/null 2>&1; sleep 0.1; done & while true; do hwclock -w >/dev/null 2>&1; sleep 0.1; done & # Network load -while true; do iperf3 -c bouygues.iperf.fr -P 10 >/dev/null 2>&1; done +if ! ping -q -c 1 -W 1 8.8.8.8 >/dev/null 2>&1; then + echo "Warning: could not ping 8.8.8.8. Internet may be unavailable to generate network load." +fi +while true; do + SERVERS="bouygues.iperf.fr speedtest.wtnet.de speedtest.iveloz.net.br iperf.scottlinux.com" + for s in $SERVERS; do + iperf3 -c $s -P 10 >/dev/null 2>&1 + done +done & echo "RT stress tests started successfully!"