From patchwork Mon Oct 3 08:18:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 4487 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 163F723F6E for ; Mon, 3 Oct 2011 08:20:50 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id 0934CA18275 for ; Mon, 3 Oct 2011 08:20:50 +0000 (UTC) Received: by eyb6 with SMTP id 6so3381067eyb.11 for ; Mon, 03 Oct 2011 01:20:49 -0700 (PDT) Received: by 10.223.63.8 with SMTP id z8mr10650876fah.84.1317630049807; Mon, 03 Oct 2011 01:20:49 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.23.170 with SMTP id n10cs6261laf; Mon, 3 Oct 2011 01:20:49 -0700 (PDT) Received: by 10.227.149.143 with SMTP id t15mr17025903wbv.59.1317630049231; Mon, 03 Oct 2011 01:20:49 -0700 (PDT) Received: from smtp.smtpout.orange.fr (smtp11.smtpout.orange.fr. [80.12.242.133]) by mx.google.com with ESMTP id fi7si9906616wbb.71.2011.10.03.01.20.49; Mon, 03 Oct 2011 01:20:49 -0700 (PDT) Received-SPF: neutral (google.com: 80.12.242.133 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=80.12.242.133; Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.133 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: from monster.dhcp.lxc ([90.60.119.82]) by mwinf5d34 with ME id g8Lj1h0021mlJK6038Lo4U; Mon, 03 Oct 2011 10:20:48 +0200 X-ME-engine: default From: Daniel Lezcano To: linaro-dev@lists.linaro.org Subject: [pm-qa 10/10] do some stress test Date: Mon, 3 Oct 2011 10:18:35 +0200 Message-Id: <1317629915-31767-10-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1317629915-31767-1-git-send-email-daniel.lezcano@linaro.org> References: <1317629915-31767-1-git-send-email-daniel.lezcano@linaro.org> Randomly offline/online a cpu Signed-off-by: Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpuhotplug_08 + +source ../include/functions.sh + +function randomize() { + echo $[ ( $RANDOM % $1 ) + 1 ] +} + +random_stress() { + local cpu_present=$(cat /sys/devices/system/cpu/present | cut -d '-' -f 2) + local cpurand=$(randomize $cpu_present) + local ret= + + # randomize will in range "1-$cpu_present) so cpu0 is ignored + set_offline cpu$cpurand + ret=$? + check "cpu$cpurand is offline" "test $ret -eq 0" + + set_online cpu$cpurand + ret=$? + check "cpu$cpurand is online" "test $ret -eq 0" +} + +for i in $(seq 1 50); do random_stress || break; done diff --git a/cpuhotplug/cpuhotplug_08.txt b/cpuhotplug/cpuhotplug_08.txt new file mode 100644 index 0000000..ddfca55 --- /dev/null +++ b/cpuhotplug/cpuhotplug_08.txt @@ -0,0 +1 @@ +test userspace notification