47 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.03#4# Load kernel module for FPU tests5 6uid=$(id -u)7if [ $uid -ne 0 ]; then8 echo "$0: Must be run as root"9 exit 110fi11 12if ! which modprobe > /dev/null 2>&1; then13 echo "$0: You need modprobe installed"14 exit 415fi16 17if ! modinfo test_fpu > /dev/null 2>&1; then18 echo "$0: You must have the following enabled in your kernel:"19 echo "CONFIG_TEST_FPU=m"20 exit 421fi22 23NR_CPUS=$(getconf _NPROCESSORS_ONLN)24if [ ! $NR_CPUS ]; then25 NR_CPUS=126fi27 28modprobe test_fpu29 30if [ ! -e /sys/kernel/debug/selftest_helpers/test_fpu ]; then31 mount -t debugfs none /sys/kernel/debug32 33 if [ ! -e /sys/kernel/debug/selftest_helpers/test_fpu ]; then34 echo "$0: Error mounting debugfs"35 exit 436 fi37fi38 39echo "Running 1000 iterations on all CPUs... "40for i in $(seq 1 1000); do41 for c in $(seq 1 $NR_CPUS); do42 ./test_fpu &43 done44done45 46rmmod test_fpu47