#!/bin/sh # # Test Case 6 - top # export TCID="cpuhotplug06" export TST_TOTAL=1 # Includes: . test.sh . cpuhotplug_testsuite.sh . cpuhotplug_hotplug.sh cat <" fi # Verify that the specified CPU is available if ! cpu_is_valid "${CPU_TO_TEST}" ; then tst_brkm TCONF "cpu${CPU_TO_TEST} doesn't support hotplug" fi # Check that the specified CPU is online; if not, online it if ! cpu_is_online "${CPU_TO_TEST}" ; then if ! online_cpu ${CPU_TO_TEST}; then tst_brkm TBROK "CPU${CPU_TO_TEST} cannot be onlined" fi fi TST_CLEANUP=do_clean until [ $LOOP_COUNT -gt $HOTPLUG06_LOOPS ]; do # Start up top and give it a little time to run top -b -d 00.10 > /dev/null 2>&1 & TOP_PID=$! sleep 1 # Now offline the CPU if ! offline_cpu ${CPU_TO_TEST} ; then tst_brkm TBROK "CPU${CPU_TO_TEST} cannot be offlined" fi # Wait a little time for top to notice the CPU is gone sleep 1 # Check that top hasn't crashed if ! pid_is_valid ${TOP_PID} ; then tst_resm TFAIL "PID ${TOP_PID} no longer running" tst_exit fi online_cpu ${CPU_TO_TEST} kill_pid ${TOP_PID} LOOP_COUNT=$((LOOP_COUNT+1)) done tst_resm TPASS "PID ${TOP_PID} still running." tst_exit