[pmqa] pm-qa: add test for cpu topology attributes

Message ID 1364213271-9653-1-git-send-email-sanjay.rawat@linaro.org
State New
Headers show

Commit Message

Sanjay Singh Rawat March 25, 2013, 12:07 p.m.
From: Daniel Lezcano <daniel.lezcano@linaro.org>

test checks for topology attributes of cpus

Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
---
 cputopology/Android.mk         |   18 ++++++++++++++++++
 cputopology/Makefile           |   25 +++++++++++++++++++++++++
 cputopology/cputopology_01.sh  |   38 ++++++++++++++++++++++++++++++++++++++
 cputopology/cputopology_01.txt |    1 +
 cputopology/cputopology_02.sh  |   33 +++++++++++++++++++++++++++++++++
 cputopology/cputopology_02.txt |    1 +
 6 files changed, 116 insertions(+)
 create mode 100644 cputopology/Android.mk
 create mode 100644 cputopology/Makefile
 create mode 100755 cputopology/cputopology_01.sh
 create mode 100644 cputopology/cputopology_01.txt
 create mode 100755 cputopology/cputopology_02.sh
 create mode 100644 cputopology/cputopology_02.txt

Patch

diff --git a/cputopology/Android.mk b/cputopology/Android.mk
new file mode 100644
index 0000000..7f2c1ef
--- /dev/null
+++ b/cputopology/Android.mk
@@ -0,0 +1,18 @@ 
+include $(call all-subdir-makefiles)
+LOCAL_PATH:= $(call my-dir)
+
+module_name = cputopology
+
+define $(module_name)_add_executable
+    include $(CLEAR_VARS)
+    LOCAL_MODULE_TAGS := optional
+    LOCAL_MODULE_CLASS := tests
+    LOCAL_MODULE := $1.sh
+    systemtarball: $1.sh
+    LOCAL_SRC_FILES := $1.sh
+    LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)/pm-qa/$(module_name)
+    include $(BUILD_PREBUILT)
+endef
+
+test_num := 01 02
+$(foreach item,$(test_num),$(eval $(call $(module_name)_add_executable, $(module_name)_$(item))))
diff --git a/cputopology/Makefile b/cputopology/Makefile
new file mode 100644
index 0000000..a90620c
--- /dev/null
+++ b/cputopology/Makefile
@@ -0,0 +1,25 @@ 
+#
+# PM-QA validation test suite for the power management on Linux
+#
+# 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
+#
+
+include ../Test.mk
\ No newline at end of file
diff --git a/cputopology/cputopology_01.sh b/cputopology/cputopology_01.sh
new file mode 100755
index 0000000..c7cbc26
--- /dev/null
+++ b/cputopology/cputopology_01.sh
@@ -0,0 +1,38 @@ 
+#!/bin/bash
+#
+# PM-QA validation test suite for the power management on Linux
+#
+# 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#sched_mc_02
+
+source ../include/functions.sh
+
+check_physical_package_id() {
+
+    local package_id=$CPU_PATH/$1/topology/physical_package_id
+    local val=$(cat $package_id)
+
+    check "topology is enabled" "test \"$val\" != \"-1\""
+}
+
+for_each_cpu check_physical_package_id || exit 1
diff --git a/cputopology/cputopology_01.txt b/cputopology/cputopology_01.txt
new file mode 100644
index 0000000..5493610
--- /dev/null
+++ b/cputopology/cputopology_01.txt
@@ -0,0 +1 @@ 
+test the topology is implemented in the kernel
diff --git a/cputopology/cputopology_02.sh b/cputopology/cputopology_02.sh
new file mode 100755
index 0000000..6520ce5
--- /dev/null
+++ b/cputopology/cputopology_02.sh
@@ -0,0 +1,33 @@ 
+#!/bin/bash
+#
+# PM-QA validation test suite for the power management on Linux
+#
+# 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#sched_mc_03
+
+source ../include/functions.sh
+
+FILES="core_id core_siblings core_siblings_list physical_package_id \
+thread_siblings thread_siblings_list"
+
+for_each_cpu check_topology_files $FILES
diff --git a/cputopology/cputopology_02.txt b/cputopology/cputopology_02.txt
new file mode 100644
index 0000000..b9e8d6f
--- /dev/null
+++ b/cputopology/cputopology_02.txt
@@ -0,0 +1 @@ 
+test the topology files are present