Merge lp:~rodsmith/checkbox/new-cpu-test into lp:checkbox

Proposed by Rod Smith
Status: Merged
Approved by: Jeff Lane 
Approved revision: 4202
Merged at revision: 4202
Proposed branch: lp:~rodsmith/checkbox/new-cpu-test
Merge into: lp:checkbox
Diff against target: 98 lines (+83/-0)
2 files modified
providers/plainbox-provider-checkbox/bin/cpu_stress (+70/-0)
providers/plainbox-provider-checkbox/jobs/stress.txt.in (+13/-0)
To merge this branch: bzr merge lp:~rodsmith/checkbox/new-cpu-test
Reviewer Review Type Date Requested Status
Jeff Lane  Approve
Review via email: mp+284966@code.launchpad.net

Description of the change

New CPU stress test based on Colin King's stress_ng tool rather than the older stress tool.

To post a comment you must log in.
Revision history for this message
Rod Smith (rodsmith) wrote :

Oh, I forgot: Here's some sample output (from a run tweaked to run for 60 seconds rather than 2 hours):

https://certification.canonical.com/hardware/201005-5725/submission/108362/test/62532/result/7946686/

Revision history for this message
Jeff Lane  (bladernr) wrote :

Looks good to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'providers/plainbox-provider-checkbox/bin/cpu_stress'
2--- providers/plainbox-provider-checkbox/bin/cpu_stress 1970-01-01 00:00:00 +0000
3+++ providers/plainbox-provider-checkbox/bin/cpu_stress 2016-02-03 20:14:27 +0000
4@@ -0,0 +1,70 @@
5+#!/bin/sh
6+
7+# Script to perform CPU stress tests
8+#
9+# Copyright (c) 2016 Canonical Ltd.
10+#
11+# Authors
12+# Rod Smith <rod.smith@canonical.com>
13+#
14+# This program is free software: you can redistribute it and/or modify
15+# it under the terms of the GNU General Public License version 3,
16+# as published by the Free Software Foundation.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU General Public License for more details.
22+#
23+# You should have received a copy of the GNU General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+# The purpose of this script is to run CPU stress tests using the
27+# stress-ng program.
28+#
29+# Usage:
30+# cpu_stress [ --runtime <time-in-seconds> ]
31+#
32+# If --runtime is not specified, it defaults to 7200 (2 hours).
33+
34+runtime=7200
35+if [ "$#" = "2" ] && [ "$1" = "--runtime" ] && [ "$2" -eq "$2" ] ; then
36+ runtime=$2
37+elif [ "$#" != "0" ] ; then
38+ echo "Usage:"
39+ echo " $0 [ --runtime <time-in-seconds> ]"
40+ exit 1
41+fi
42+echo "Setting run time to $runtime seconds"
43+# Add 10% to runtime; will forcefully terminate if stress-ng
44+# fails to return in that time.
45+end_time=$((runtime*11/10))
46+
47+# NOTE:
48+# Options --af-alg 0 through --wcs 0 specify CPU stressors. As of stress-ng
49+# version 0.05.12, this is equivalent to --class cpu --all 0 --exclude numa,cpu_online.
50+# This script specifies stressors individually because the list of stressors keeps
51+# increasing, and we want consistency -- if the stress-ng version bumps up, we
52+# don't want new stressors being run. We're omitting numa because it's most
53+# useful on systems with massive numbers of CPUs, and cpu_online because it's
54+# failed on 4 of 8 test systems, so it seems too strict.
55+# Use "timeout" command to launch stress-ng, to catch it should it go into la-la land
56+timeout -s 9 $end_time stress-ng --aggressive --verify --timeout $runtime \
57+ --metrics-brief --tz --times \
58+ --af-alg 0 --bsearch 0 --context 0 --cpu 0 \
59+ --crypt 0 --hsearch 0 --longjmp 0 --lsearch 0 \
60+ --matrix 0 --qsort 0 --str 0 --stream 0 \
61+ --tsearch 0 --vecmath 0 --wcs 0
62+result="$?"
63+
64+echo "**********************************************************"
65+if [ $result = "0" ] ; then
66+ echo "* stress-ng CPU test passed!"
67+else
68+ if [ $result = "137" ] ; then
69+ echo "* stress-ng CPU test timed out and was forcefully terminated!"
70+ fi
71+ echo "* stress-ng CPU test failed with result $result"
72+fi
73+echo "**********************************************************"
74+exit $result
75
76=== modified file 'providers/plainbox-provider-checkbox/jobs/stress.txt.in'
77--- providers/plainbox-provider-checkbox/jobs/stress.txt.in 2015-12-17 15:51:40 +0000
78+++ providers/plainbox-provider-checkbox/jobs/stress.txt.in 2016-02-03 20:14:27 +0000
79@@ -13,6 +13,19 @@
80
81 plugin: shell
82 category_id: 2013.com.canonical.plainbox::stress
83+id: stress/cpu_stress_ng_test
84+estimated_duration: 7200.0
85+requires:
86+ package.name == 'stress-ng'
87+user: root
88+command: cpu_stress --runtime 7200
89+_description:
90+ Impose a high system load using the 'stress_ng' tool to exercise the CPU for
91+ several hours. The test is considered passed if the system does not freeze and
92+ if the stress_ng tool does not report errors.
93+
94+plugin: shell
95+category_id: 2013.com.canonical.plainbox::stress
96 id: power-management/hibernate_30_cycles
97 estimated_duration: 5400.00
98 depends:

Subscribers

People subscribed via source and target branches