* [LTP] [PATCH] Fix the error handling logic in power_management tests
@ 2009-06-08 11:39 Jiri Palecek
2009-06-09 18:25 ` Subrata Modak
0 siblings, 1 reply; 2+ messages in thread
From: Jiri Palecek @ 2009-06-08 11:39 UTC (permalink / raw)
To: ltp-list
Hello,
there is a problem with error reporting in power_management tests. Particularly, it wouldn't report failure to pan when one of the tests failed. This patch does the following:
- make it actually fail when one of the tests fails
- assume return values other than 1 (except 0, of course) are
errors, too
- write PASS messages for successful tests
Regards
Jiri Palecek
Signed-off-by: Jiri Palecek <jpalecek@web.de>
---
testcases/kernel/power_management/pm_include.sh | 1 +
testcases/kernel/power_management/runpwtests.sh | 84 ++++++++++++++---------
2 files changed, 52 insertions(+), 33 deletions(-)
diff --git a/testcases/kernel/power_management/pm_include.sh b/testcases/kernel/power_management/pm_include.sh
index 389387c..acbd476 100755
--- a/testcases/kernel/power_management/pm_include.sh
+++ b/testcases/kernel/power_management/pm_include.sh
@@ -81,6 +81,7 @@ function check_input() {
PASS="Testcase PASS"
FAIL="Testcase FAIL"
fi
+ RC=0
for input in ${1}
do
echo ${input} > ${test_file} 2>/dev/null
diff --git a/testcases/kernel/power_management/runpwtests.sh b/testcases/kernel/power_management/runpwtests.sh
index 32fb59c..e9be303 100755
--- a/testcases/kernel/power_management/runpwtests.sh
+++ b/testcases/kernel/power_management/runpwtests.sh
@@ -60,8 +60,10 @@ 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
+ if test_sched_mc.sh ; then
+ tst_resm TPASS "SCHED_MC sysfs tests passed"
+ else
+ RC=$?
tst_resm TFAIL "SCHED_MC sysfs tests failed"
fi
# Test CPU consolidation for corresponding sched_mc
@@ -78,26 +80,26 @@ if [ -f /sys/devices/system/cpu/sched_mc_power_savings ] ; then
if [ $sched_smt -eq 0 -a $sched_mc -eq 0 ]; then
continue
fi
- cpu_consolidation.py -c $sched_mc -t $sched_smt; RC=$?
- if [ $RC -eq 1 ] ; then
- tst_resm TFAIL "cpu consolidation \
- sched_mc=$sched_mc, sched_smt=$sched_smt"
- else
+ if cpu_consolidation.py -c $sched_mc -t $sched_smt ; then
tst_resm TPASS "cpu consolidation sched_mc=$sched_mc,\
sched_smt=$sched_smt"
+ else
+ RC=$?
+ tst_resm TFAIL "cpu consolidation \
+ sched_mc=$sched_mc, sched_smt=$sched_smt"
fi
done
done
else
# Test CPU consolidation for sched_mc=1 & 2
for sched_mc in `seq 1 2`; do
- cpu_consolidation.py -c $sched_mc; RC=$?
- if [ $RC -eq 1 ] ; then
- tst_resm TFAIL "cpu consolidation test\
- sched_mc_power set to $sched_mc"
- else
+ if cpu_consolidation.py -c $sched_mc ; then
tst_resm TPASS "cpu consolidation test for \
sched_mc_power set to $sched_mc"
+ else
+ RC=$?
+ tst_resm TFAIL "cpu consolidation test\
+ sched_mc_power set to $sched_mc"
fi
done
fi
@@ -110,24 +112,24 @@ sched_mc_power set to $sched_mc"
continue
fi
- sched_domain.py -c $sched_mc -t $sched_smt; RC=$?
- if [ $RC -eq 1 ] ; then
- tst_resm TFAIL "sched domain test sched_mc=$sched_mc,\
-sched_smt=$sched_smt "
- else
+ if sched_domain.py -c $sched_mc -t $sched_smt; then
tst_resm TPASS "sched domain test sched_mc=$sched_mc,\
sched_smt=$sched_smt "
+ else
+ RC=$?
+ tst_resm TFAIL "sched domain test sched_mc=$sched_mc,\
+sched_smt=$sched_smt "
fi
done
done
else
# Validate CPU level sched domain topology validation
for sched_mc in `seq 1 2`; do
- sched_domain.py -c $sched_mc; RC=$?
- if [ $RC -eq 1 ] ; then
- tst_resm TFAIL "sched domain test for sched_mc=$sched_mc "
- else
+ if sched_domain.py -c $sched_mc ; then
tst_resm TPASS "sched domain test for sched_mc=$sched_mc "
+ else
+ RC=$?
+ tst_resm TFAIL "sched domain test for sched_mc=$sched_mc "
fi
done
@@ -139,26 +141,35 @@ 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
+ if check_cpufreq_sysfs_files.sh ; then
+ tst_resm TPASS "CPUFREQ sysfs tests "
+ else
+ RC=$?
tst_resm TFAIL "CPUFREQ sysfs tests "
fi
# Changing governors
- change_govr.sh; RC=$?
- if [ $RC -eq 1 ] ; then
+ if change_govr.sh ; then
+ tst_resm TPASS "Changing governors "
+ else
+ RC=$?
tst_resm TFAIL "Changing governors "
fi
# Changing frequencies
- change_freq.sh; RC=$?
- if [ $RC -eq 1 ] ; then
+ if change_freq.sh ; then
+ tst_resm TPASS "Changing frequncies "
+ else
+ RC=$?
tst_resm TFAIL "Changing frequncies "
fi
# Loading and Unloading governor related kernel modules
- pwkm_load_unload.sh; RC=$?
- if [ $RC -eq 1 ] ; then
+ if pwkm_load_unload.sh ; then
+ tst_resm TPASS "Loading and Unloading of governor kernel \
+ modules got failed"
+ else
+ RC=$?
tst_resm TFAIL "Loading and Unloading of governor kernel \
modules got failed"
fi
@@ -167,23 +178,30 @@ else
fi
# Checking cpuidle sysfs interface files
-check_cpuidle_sysfs_files.sh; RC=$?
-if [ $RC -eq 1 ] ; then
+if check_cpuidle_sysfs_files.sh ; then
+ tst_resm TPASS "CPUIDLE sysfs tests failed"
+else
+ RC=$?
tst_resm TFAIL "CPUIDLE sysfs tests failed"
fi
# Test sched_smt_power_savings interface on HT machines
if [ -f /sys/devices/system/cpu/sched_smt_power_savings ] ; then
- test_sched_smt.sh; RC=$?
- if [ $RC -eq 1 ] ; then
+ if test_sched_smt.sh ; then
+ tst_resm TPASS "SCHED_MC sysfs tests failed"
+ else
+ RC=$?
tst_resm TFAIL "SCHED_MC sysfs tests failed"
fi
else
hyper_threaded=$(is_hyper_threaded)
if [ $hyper_threaded -eq 1 ]; then
tst_resm TFAIL "Required kernel configuration for SCHED_SMT NOT set"
+ RC=1
else
tst_resm TCONF "Required Hyper Threading support in the\
system under test"
fi
fi
+
+exit $RC
\ No newline at end of file
--
1.6.2.4
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [LTP] [PATCH] Fix the error handling logic in power_management tests
2009-06-08 11:39 [LTP] [PATCH] Fix the error handling logic in power_management tests Jiri Palecek
@ 2009-06-09 18:25 ` Subrata Modak
0 siblings, 0 replies; 2+ messages in thread
From: Subrata Modak @ 2009-06-09 18:25 UTC (permalink / raw)
To: Jiri Palecek; +Cc: ltp-list
On Mon, 2009-06-08 at 13:39 +0200, Jiri Palecek wrote:
> Hello,
>
> there is a problem with error reporting in power_management tests. Particularly, it wouldn't report failure to pan when one of the tests failed. This patch does the following:
>
> - make it actually fail when one of the tests fails
>
> - assume return values other than 1 (except 0, of course) are
> errors, too
>
> - write PASS messages for successful tests
>
> Regards
> Jiri Palecek
>
> Signed-off-by: Jiri Palecek <jpalecek@web.de>
Thanks.
Regards--
Subrata
> ---
> testcases/kernel/power_management/pm_include.sh | 1 +
> testcases/kernel/power_management/runpwtests.sh | 84 ++++++++++++++---------
> 2 files changed, 52 insertions(+), 33 deletions(-)
>
> diff --git a/testcases/kernel/power_management/pm_include.sh b/testcases/kernel/power_management/pm_include.sh
> index 389387c..acbd476 100755
> --- a/testcases/kernel/power_management/pm_include.sh
> +++ b/testcases/kernel/power_management/pm_include.sh
> @@ -81,6 +81,7 @@ function check_input() {
> PASS="Testcase PASS"
> FAIL="Testcase FAIL"
> fi
> + RC=0
> for input in ${1}
> do
> echo ${input} > ${test_file} 2>/dev/null
> diff --git a/testcases/kernel/power_management/runpwtests.sh b/testcases/kernel/power_management/runpwtests.sh
> index 32fb59c..e9be303 100755
> --- a/testcases/kernel/power_management/runpwtests.sh
> +++ b/testcases/kernel/power_management/runpwtests.sh
> @@ -60,8 +60,10 @@ 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
> + if test_sched_mc.sh ; then
> + tst_resm TPASS "SCHED_MC sysfs tests passed"
> + else
> + RC=$?
> tst_resm TFAIL "SCHED_MC sysfs tests failed"
> fi
> # Test CPU consolidation for corresponding sched_mc
> @@ -78,26 +80,26 @@ if [ -f /sys/devices/system/cpu/sched_mc_power_savings ] ; then
> if [ $sched_smt -eq 0 -a $sched_mc -eq 0 ]; then
> continue
> fi
> - cpu_consolidation.py -c $sched_mc -t $sched_smt; RC=$?
> - if [ $RC -eq 1 ] ; then
> - tst_resm TFAIL "cpu consolidation \
> - sched_mc=$sched_mc, sched_smt=$sched_smt"
> - else
> + if cpu_consolidation.py -c $sched_mc -t $sched_smt ; then
> tst_resm TPASS "cpu consolidation sched_mc=$sched_mc,\
> sched_smt=$sched_smt"
> + else
> + RC=$?
> + tst_resm TFAIL "cpu consolidation \
> + sched_mc=$sched_mc, sched_smt=$sched_smt"
> fi
> done
> done
> else
> # Test CPU consolidation for sched_mc=1 & 2
> for sched_mc in `seq 1 2`; do
> - cpu_consolidation.py -c $sched_mc; RC=$?
> - if [ $RC -eq 1 ] ; then
> - tst_resm TFAIL "cpu consolidation test\
> - sched_mc_power set to $sched_mc"
> - else
> + if cpu_consolidation.py -c $sched_mc ; then
> tst_resm TPASS "cpu consolidation test for \
> sched_mc_power set to $sched_mc"
> + else
> + RC=$?
> + tst_resm TFAIL "cpu consolidation test\
> + sched_mc_power set to $sched_mc"
> fi
> done
> fi
> @@ -110,24 +112,24 @@ sched_mc_power set to $sched_mc"
> continue
> fi
>
> - sched_domain.py -c $sched_mc -t $sched_smt; RC=$?
> - if [ $RC -eq 1 ] ; then
> - tst_resm TFAIL "sched domain test sched_mc=$sched_mc,\
> -sched_smt=$sched_smt "
> - else
> + if sched_domain.py -c $sched_mc -t $sched_smt; then
> tst_resm TPASS "sched domain test sched_mc=$sched_mc,\
> sched_smt=$sched_smt "
> + else
> + RC=$?
> + tst_resm TFAIL "sched domain test sched_mc=$sched_mc,\
> +sched_smt=$sched_smt "
> fi
> done
> done
> else
> # Validate CPU level sched domain topology validation
> for sched_mc in `seq 1 2`; do
> - sched_domain.py -c $sched_mc; RC=$?
> - if [ $RC -eq 1 ] ; then
> - tst_resm TFAIL "sched domain test for sched_mc=$sched_mc "
> - else
> + if sched_domain.py -c $sched_mc ; then
> tst_resm TPASS "sched domain test for sched_mc=$sched_mc "
> + else
> + RC=$?
> + tst_resm TFAIL "sched domain test for sched_mc=$sched_mc "
> fi
> done
>
> @@ -139,26 +141,35 @@ 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
> + if check_cpufreq_sysfs_files.sh ; then
> + tst_resm TPASS "CPUFREQ sysfs tests "
> + else
> + RC=$?
> tst_resm TFAIL "CPUFREQ sysfs tests "
> fi
>
> # Changing governors
> - change_govr.sh; RC=$?
> - if [ $RC -eq 1 ] ; then
> + if change_govr.sh ; then
> + tst_resm TPASS "Changing governors "
> + else
> + RC=$?
> tst_resm TFAIL "Changing governors "
> fi
>
> # Changing frequencies
> - change_freq.sh; RC=$?
> - if [ $RC -eq 1 ] ; then
> + if change_freq.sh ; then
> + tst_resm TPASS "Changing frequncies "
> + else
> + RC=$?
> tst_resm TFAIL "Changing frequncies "
> fi
>
> # Loading and Unloading governor related kernel modules
> - pwkm_load_unload.sh; RC=$?
> - if [ $RC -eq 1 ] ; then
> + if pwkm_load_unload.sh ; then
> + tst_resm TPASS "Loading and Unloading of governor kernel \
> + modules got failed"
> + else
> + RC=$?
> tst_resm TFAIL "Loading and Unloading of governor kernel \
> modules got failed"
> fi
> @@ -167,23 +178,30 @@ else
> fi
>
> # Checking cpuidle sysfs interface files
> -check_cpuidle_sysfs_files.sh; RC=$?
> -if [ $RC -eq 1 ] ; then
> +if check_cpuidle_sysfs_files.sh ; then
> + tst_resm TPASS "CPUIDLE sysfs tests failed"
> +else
> + RC=$?
> tst_resm TFAIL "CPUIDLE sysfs tests failed"
> fi
>
> # Test sched_smt_power_savings interface on HT machines
> if [ -f /sys/devices/system/cpu/sched_smt_power_savings ] ; then
> - test_sched_smt.sh; RC=$?
> - if [ $RC -eq 1 ] ; then
> + if test_sched_smt.sh ; then
> + tst_resm TPASS "SCHED_MC sysfs tests failed"
> + else
> + RC=$?
> tst_resm TFAIL "SCHED_MC sysfs tests failed"
> fi
> else
> hyper_threaded=$(is_hyper_threaded)
> if [ $hyper_threaded -eq 1 ]; then
> tst_resm TFAIL "Required kernel configuration for SCHED_SMT NOT set"
> + RC=1
> else
> tst_resm TCONF "Required Hyper Threading support in the\
> system under test"
> fi
> fi
> +
> +exit $RC
> \ No newline at end of file
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-09 18:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-08 11:39 [LTP] [PATCH] Fix the error handling logic in power_management tests Jiri Palecek
2009-06-09 18:25 ` Subrata Modak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox