Subrata Modak wrote:
On Fri, 2008-10-17 at 14:50 +0530, Nageswara R Sastry wrote:
The Power Management basic testcases are aimed at the user level testing
of the features like cpufrequency and sched_mc. More details are at README
Signed-Off-By: Nageswara R Sastry <[EMAIL PROTECTED]>
Thanks once again Nageswara for contributing the Power Management Test
cases to LTP. I have tested them on x86_64, ppc64 & i386 systems running
2.6.27 kernels with the following options enabled as per your README:
Subrata, These tests support only x86_64 and i386. Sorry for not
mentioning previously and now I updated README file also.
Can you kindly look into them and submit a refreshed patch once again ?
Please find the attached refreshed patch.
Thanks and Regards
R.Nageswara Sastry
diff -uprN ltp-full-20080930/runtest/power_management_tests
ltp-full-20080930_pwmng/runtest/power_management_tests
--- ltp-full-20080930/runtest/power_management_tests 1970-01-01
05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/runtest/power_management_tests 2008-10-20
19:26:09.000000000 +0530
@@ -0,0 +1 @@
+POWER_MANAGEMENT runpwtests.sh
diff -uprN ltp-full-20080930/testcases/kernel/Makefile
ltp-full-20080930_pwmng/testcases/kernel/Makefile
--- ltp-full-20080930/testcases/kernel/Makefile 2008-09-30 18:06:39.000000000
+0530
+++ ltp-full-20080930_pwmng/testcases/kernel/Makefile 2008-10-20
19:25:26.000000000 +0530
@@ -1,4 +1,4 @@
-SUBDIRS = numa containers controllers connectors include fs io ipc mem pty
sched security syscalls timers
+SUBDIRS = pwmng numa containers controllers connectors include fs io ipc mem
pty sched security syscalls timers
UCLINUX_SUBDIRS = syscalls
all:
diff -uprN ltp-full-20080930/testcases/kernel/pwmng/change_freq.sh
ltp-full-20080930_pwmng/testcases/kernel/pwmng/change_freq.sh
--- ltp-full-20080930/testcases/kernel/pwmng/change_freq.sh 1970-01-01
05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/testcases/kernel/pwmng/change_freq.sh
2008-10-20 20:06:00.000000000 +0530
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+. pm_include.sh
+available_freq=$(get_supporting_freq)
+available_govr=$(get_supporting_govr)
+RC=0
+
+total_cpus=$(no_of_cpus)
+(( total_cpus-=1 ))
+
+if ( echo ${available_govr} | grep -i "userspace" 2>&1 >/dev/null ) ; then
+ for cpu in $(seq 0 "${total_cpus}" )
+ do
+ echo userspace >
/sys/devices/system/cpu/cpu${cpu}/cpufreq/scaling_governor
+ if [ $? -ne 0 ] ; then
+ RC=1
+ fi
+ done
+ if [ ${RC} -ne 1 ] ; then
+ for cpu in $(seq 0 "${total_cpus}" )
+ do
+ for freq in ${available_freq}
+ do
+ echo ${freq} >
/sys/devices/system/cpu/cpu${cpu}/cpufreq/scaling_setspeed
+ if [ "$?" -ne "0" ] ; then
+ echo "${0}: FAIL: Unable to set
frequency -- ${freq} for cpu${cpu}"
+ RC=1
+ fi
+ done
+ done
+ fi
+fi
+if [ ${RC} -eq 0 ] ; then
+ echo "${0}: PASS: Changing cpu frequencies"
+fi
+#return $RC
diff -uprN ltp-full-20080930/testcases/kernel/pwmng/change_govr.sh
ltp-full-20080930_pwmng/testcases/kernel/pwmng/change_govr.sh
--- ltp-full-20080930/testcases/kernel/pwmng/change_govr.sh 1970-01-01
05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/testcases/kernel/pwmng/change_govr.sh
2008-10-20 19:24:56.000000000 +0530
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+. pm_include.sh
+available_govr=$(get_supporting_govr)
+
+total_cpus=$(no_of_cpus)
+(( total_cpus-=1 ))
+RC=0
+
+for cpu in $(seq 0 "${total_cpus}" )
+do
+ for govr in ${available_govr}
+ do
+ echo ${govr} >
/sys/devices/system/cpu/cpu${cpu}/cpufreq/scaling_governor
+ if [ "$?" -ne "0" ] ; then
+ echo "${0}: FAIL: Unable to set governor -- ${govr} for
cpu${cpu}"
+ RC=1
+ fi
+ done
+done
+if [ ${RC} -eq 0 ] ; then
+ echo "${0}: PASS: Changing cpu governors"
+fi
+#return $RC
diff -uprN ltp-full-20080930/testcases/kernel/pwmng/check_config.sh
ltp-full-20080930_pwmng/testcases/kernel/pwmng/check_config.sh
--- ltp-full-20080930/testcases/kernel/pwmng/check_config.sh 1970-01-01
05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/testcases/kernel/pwmng/check_config.sh
2008-10-20 19:24:56.000000000 +0530
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+. pm_include.sh
+
+if [ $# -lt 1 ] ; then
+ echo "Usage: ${0} <filename>"
+ RC=1
+ return ${RC}
+fi
+filename=${1}
+
+RC=0
+grep_command=grep
+config_file=/boot/config-$(uname -r)
+if [ ! -f ${config_file} ]; then
+ echo "MISSING_FILE: can't find the required config file at
/boot/config-$(uname -r)"
+ echo "Trying for alternate file at /proc/config.gz"
+ config_file=/proc/config.gz
+fi
+if [ ! -f ${config_file} ]; then
+ echo "MISSING_FILE: can't find the required config file at
/proc/config.gz"
+ RC=1
+fi
+if [ "${config_file}" = "/proc/config.gz" ] ; then
+ grep_command=zgrep
+fi
+
+while read config_option
+do
+ check_config_options "${config_option}=*" ${config_file} ${grep_command}
+done < ${filename}
+#return ${RC}
diff -uprN
ltp-full-20080930/testcases/kernel/pwmng/check_cpufreq_sysfs_files.sh
ltp-full-20080930_pwmng/testcases/kernel/pwmng/check_cpufreq_sysfs_files.sh
--- ltp-full-20080930/testcases/kernel/pwmng/check_cpufreq_sysfs_files.sh
1970-01-01 05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/testcases/kernel/pwmng/check_cpufreq_sysfs_files.sh
2008-10-20 19:24:56.000000000 +0530
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+. pm_include.sh
+
+total_cpus=$(no_of_cpus)
+(( total_cpus-=1 ))
+RC=0
+
+for cpu in $(seq 0 "${total_cpus}" )
+do
+ cpufiles=$(find /sys/devices/system/cpu/cpu"${cpu}"/cpufreq/ -name "*"
-type f)
+ for files in ${cpufiles}
+ do
+ cat ${files} 2>&1 >/dev/null
+ if [ $? -ne 0 ] ; then
+ echo "${0}: FAIL: cat ${files}"
+ RC=1
+ fi
+ done
+done
+if [ ${RC} -eq 0 ] ; then
+ echo "${0}: PASS: Checking cpu freq sysfs files"
+fi
+#return $RC
diff -uprN ltp-full-20080930/testcases/kernel/pwmng/check_kv_arch.c
ltp-full-20080930_pwmng/testcases/kernel/pwmng/check_kv_arch.c
--- ltp-full-20080930/testcases/kernel/pwmng/check_kv_arch.c 1970-01-01
05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/testcases/kernel/pwmng/check_kv_arch.c
2008-10-20 19:24:56.000000000 +0530
@@ -0,0 +1,41 @@
+/************************************************************************
+* Copyright (c) International Business Machines Corp., 2008
+* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*
+***************************************************************************/
+#include <stdio.h>
+#include <test.h>
+
+int kernel_is_too_old(void) {
+ if (tst_kvercmp(2,6,21) < 0)
+ return 1;
+ return 0;
+}
+
+/*
+ * yeah, to make the makefile coding easier, do_check returns
+ * 1 if unshare is not supported, 0 if it is
+ */
+#ifdef __i386__
+int do_check(void) { return kernel_is_too_old(); }
+#elif __x86_64__
+int do_check(void) { return kernel_is_too_old(); }
+#else
+int do_check(void) { return 1; }
+#endif
+
+int main() {
+ return do_check();
+}
+
diff -uprN ltp-full-20080930/testcases/kernel/pwmng/config_cpu_freq
ltp-full-20080930_pwmng/testcases/kernel/pwmng/config_cpu_freq
--- ltp-full-20080930/testcases/kernel/pwmng/config_cpu_freq 1970-01-01
05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/testcases/kernel/pwmng/config_cpu_freq
2008-10-20 19:24:56.000000000 +0530
@@ -0,0 +1,7 @@
+CONFIG_CPU_FREQ
+CONFIG_CPU_FREQ_TABLE
+CONFIG_CPU_FREQ_DEBUG
+CONFIG_CPU_FREQ_STAT
+CONFIG_CPU_FREQ_STAT_DETAILS
+CONFIG_CPU_FREQ_DEFAULT_GOV_*
+CONFIG_CPU_FREQ_GOV_*
diff -uprN ltp-full-20080930/testcases/kernel/pwmng/config_cpu_idle
ltp-full-20080930_pwmng/testcases/kernel/pwmng/config_cpu_idle
--- ltp-full-20080930/testcases/kernel/pwmng/config_cpu_idle 1970-01-01
05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/testcases/kernel/pwmng/config_cpu_idle
2008-10-20 19:24:56.000000000 +0530
@@ -0,0 +1,3 @@
+CONFIG_CPU_IDLE
+CONFIG_CPU_IDLE_GOV_LADDER
+CONFIG_CPU_IDLE_GOV_MENU
diff -uprN ltp-full-20080930/testcases/kernel/pwmng/config_sched_mc
ltp-full-20080930_pwmng/testcases/kernel/pwmng/config_sched_mc
--- ltp-full-20080930/testcases/kernel/pwmng/config_sched_mc 1970-01-01
05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/testcases/kernel/pwmng/config_sched_mc
2008-10-20 19:24:56.000000000 +0530
@@ -0,0 +1 @@
+CONFIG_SCHED_MC
diff -uprN ltp-full-20080930/testcases/kernel/pwmng/Makefile
ltp-full-20080930_pwmng/testcases/kernel/pwmng/Makefile
--- ltp-full-20080930/testcases/kernel/pwmng/Makefile 1970-01-01
05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/testcases/kernel/pwmng/Makefile 2008-10-20
19:24:56.000000000 +0530
@@ -0,0 +1,42 @@
+################################################################################
+##
##
+## Copyright (c) International Business Machines Corp., 2008
##
+##
##
+## 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##
+##
##
+################################################################################
+
+all:
+ @set -e; $(MAKE) check_kv_arch ;
+
+check_kv_arch: check_kv_arch.c
+ $(CC) -o $@ $< ../../../lib/tst_kvercmp.c -I../../../include
+
+install:
+ @set -e; ln -f check_kv_arch ../../bin/check_kv_arch; \
+ ln -f change_freq.sh ../../bin/change_freq.sh; \
+ ln -f change_govr.sh ../../bin/change_govr.sh; \
+ ln -f check_cpufreq_sysfs_files.sh
../../bin/check_cpufreq_sysfs_files.sh; \
+ ln -f check_config.sh ../../bin/check_config.sh; \
+ ln -f pwkm_load_unload.sh ../../bin/pwkm_load_unload.sh; \
+ ln -f pm_include.sh ../../bin/pm_include.sh; \
+ ln -f runpwtests.sh ../../bin/runpwtests.sh; \
+ ln -f test_sched_mc.sh ../../bin/test_sched_mc.sh; \
+ ln -f config_cpu_freq ../../bin/config_cpu_freq; \
+ ln -f config_cpu_idle ../../bin/config_cpu_idle; \
+ ln -f config_sched_mc ../../bin/config_sched_mc;
+clean:
+ rm -f check_kv_arch
+
diff -uprN ltp-full-20080930/testcases/kernel/pwmng/pm_include.sh
ltp-full-20080930_pwmng/testcases/kernel/pwmng/pm_include.sh
--- ltp-full-20080930/testcases/kernel/pwmng/pm_include.sh 1970-01-01
05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/testcases/kernel/pwmng/pm_include.sh
2008-10-20 19:24:56.000000000 +0530
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+TMPDIR=/tmp
+
+PASS=0
+FAIL=1
+NOSUPPORT=2
+MISSING_FILE=3
+UNTESTED=4
+
+function cleanup() {
+ if [ -f ${1} ] ; then
+ rm -f ${1}
+ fi
+}
+function check_config_options() {
+ if ( ! ${3} "${1}" ${2} | grep -v "#" > /dev/null ) ; then
+ echo "NOSUPPORT: current system dosen't support ${1}"
+ fi
+}
+function no_of_cpus() {
+ echo $(cat /proc/cpuinfo | grep processor | wc -l)
+}
+function get_topology() {
+ declare -a cpus
+ declare -a phyid
+
+ total_cpus=$(no_of_cpus)
+ (( total_cpus-=1 ))
+ for cpu in $(seq 0 "${total_cpus}" )
+ do
+ cpus[$cpu]=cpu${cpu}
+ phyid[$cpu]=$(cat
/sys/devices/system/cpu/cpu${cpu}/topology/physical_package_id)
+ done
+ j=0
+ while [ "${j}" -lt "${total_cpus}" ]
+ do
+ (( k = $j + 1 ))
+ if [ ${phyid[$j]} -eq ${phyid[$k]} ] ; then
+ echo "${cpus[$j]} -P ${cpus[$k]}" | sed -e "s/cpu//g"
+ fi
+ (( j+=1 ))
+ done
+}
+function check_cpufreq() {
+ total_cpus=$(no_of_cpus)
+ (( total_cpus-=1 ))
+
+ for cpu in $(seq 0 "${total_cpus}" )
+ do
+ if [ ! -d /sys/devices/system/cpu/cpu${cpu}/cpufreq ] ; then
+ echo "NOSUPPORT: cpufreq support not found please check
Kernel configuration or BIOS settings"
+ exit $NOSUPPORT
+ fi
+ done
+}
+function get_supporting_freq() {
+ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies
| uniq
+}
+function get_supporting_govr() {
+ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors |
uniq
+}
+
diff -uprN ltp-full-20080930/testcases/kernel/pwmng/pwkm_load_unload.sh
ltp-full-20080930_pwmng/testcases/kernel/pwmng/pwkm_load_unload.sh
--- ltp-full-20080930/testcases/kernel/pwmng/pwkm_load_unload.sh
1970-01-01 05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/testcases/kernel/pwmng/pwkm_load_unload.sh
2008-10-20 19:24:56.000000000 +0530
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+#Loading modules
+for module in cpufreq_conservative cpufreq_powersave cpufreq_userspace
+do
+ #echo -n "Loading $module ... "
+ modprobe $module >/dev/null
+ if [ $? -ne 0 ] ; then
+ echo "${0}: FAIL: Loading of module $module or check whether
you compiled as module or not"
+ fi
+done
+for module in cpufreq_conservative cpufreq_powersave cpufreq_userspace
+do
+ #echo -n "Unloading $module ... "
+ modprobe -r $module >/dev/null
+ if [ $? -ne 0 ] ; then
+ echo "${0}: FAIL: Loading of module $module or check whether
you compiled as module or not"
+ fi
+done
diff -uprN ltp-full-20080930/testcases/kernel/pwmng/README
ltp-full-20080930_pwmng/testcases/kernel/pwmng/README
--- ltp-full-20080930/testcases/kernel/pwmng/README 1970-01-01
05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/testcases/kernel/pwmng/README 2008-10-20
19:28:56.000000000 +0530
@@ -0,0 +1,68 @@
+################################################################################
+##
##
+## Copyright (c) International Business Machines Corp., 2007
##
+##
##
+## 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##
+##
##
+################################################################################
+
+POWER MANAGEMENT TESTS AUTOMATION SUITE
+----------------------------------------
+The tests requires the Kernel to be compiled with the following config's
+
+for CPU FREQUENCY tests:
+
+CONFIG_CPU_FREQ
+CONFIG_CPU_FREQ_TABLE
+CONFIG_CPU_FREQ_DEBUG
+CONFIG_CPU_FREQ_STAT
+CONFIG_CPU_FREQ_STAT_DETAILS
+CONFIG_CPU_FREQ_DEFAULT_GOV_*
+CONFIG_CPU_FREQ_GOV_*
+
+for CPU IDLE tests:
+
+CONFIG_CPU_IDLE
+CONFIG_CPU_IDLE_GOV_LADDER
+CONFIG_CPU_IDLE_GOV_MENU
+
+for SCHED_MC tests:
+
+CONFIG_SCHED_MC
+
+The power management test automation suite helps run the power management
functionality
+(e.g: cpu frequency, cpu idle etc..) tests and report results.
+
+Test Scripts for CPU FREQUENCY:
+change_freq.sh
+change_govr.sh
+check_cpufreq_sysfs_files.sh
+
+Test Scripts for CPU IDLE:
+will be added soon
+
+Test Scripts for SCHED_MC:
+test_sched_mc.sh
+
+Common functionality:
+pm_include.sh
+check_kv_arch.c
+pwkm_load_unload.sh
+
+To run your tests you can execute the runpwtests.sh
+
+To run the tests individually :
+
+P.S. As of now the supporting architecture(s) are x86,x86_64
diff -uprN ltp-full-20080930/testcases/kernel/pwmng/runpwtests.sh
ltp-full-20080930_pwmng/testcases/kernel/pwmng/runpwtests.sh
--- ltp-full-20080930/testcases/kernel/pwmng/runpwtests.sh 1970-01-01
05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/testcases/kernel/pwmng/runpwtests.sh
2008-10-20 19:45:29.000000000 +0530
@@ -0,0 +1,97 @@
+################################################################################
+##
##
+## Copyright (c) International Business Machines Corp., 2001
##
+##
##
+## 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##
+##
##
+################################################################################
+#
+# File : test_powermanagement.sh
+#
+# Description:
+#
+# Author: Nageswara R Sastry <[EMAIL PROTECTED]>
+#
+# History: 26 Aug 2008 - Created this file
+#
+#! /bin/sh
+
+# Exporting Required variables
+
+export TST_TOTAL=1
+LTPTMP=${TMP}
+LTPROOT=../../bin
+export PATH=${PATH}:.
+export TCID="Power Management"
+export TST_COUNT=0
+
+# Function: main
+#
+# Description: - Execute all tests, exit with test status.
+#
+# Exit: - zero on success
+# - non-zero on failure.
+#
+RC=0 #Return status
+
+# Checking required kernel version and architecture
+check_kv_arch || RC=$?
+if [ $RC -eq 1 ] ; then
+ tst_resm TFAIL "Kernel version or Architecture not supported: Not
running testcases"
+ #exit 0
+fi
+
+# Checking sched_mc sysfs interface
+#check_config.sh config_sched_mc || RC=$?
+if [ -f /sys/devices/system/cpu/sched_mc_power_savings ] ; then
+ test_sched_mc.sh || RC=$?
+ if [ $RC -eq 1 ] ; then
+ tst_resm TFAIL "SCHED_MC sysfs tests failed"
+ fi
+else
+ tst_resm TFAIL "Required kernel configuration for SCHED_MC NOT set"
+ #exit 0
+fi
+
+# Checking cpufreq sysfs interface files
+#check_config.sh config_cpu_freq || RC=$?
+if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
+ check_cpufreq_sysfs_files.sh || RC=$?
+ if [ $RC -eq 1 ] ; then
+ tst_resm TFAIL "CPUFREQ sysfs tests failed"
+ fi
+
+ # Changing governors
+ change_govr.sh || RC=$?
+ if [ $RC -eq 1 ] ; then
+ tst_resm TFAIL "Changing governors failed"
+ fi
+
+ # Changing frequencies
+ change_freq.sh || RC=$?
+ if [ $RC -eq 1 ] ; then
+ tst_resm TFAIL "Changing frequncies failed"
+ fi
+
+ # Loading and Unloading governor related kernel modules
+ pwkm_load_unload.sh || RC=$?
+ if [ $RC -eq 1 ] ; then
+ tst_resm TFAIL "Loading and Unloading of governor kernel
modules got failed"
+ fi
+else
+ tst_resm TFAIL "Required kernel configuration for CPU_FREQ NOT set"
+ #exit 0
+fi
+
diff -uprN ltp-full-20080930/testcases/kernel/pwmng/test_sched_mc.sh
ltp-full-20080930_pwmng/testcases/kernel/pwmng/test_sched_mc.sh
--- ltp-full-20080930/testcases/kernel/pwmng/test_sched_mc.sh 1970-01-01
05:30:00.000000000 +0530
+++ ltp-full-20080930_pwmng/testcases/kernel/pwmng/test_sched_mc.sh
2008-10-20 19:24:56.000000000 +0530
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+. pm_include.sh
+
+valid_input="0 1"
+invalid_input="a 2 abcefg x1999 xffff -1 -00000
200000000000000000000000000000000000000000000000000000000000000000000000000000
ox324 -0xfffffffffffffffffffff"
+test_file="/sys/devices/system/cpu/sched_mc_power_savings"
+if [ ! -f ${test_file} ] ; then
+ echo "MISSING_FILE: missing file ${test_file}"
+ exit $MISSING_FILE
+fi
+
+function check_input() {
+ validity_check=${2:-valid}
+ if [ "${validity_check}" = "invalid" ] ; then
+ PASS="Testcase FAIL - Able to execute"
+ FAIL="Testcase PASS - Unable to execute"
+ else
+ PASS="Testcase PASS"
+ FAIL="Testcase FAIL"
+ fi
+ for input in ${1}
+ do
+ echo ${input} > ${test_file} 2>/dev/null
+ return_value=$?
+ output=$(cat ${test_file})
+ if [ "${return_value}" = "0" -a "${input}" = "${output}" ] ;
then
+ echo "${0}: ${PASS}: echo ${input} > ${test_file}"
+ if [ "${validity_check}" = "invalid" ] ; then
+ RC=1
+ fi
+ else
+ echo "${0}: ${FAIL}: echo ${input} > ${test_file}"
+ if [ "${validity_check}" = "valid" ] ; then
+ RC=1
+ fi
+ fi
+ done
+}
+RC=0
+echo "${0}: ---Valid test cases---"
+check_input "${valid_input}"
+echo "${0}: ---Invalid test cases---"
+check_input "${invalid_input}" invalid
+#return $RC
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list