[pm-qa,03/10] check the files are present

Message ID 1317629915-31767-3-git-send-email-daniel.lezcano@linaro.org
State Accepted
Headers show

Commit Message

Daniel Lezcano Oct. 3, 2011, 8:18 a.m.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org
---
 Makefile                     |    2 ++
 cpuhotplug/cpuhotplug_01.sh  |   36 ++++++++++++++++++++++++++++++++++++
 cpuhotplug/cpuhotplug_01.txt |    1 +
 include/functions.sh         |   12 ++++++++++++
 4 files changed, 51 insertions(+), 0 deletions(-)
 create mode 100644 cpuhotplug/cpuhotplug_01.sh
 create mode 100644 cpuhotplug/cpuhotplug_01.txt

Patch

diff --git a/Makefile b/Makefile
index abc866b..478fec3 100644
--- a/Makefile
+++ b/Makefile
@@ -29,10 +29,12 @@  all:
 check:
 	@(cd utils; $(MAKE) check)
 	@(cd cpufreq; $(MAKE) check)
+	@(cd cpuhotplug; $(MAKE) check)
 	@(cd sched_mc; $(MAKE) check)
 
 uncheck:
 	@(cd cpufreq; $(MAKE) uncheck)
+	@(cd cpuhotplug; $(MAKE) uncheck)
 	@(cd sched_mc; $(MAKE) uncheck)
 
 recheck: uncheck check
diff --git a/cpuhotplug/cpuhotplug_01.sh b/cpuhotplug/cpuhotplug_01.sh
new file mode 100644
index 0000000..f6f36ff
--- /dev/null
+++ b/cpuhotplug/cpuhotplug_01.sh
@@ -0,0 +1,36 @@ 
+#!/bin/bash
+#
+# PM-QA validation test suite for the power management on ARM
+#
+# Copyright (C) 2011, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+#
+# Contributors:
+#     Daniel Lezcano <daniel.lezcano@linaro.org> (IBM Corporation)
+#       - initial API and implementation
+#
+
+# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpuhotplug_01
+
+source ../include/functions.sh
+
+FILES="online offline possible present"
+
+for i in $FILES; do
+    check_file $i $CPU_PATH || return 1
+done
+
+for_each_cpu check_cpuhotplug_files online
diff --git a/cpuhotplug/cpuhotplug_01.txt b/cpuhotplug/cpuhotplug_01.txt
new file mode 100644
index 0000000..047f13a
--- /dev/null
+++ b/cpuhotplug/cpuhotplug_01.txt
@@ -0,0 +1 @@ 
+test the sysfs files are present
diff --git a/include/functions.sh b/include/functions.sh
index bff8e13..b2a8b47 100644
--- a/include/functions.sh
+++ b/include/functions.sh
@@ -236,6 +236,18 @@  check_topology_files() {
     return 0
 }
 
+check_cpuhotplug_files() {
+
+    local dirpath=$CPU_PATH/$1
+    shift 1
+
+    for i in $@; do
+	check_file $i $dirpath || return 1
+    done
+
+    return 0
+}
+
 save_governors() {
 
     governors_backup=