/usr/lib/2013.com.canonical.certification:checkbox/bin/cpu_offlining is in plainbox-provider-checkbox 0.4-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #!/bin/bash
echo "Beginning CPU Offlining Test" 1>&2
result=0
cpu_count=0
# Turn CPU cores off
for cpu_num in `ls /sys/devices/system/cpu | grep -o cpu[0-9]*`; do
if [ -f /sys/devices/system/cpu/$cpu_num/online ]; then
if [ "$cpu_num" != "cpu0" ]; then
((cpu_count++))
echo "Offlining $cpu_num" 1>&2
echo 0 > /sys/devices/system/cpu/$cpu_num/online
grep -w -i -q $cpu_num /proc/interrupts
if [ $? -eq 0 ]; then
echo "ERROR: Failed to offline $cpu_num" 1>&2
result=1
fi
fi
fi
done
# Back on again
for cpu_num in `ls /sys/devices/system/cpu | grep -o cpu[0-9]*`; do
if [ -f /sys/devices/system/cpu/$cpu_num/online ]; then
if [ "$cpu_num" != "cpu0" ]; then
echo "Onlining $cpu_num" 1>&2
echo 1 > /sys/devices/system/cpu/$cpu_num/online
grep -w -i -q $cpu_num /proc/interrupts
if [ $? -eq 1 ]; then
echo "ERROR: Failed to online $cpu_num" 1>&2
result=1
fi
fi
fi
done
if [ $result -eq 0 ]; then
echo "Successfully turned $cpu_count cores off and back on"
else
echo "Error with offlining one or more cores." 1>&2
fi
exit $result
|