Merge lp:~brendan-donegan/checkbox/bug926136_cpu_offlining into lp:checkbox

Proposed by Brendan Donegan
Status: Merged
Merged at revision: 1372
Proposed branch: lp:~brendan-donegan/checkbox/bug926136_cpu_offlining
Merge into: lp:checkbox
Diff against target: 54 lines (+13/-5)
2 files modified
debian/changelog (+3/-1)
scripts/cpu_offlining (+10/-4)
To merge this branch: bzr merge lp:~brendan-donegan/checkbox/bug926136_cpu_offlining
Reviewer Review Type Date Requested Status
Daniel Manrique (community) Approve
Review via email: mp+103623@code.launchpad.net

Description of the change

There were failures observed when running the cpu/offlining test on any system with more than ten cores. Turns out this was simply down to the grep used to check if the core was online not taking into account that CPU1 will also match on CPU11. Updated the grep to match a whole word only. Also changed the logic so that the script doesn't exit until the very end when all cores have been onlined again.

To post a comment you must log in.
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

This should take care of the problem essentially. Colin King suggested a few more sanity checks which we could do, but they aren't strictly necessary to fix the bug itself.

Revision history for this message
Daniel Manrique (roadmr) wrote :

This looks OK. I'd like to see Colin's suggestions rolled in at some point, but for now I'll merge this.

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-04-24 13:45:56 +0000
3+++ debian/changelog 2012-04-26 07:45:23 +0000
4@@ -1,5 +1,7 @@
5 checkbox (0.13.8) precise; urgency=low
6-
7+ [Brendan Donegan]
8+ * Fixed cpu_offlining to work properly on systems with ten or more CPU
9+ cores. (LP: #926136)
10 [Nathan Williams]
11 * fix typo in jobs/optical.txt.in (lp: #987652)
12
13
14=== modified file 'scripts/cpu_offlining'
15--- scripts/cpu_offlining 2012-01-25 10:22:35 +0000
16+++ scripts/cpu_offlining 2012-04-26 07:45:23 +0000
17@@ -1,16 +1,20 @@
18 #!/bin/bash
19
20 echo "Beginning CPU Offlining Test"
21+
22+result=0
23+
24 # Turn CPU cores off
25 for cpu_num in `ls /sys/devices/system/cpu | grep -o cpu[0-9]*`;
26 do
27 if [ -f /sys/devices/system/cpu/$cpu_num/online ]; then
28 echo "Offlining $cpu_num"
29 echo 0 > /sys/devices/system/cpu/$cpu_num/online
30- grep -i -q $cpu_num /proc/interrupts
31+
32+ grep -w -i -q $cpu_num /proc/interrupts
33
34 if [ $? == 0 ]; then
35- exit 1
36+ result=1
37 fi
38 fi
39 done
40@@ -21,10 +25,12 @@
41 if [ -f /sys/devices/system/cpu/$cpu_num/online ]; then
42 echo "Onlining $cpu_num"
43 echo 1 > /sys/devices/system/cpu/$cpu_num/online
44- grep -i -q $cpu_num /proc/interrupts
45+ grep -w -i -q $cpu_num /proc/interrupts
46
47 if [ $? == 1 ]; then
48- exit 1
49+ result=1
50 fi
51 fi
52 done
53+
54+exit $result

Subscribers

People subscribed via source and target branches