Signed-off-by: Xing Gu <gux.f...@cn.fujitsu.com>
---
 testcases/kernel/power_management/pm_check_env.sh  | 41 ++++++++++++++++++++++
 .../kernel/power_management/pm_check_uclinux.c     | 29 +++++++++++++++
 testcases/kernel/power_management/runpwtests.sh    | 17 ++-------
 3 files changed, 72 insertions(+), 15 deletions(-)
 create mode 100755 testcases/kernel/power_management/pm_check_env.sh
 create mode 100644 testcases/kernel/power_management/pm_check_uclinux.c

diff --git a/testcases/kernel/power_management/pm_check_env.sh 
b/testcases/kernel/power_management/pm_check_env.sh
new file mode 100755
index 0000000..ebfaf08
--- /dev/null
+++ b/testcases/kernel/power_management/pm_check_env.sh
@@ -0,0 +1,41 @@
+#
+# Copyright (c) 2015 Fujitsu Ltd.
+#
+# 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.
+#
+
+check_env() {
+       # Checking the system type
+       ./pm_check_uclinux; rc=$?
+       if [ $rc -eq 1 ]; then
+               tst_brkm TCONF "UCLINUX not supported; not running testcases"
+       fi
+
+       # Checking required kernel version and architecture
+       tst_kvercmp 2 6 21; rc=$?
+       if [ $rc -ne 1 -a $rc -ne 2 ] ; then
+               tst_brkm TCONF "Kernel version not supported; not running \
+                       testcases"
+       else
+               case "$(uname -m)" in
+               i[4-6]86|x86_64)
+                       ;;
+               *)
+                       tst_brkm TCONF "Arch not supported; not running \
+                               testcases"
+                       ;;
+               esac
+       fi
+}
diff --git a/testcases/kernel/power_management/pm_check_uclinux.c 
b/testcases/kernel/power_management/pm_check_uclinux.c
new file mode 100644
index 0000000..e3823b1
--- /dev/null
+++ b/testcases/kernel/power_management/pm_check_uclinux.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015 Fujitsu Ltd.
+ *
+ * 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.
+ */
+
+/* Check wether the current system is uclinux. */
+int main(int argc, char **argv)
+{
+       int chkcmp;
+#ifdef UCLINUX
+       chkcmp = 1;
+#else
+       chkcmp = 0;
+#endif
+       return chkcmp;
+}
diff --git a/testcases/kernel/power_management/runpwtests.sh 
b/testcases/kernel/power_management/runpwtests.sh
index 9055964..0a66dc4 100755
--- a/testcases/kernel/power_management/runpwtests.sh
+++ b/testcases/kernel/power_management/runpwtests.sh
@@ -42,6 +42,7 @@ YES=0
 NO=1
 #List of reusable functions defined in pm_include.sh
 . pm_include.sh
+. pm_check_env.sh
 
 # Function:     main
 #
@@ -52,21 +53,7 @@ NO=1
 #
 RC=0           #Return status
 
-# Checking required kernel version and architecture
-tst_kvercmp 2 6 21; rc=$?
-if [ $rc -ne 1 -a $rc -ne 2 ] ; then
-       tst_resm TCONF "Kernel version not supported; not running testcases"
-       exit 0
-else
-       case "$(uname -m)" in
-       i[4-6]86|x86_64)
-               ;;
-       *)
-               tst_resm TCONF "Arch not supported; not running testcases"
-               exit 0
-               ;;
-       esac
-fi
+check_env
 
 tst_kvercmp 2 6 29; rc=$?
 if [ $rc -eq 2 ] ; then
-- 
1.9.3


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to