From patchwork Mon Oct 3 08:18:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 4486 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 0A53A23F57 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 018E8A181A0 for ; Mon, 3 Oct 2011 08:20:49 +0000 (UTC) Received: by mail-ey0-f180.google.com with SMTP id 6so3380973eyb.11 for ; Mon, 03 Oct 2011 01:20:49 -0700 (PDT) Received: by 10.223.5.76 with SMTP id 12mr23173823fau.103.1317630049528; 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 n10cs6260laf; Mon, 3 Oct 2011 01:20:49 -0700 (PDT) Received: by 10.227.24.82 with SMTP id u18mr11068095wbb.111.1317630048742; Mon, 03 Oct 2011 01:20:48 -0700 (PDT) Received: from smtp.smtpout.orange.fr (smtp11.smtpout.orange.fr. [80.12.242.133]) by mx.google.com with ESMTP id el6si6805830wbb.143.2011.10.03.01.20.48; Mon, 03 Oct 2011 01:20:48 -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 g8Lj1h0021mlJK6038Lo4K; Mon, 03 Oct 2011 10:20:48 +0200 X-ME-engine: default From: Daniel Lezcano To: linaro-dev@lists.linaro.org Subject: [pm-qa 09/10] test the userspace notification Date: Mon, 3 Oct 2011 10:18:34 +0200 Message-Id: <1317629915-31767-9-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> Signed-off-by: Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpuhotplug_07 + +source ../include/functions.sh +TMPFILE=cpuhotplug_07.tmp + +check_notification() { + local cpu=$1 + local cpuid=${cpu:3} + local pid= + local ret= + + if [ "$cpu" == "cpu0" ]; then + return 0 + fi + + # damn ! udevadm is buffering the output, we have to use a temp file + # to retrieve the output + rm -f $TMPFILE + udevadm monitor --kernel --subsystem-match=cpu > $TMPFILE & + pid=$! + + set_offline $cpu + set_online $cpu + + # let the time the notification to reach userspace + # and buffered in the file + sleep 1 + kill $pid + + grep "offline" $TMPFILE | grep -q "/devices/system/cpu/$cpu" + ret=$? + check "offline event was received" "test $ret -eq 0" + + grep "online" $TMPFILE | grep -q "/devices/system/cpu/$cpu" + ret=$? + check "online event was received" "test $ret -eq 0" + + rm -f $TMPFILE +} + +for_each_cpu check_notification diff --git a/cpuhotplug/cpuhotplug_07.txt b/cpuhotplug/cpuhotplug_07.txt new file mode 100644 index 0000000..ddfca55 --- /dev/null +++ b/cpuhotplug/cpuhotplug_07.txt @@ -0,0 +1 @@ +test userspace notification