~jocave/checkbox/hybrid-amd-gpu-mods

« back to all changes in this revision

Viewing changes to providers/plainbox-provider-checkbox/bin/cpu_offlining

  • Committer: Zygmunt Krynicki
  • Date: 2013-05-29 07:50:30 UTC
  • mto: This revision was merged to the branch mainline in revision 2153.
  • Revision ID: zygmunt.krynicki@canonical.com-20130529075030-ngwz245hs2u3y6us
checkbox: move current checkbox code into checkbox-old

This patch cleans up the top-level directory of the project into dedicated
sub-project directories. One for checkbox-old (the current checkbox and all the
associated stuff), one for plainbox and another for checkbox-ng.

There are some associated changes, such as updating the 'source' mode of
checkbox provider in plainbox, and fixing paths in various test scripts that we
have.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
 
3
 
echo "Beginning CPU Offlining Test" 1>&2
4
 
 
5
 
result=0
6
 
cpu_count=0
7
 
 
8
 
# Turn CPU cores off
9
 
for cpu_num in `ls /sys/devices/system/cpu | grep -o cpu[0-9]*`; do
10
 
    if [ -f /sys/devices/system/cpu/$cpu_num/online ]; then
11
 
        if [ "$cpu_num" != "cpu0" ]; then
12
 
            ((cpu_count++))
13
 
            echo "Offlining $cpu_num" 1>&2
14
 
            echo 0 > /sys/devices/system/cpu/$cpu_num/online
15
 
 
16
 
            grep -w -i -q $cpu_num /proc/interrupts
17
 
            if [ $? -eq 0 ]; then
18
 
                echo "ERROR: Failed to offline $cpu_num" 1>&2
19
 
                result=1
20
 
            fi
21
 
        fi
22
 
    fi
23
 
done
24
 
 
25
 
# Back on again
26
 
for cpu_num in `ls /sys/devices/system/cpu | grep -o cpu[0-9]*`; do
27
 
    if [ -f /sys/devices/system/cpu/$cpu_num/online ]; then
28
 
        if [ "$cpu_num" != "cpu0" ]; then        
29
 
            echo "Onlining $cpu_num" 1>&2
30
 
            echo 1 > /sys/devices/system/cpu/$cpu_num/online
31
 
            grep -w -i -q $cpu_num /proc/interrupts
32
 
            if [ $? -eq 1 ]; then
33
 
                echo "ERROR: Failed to online $cpu_num" 1>&2
34
 
                result=1
35
 
            fi
36
 
        fi
37
 
    fi
38
 
done
39
 
 
40
 
if [ $result -eq 0 ]; then
41
 
    echo "Successfully turned $cpu_count cores off and back on"
42
 
else
43
 
    echo "Error with offlining one or more cores.  CPU offline may not work if this is an ARM system." 1>&2
44
 
fi
45
 
 
46
 
exit $result