Stress-Testing.

Matthew J. Roth mroth at imminc.com
Wed Feb 29 14:32:37 UTC 2012


Frank Murphy wrote:

> I know memtest is on Fedora.
> What about cpu tests?
> Was goolging came up with cpuburn as per:
> http://www.howtogeek.com/howto/16666/diagnose-hardware-problems-with-an-ubuntu-live-cd/


Frank,

Repeatedly compiling the kernel is a good CPU test.  Here are my notes:

=== stress_testing_hardware.txt =============================================
Stress Testing Hardware by Repeatedly Compiling the Linux Kernel
================================================================

* Install the Kernel Source
  # cd /var/tmp/
  # wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.1.tar.gz
  # tar -xzvf linux-3.2.1.tar.gz

* Perform the Hardware Stress Test
  # cd /var/tmp/linux-3.2.1/
  * Create 'stress.sh' (see below)
  # chmod a+x stress.sh
  # nohup ./stress.sh 100 &
  
* During the Hardware Stress Test
  * Monitor the system using programs such as: top, free, iostat, sar, vmstat, and mpstat

* After the Hardware Stress Test
  * SUCCESS: All compiles were successful and none failed
    # cd /var/tmp/linux-3.2.1/
    # grep Success stress.out | wc -l
      100
    # grep Failure stress.out | wc -l
      0
  * FAILURE: One or more compiles failed
    # cd /var/tmp/linux-3.2.1/
    # grep Success stress.out | wc -l
      99
    # grep Failure stress.out | wc -l
      1

* Cleanup
  # cd /var/tmp/
  # rm -rf linux-3.2.1*


--------------------------------- stress.sh ---------------------------------
#!/bin/bash
# Performs a hardware stress test by repeatedly compiling the Linux kernel
#
# * Resources
#   * Stress Testing PCs with Linux -- How to Make Your Hardware Reliable
#     * http://pygmy.utoh.org/stress.txt
#   * Gentoo Linux Documentation -- Linux hardware stability guide, Part 1
#     * http://www.gentoo.org/doc/en/articles/hardware-stability-p1.xml

# Command line validation
if [ "$1" -eq "$1" ] 2> /dev/null; then
  maxpass=$1
else
  echo "Usage: `basename $0` MAXPASS"
  exit 1
fi

# Set the number of simultaneous jobs to one greater than the number of CPUs
cpus=`grep 'processor' /proc/cpuinfo | wc -l`
let cpus+=1

# Create a './.config' file by using the default symbol values
make defconfig 2>&1 > /dev/null

# Main loop
passnum=1
while [ $passnum -le $maxpass ]
do
    echo -n "Starting compile #$passnum at `date`" >> stress.out

    # Compile the kernel
    make clean 2>&1 > /dev/null
    make -j$cpus 2>&1 > /dev/null

    if [ $? -eq 0 ]; then
       echo " -- Success --" >> stress.out
    else
       echo " -- Failure --" >> stress.out
    fi

    let passnum+=1
done

exit 0
-----------------------------------------------------------------------------
=============================================================================

Regards,

Matthew Roth
InterMedia Marketing Solutions
Software Engineer and Systems Developer


More information about the users mailing list