All of lore.kernel.org
 help / color / mirror / Atom feed
From: Poornima Nayak <mpnayak@linux.vnet.ibm.com>
To: ltp-list@lists.sourceforge.net
Subject: [LTP] [Patch 8/10]New set of reusbale Library functions and fixes
Date: Tue, 30 Jun 2009 20:28:15 +0530	[thread overview]
Message-ID: <20090630145815.11163.6728.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20090630145706.11163.54040.sendpatchset@localhost.localdomain>

[Patch 8/10]New set of reusbale Library functions and fixes

Signed-off-by: poornima nayak <mpnayak@linux.vnet.ibm.com>

diff -uprN ltp_orig/testcases/kernel/power_management/pm_include.sh ltp_patched/testcases/kernel/power_management/pm_include.sh
--- ltp_orig/testcases/kernel/power_management/pm_include.sh	2009-06-30 15:04:19.000000000 +0530
+++ ltp_patched/testcases/kernel/power_management/pm_include.sh	2009-06-30 16:06:32.000000000 +0530
@@ -7,6 +7,7 @@ FAIL=1
 NOSUPPORT=2
 MISSING_FILE=3
 UNTESTED=4
+YES=0
 
 function cleanup() {
 	if [ -f ${1} ] ; then
@@ -65,9 +66,9 @@ function is_hyper_threaded() {
 	siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'`
 	cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | cut -f2 -d':'`
 	if [ $siblings -eq $cpu_cores ]; then
-		echo 0
+		return 1
 	else
-		echo 1
+		return 0
 	fi
 }
 
@@ -101,4 +102,291 @@ function check_input() {
 	done
 	return $RC
 }
- 
+
+function is_multi_socket() {
+	no_of_sockets=`cat /sys/devices/system/cpu/cpu?/topology/physical_package_id | uniq | wc -l`
+	if [ $no_of_sockets -gt 1 ] ; then
+		return 0
+	else
+		return 1
+	fi
+}
+
+function get_kernel_version() {
+	# Get kernel minor version
+	export kernel_version=`uname -r | awk -F. '{print $1"."$2"."$3}' | cut -f1 -d'-'`
+}
+
+function get_valid_input() {
+	kernel_version=$1
+	case "$kernel_version" in
+	'2.6.29' | '2.6.30' | '2.6.31')
+			export valid_input="0 1 2" ;;
+		*) export valid_input="0 1" ;;
+	esac
+}
+		
+function get_max_sched_mc() {
+	get_kernel_version
+	case "$kernel_version" in
+	'2.6.29' | '2.6.30' | '2.6.31') 
+		return 2
+		;;
+	'2.6.26' | '2.6.27' | '2.6.28') 
+		return 1
+		;;
+	*) 
+		return 0
+		;;
+	esac
+}
+
+function get_max_sched_smt() {
+    get_kernel_version
+    case "$kernel_version" in
+        '2.6.29' | '2.6.30' | '2.6.31') 
+                    return 2
+				;;
+        '2.6.26' | '2.6.27' | '2.6.28') 
+                    return 1
+				;;
+        *) 
+			return 0
+			;;
+	esac
+}
+
+function check_supp_wkld() {
+	sched_mcsmt=$1
+	work_load=$2
+
+	case "$sched_mcsmt" in
+		1) if [ "$work_load" == "ebizzy" ]; then
+				return 0
+			else
+				return 1
+			fi
+			;;
+		2) if [ "$work_load" == "ebizzy" -o "$work_load" == "kernbench" ]; then
+                return 0
+            else
+                return 1
+            fi
+            ;;
+		*) 
+               return 1
+			;;
+	esac
+}
+
+function analyze_wrt_workload_hyperthreaded() {
+	sched_mc=$1
+    work_load=$2
+    pass_count=$3
+    sched_smt=$4
+    stress=$5
+
+	if [ $sched_mc > $sched_smt ]; then
+		check_supp_wkld $sched_mc $work_load; valid_workload=$?
+	else
+		check_supp_wkld $sched_smt $work_load; valid_workload=$?
+	fi
+
+	if [ "$stress" = "thread" ]; then
+		case "$valid_workload" in
+        0)
+			if [ $pass_count -lt 5 ]; then
+				RC=1
+				tst_resm TFAIL "Consolidation at core level failed for \
+sched_mc=$sched_mc, sched_smt=$sched_smt for workload=$work_load"
+			else
+				tst_resm TPASS "Consolidation at core level passed for \
+sched_mc=$sched_mc, sched_smt=$sched_smt & workload=$work_load"
+			fi ;;
+        1)
+            if [ $pass_count -lt 5 ]; then
+                tst_resm TPASS "Consolidation at core level failed for \
+unsupported workload $work_load when sched_mc=$sched_mc & sched_smt=$sched_smt"
+            else
+				RC=1
+                tst_resm TFAIL "Consolidation at core level passed for \
+unsupported workload $work_load when sched_mc=$sched_mc & sched_smt=$sched_smt"
+            fi ;;
+        esac
+	else
+		case "$valid_workload" in
+        0)
+            if [ $pass_count -lt 5 ]; then
+				RC=1
+                tst_resm TFAIL "Consolidation at package level failed for \
+sched_mc=$sched_mc, sched_smt=$sched_smt for workload=$work_load"
+            else
+                tst_resm TPASS "Consolidation at package level passed for \
+sched_mc=$sched_mc, sched_smt=$sched_smt & workload=$work_load"
+            fi ;;
+        1)
+			echo "pass count is $pass_count"
+            if [ $pass_count -lt 5 ]; then
+                tst_resm TPASS "Consolidation at package level failed for \
+unsupported workload $work_load when sched_mc=$sched_mc & sched_smt=$sched_smt"
+            else
+				RC=1
+                tst_resm TFAIL "Consolidation at package level passed for \
+unsupported workload $work_load when sched_mc=$sched_mc & sched_smt=$sched_smt"
+            fi ;;
+        esac
+	fi
+}
+
+function analyze_wrt_wkld() {
+	sched_mc=$1
+    work_load=$2
+    pass_count=$3
+	sched_smt=$4
+	stress=$5
+
+	check_supp_wkld $sched_mc $work_load; valid_workload=$?
+	if [ $hyper_threaded -eq $YES ]; then
+		analyze_wrt_workload_hyperthreaded $sched_mc $work_load $pass_count\
+		 $sched_smt $stress
+	else
+		case "$valid_workload" in
+		0)
+			if [ "$pass_count" -lt 5 ]; then
+				RC=1
+				tst_resm TFAIL "cpu consolidation failed for \
+sched_mc=$sched_mc for workload=$work_load"
+			else
+				tst_resm TPASS "cpu consolidation passed for \
+sched_mc=$sched_mc for workload=$work_load"
+			fi ;;
+		1)
+			if [ "$pass_count" -lt 5 ]; then
+				tst_resm TPASS "cpu consolidation failed for \
+unsupported workload $work_load when sched_mc=$sched_mc"
+            else
+				RC=1
+				tst_resm TFAIL "cpu consolidation passed for \
+unsupported workload $work_load when sched_mc=$sched_mc"
+            fi ;;
+        esac
+	fi
+}
+
+function analyze_result_hyperthreaded() {
+	sched_mc=$1
+    work_load=$2
+    pass_count=$3
+    sched_smt=$4
+    stress=$5
+
+	case "$sched_mc" in
+	0)
+		if [ $sched_smt ]; then
+			case "$sched_smt" in
+			0)
+				if [ "$stress" = "thread" ]; then
+					if [ $pass_count -lt 1 ]; then
+						tst_resm TPASS "Consolidation at core level failed for sched_mc=\
+$sched_mc & sched_smt=$sched_smt for workload=$work_load"
+					else
+						RC=1
+						tst_resm TFAIL "Consolidation at core level passed for sched_mc=\
+$sched_mc & sched_smt=$sched_smt for workload=$work_load"
+					fi
+				else
+					if [ "$pass_count" -lt 1 ]; then
+						tst_resm TPASS "cpu consolidation failed for sched_mc=\
+$sched_mc & sched_smt=$sched_smt for workload=$work_load"
+					else
+						RC=1
+						tst_resm TFAIL "cpu consolidation passed for sched_mc=\
+$sched_mc & sched_smt=$sched_smt for workload=$work_load"
+					fi
+				fi
+				;;
+			*)
+				if [ "$stress" = "thread" ]; then
+					analyze_wrt_wkld $sched_mc $work_load $pass_count $sched_smt $stress
+				else
+					analyze_wrt_wkld $sched_mc $work_load $pass_count $sched_smt
+				fi ;;
+			esac
+		else
+			if [ $pass_count -lt 1 ]; then
+				tst_resm TPASS "cpu consolidation failed for sched_mc=\
+$sched_mc for workload=$work_load"
+			else
+				RC=1
+				tst_resm TFAIL "cpu consolidation passed for sched_mc=\
+$sched_mc & sched_smt=$sched_smt for workload=$work_load"
+			fi
+		fi
+		;;
+	*)
+		if [ "$stress" = "thread" ]; then
+			analyze_wrt_wkld $sched_mc $work_load $pass_count $sched_smt $stress
+		else
+			analyze_wrt_wkld $sched_mc $work_load $pass_count $sched_smt
+		fi
+		;;
+	esac
+}
+
+function analyze_consolidation_result() {
+	sched_mc=$1
+    work_load=$2
+    pass_count=$3
+	sched_smt=$4
+	stress=$5
+
+	if [ $hyper_threaded -eq $YES ]; then
+		analyze_result_hyperthreaded $sched_mc $work_load $pass_count $sched_smt $stress
+	else
+		case "$sched_mc" in
+	    0)
+    	    if [ $pass_count -lt 1 ]; then
+        	    tst_resm TPASS "cpu consolidation failed for sched_mc=\
+$sched_mc for workload=$work_load"
+        	else
+				RC=1
+            	tst_resm TFAIL "cpu consolidation passed for sched_mc=\
+$sched_mc for workload=$work_load"
+        	fi ;;
+    	*)
+        	analyze_wrt_wkld $sched_mc $work_load $pass_count
+        	;;
+    	esac
+	fi
+}
+
+function analyze_sched_domain_result(){
+	sched_mc=$1
+	result=$2
+	sched_smt=$3
+
+	if [ $hyper_threaded -eq $YES ]; then
+		if [ $sched_smt ]; then
+			if [ "$result" = 0 ];then
+				tst_resm TPASS "sched domain test for sched_mc=$sched_mc & sched_smt=$sched_smt"
+			else
+				RC=1
+				tst_resm TFAIL "sched domain test sched_mc=$sched_mc & sched_smt=$sched_smt"
+			fi
+		else
+			if [ "$result" = 0 ];then
+				tst_resm TPASS "sched domain test for sched_mc=$sched_mc"
+			else
+				RC=1
+				tst_resm TFAIL "sched domain test for sched_mc=$sched_mc"		
+			fi
+		fi
+	else
+		if [ "$result" = 0 ];then
+			tst_resm TPASS "sched domain test for sched_mc=$sched_mc"
+		else
+			RC=1
+			tst_resm TFAIL "sched domain test sched_mc=$sched_mc"
+		fi
+	fi
+}

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  parent reply	other threads:[~2009-06-30 14:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-30 14:57 [LTP] [Patch 1/10]Patch to integrate kernbench to LTP to test sched_mc=2 Poornima Nayak
2009-06-30 14:57 ` [LTP] [Patch 2/10]Makefile patch to integrate to LTP Poornima Nayak
2009-06-30 16:10   ` Subrata Modak
2009-06-30 14:57 ` [LTP] [Patch 3/10]Readme modified with pre-requisite for sched_mc=2 test Poornima Nayak
2009-06-30 16:10   ` Subrata Modak
2009-06-30 14:57 ` [LTP] [Patch 4/10]Reusable functions for consolidation test modified Poornima Nayak
2009-06-30 14:57 ` [LTP] [Patch 5/10]CPU consolidation testcase updated to handle exceptions Poornima Nayak
2009-06-30 14:57 ` [LTP] [Patch 6/10]sched domian " Poornima Nayak
2009-06-30 14:58 ` [LTP] [Patch 7/10]Fixes for sched_mc & sched_smt interface test Poornima Nayak
2009-06-30 14:58 ` Poornima Nayak [this message]
2009-06-30 14:58 ` [LTP] [Patch 9/10]Master script modified to cover additional test scenarios Poornima Nayak
2009-06-30 14:58 ` [LTP] [Patch 10/10]Patch to add another command file in runtest Poornima Nayak
2009-06-30 16:10   ` Subrata Modak
2009-06-30 16:09 ` [LTP] [Patch 1/10]Patch to integrate kernbench to LTP to test sched_mc=2 Subrata Modak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090630145815.11163.6728.sendpatchset@localhost.localdomain \
    --to=mpnayak@linux.vnet.ibm.com \
    --cc=ltp-list@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.