public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Subrata Modak <subrata@linux.vnet.ibm.com>
To: Garrett Cooper <yanegomi@gmail.com>,
	Poornima Nayak <mpnayak@linux.vnet.ibm.com>
Cc: ltp-list@lists.sourceforge.net, vaidy <svaidy@linux.vnet.ibm.com>,
	gautham <ego@in.ibm.com>,
	arun@linux.vnet.ibm.com
Subject: Re: [LTP] New & modified reusable functions for new & existing	testcases
Date: Sun, 23 Aug 2009 12:59:14 +0530	[thread overview]
Message-ID: <1251012555.16822.40.camel@subratamodak.linux.ibm.com> (raw)
In-Reply-To: <364299f40908200951h2fed6a68gec2eace5879917ca@mail.gmail.com>

On Thu, 2009-08-20 at 09:51 -0700, Garrett Cooper wrote: 
> On Thu, Aug 20, 2009 at 9:07 AM, Poornima
> Nayak<mpnayak@linux.vnet.ibm.com> wrote:
> > Implemented reusable functions to learn system architecture before executing
> > architecture specific testcases.
> >
> > Signed-off-by: poornima nayak <mpnayak@linux.vnet.ibm.com>
> >
> > diff -uprN ltp-full-20090731_orig/testcases/kernel/power_management/pm_include.sh ltp-full-20090731/testcases/kernel/power_management/pm_include.sh
> > --- ltp-full-20090731_orig/testcases/kernel/power_management/pm_include.sh      2009-08-20 19:59:11.000000000 +0530
> > +++ ltp-full-20090731/testcases/kernel/power_management/pm_include.sh   2009-08-20 20:29:21.000000000 +0530
> > @@ -112,6 +112,46 @@ function is_multi_socket() {
> >        fi
> >  }
> >
> > +function is_multi_core() {
> > +       siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'`
> > +       cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | cut -f2 -d':'`
> > +       echo "siblings count $siblings cores count $cpu_cores"
> > +       if [ $siblings -eq $cpu_cores ]; then
> > +               if [ $cpu_cores -gt 1 ]; then
> > +                       return 0
> > +               else
> > +                       return 1
> > +               fi
> > +       else
> > +               : $(( num_of_cpus = siblings / cpu_cores ))
> > +               if [ $num_of_cpus -gt 1 ]; then
> > +                       return 0
> > +               else
> > +                       return 1
> > +               fi
> > +       fi
> > +}
> > +
> > +function is_dual_core() {
> > +       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
> > +                if [ $cpu_cores -eq 2 ]; then
> > +                        return 1
> > +                else
> > +                        return 0
> > +                fi
> > +        else
> > +                : $(( num_of_cpus = siblings / cpu_cores ))
> > +                if [ $num_of_cpus -eq 2 ]; then
> > +                        echo "number of cpus $num_of_cpus"
> > +                        return 1
> > +                else
> > +                        return 0
> > +                fi
> > +        fi
> > +}
> > +
> >  function get_kernel_version() {
> >        # Get kernel minor version
> >        export kernel_version=`uname -r | awk -F. '{print $1"."$2"."$3}' | cut -f1 -d'-'`
> > @@ -120,42 +160,12 @@ function get_kernel_version() {
> >  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" ;;
> > +       '2.6.26' | '2.6.27' | '2.6.28')
> > +                       export valid_input="0 1" ;;
> > +               *) export valid_input="0 1 2" ;;
> >        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
> > @@ -184,58 +194,33 @@ function analyze_wrt_workload_hyperthrea
> >     work_load=$2
> >     pass_count=$3
> >     sched_smt=$4
> > -    stress=$5
> >
> > -       if [ $sched_mc > $sched_smt ]; then
> > +       if [ $sched_mc -gt $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 \
> > +       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 \
> > +               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 \
> > +               fi ;;
> > +       1)
> > +               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 \
> > +               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 ;;
> > +               fi ;;
> >         esac
> > -       fi
> >  }
> >
> >  function analyze_wrt_wkld() {
> > @@ -243,12 +228,11 @@ function analyze_wrt_wkld() {
> >     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
> > +                $sched_smt
> >        else
> >                case "$valid_workload" in
> >                0)
> > @@ -278,74 +262,56 @@ function analyze_result_hyperthreaded()
> >     work_load=$2
> >     pass_count=$3
> >     sched_smt=$4
> > -    stress=$5
> >
> > +       echo "sched_mc =$sched_mc  work-load=$work_load  pass_count=$pass_count  sched_smt=$sched_smt"
> >        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=\
> > +                               if [ "$pass_count" -lt 5 ]; then
> > +                                       tst_resm TPASS "cpu consolidation failed 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=\
> > +                                       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 ;;
> > +                               analyze_wrt_wkld $sched_mc $work_load $pass_count $sched_smt
> > +                               ;;
> >                        esac
> >                else
> > -                       if [ $pass_count -lt 1 ]; then
> > +                       if [ $pass_count -lt 5 ]; 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"
> > +$sched_mc 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() {
> > +function analyze_package_consolidation_result() {
> >        sched_mc=$1
> >     work_load=$2
> >     pass_count=$3
> >        sched_smt=$4
> > -       stress=$5
> >
> > +       echo "sched mc $sched_mc sched smt is $sched_smt workload $work_load pass count $pass_count"
> >        if [ $hyper_threaded -eq $YES ]; then
> > -               analyze_result_hyperthreaded $sched_mc $work_load $pass_count $sched_smt $stress
> > +               analyze_result_hyperthreaded $sched_mc $work_load $pass_count $sched_smt
> >        else
> >                case "$sched_mc" in
> >            0)
> > -           if [ $pass_count -lt 1 ]; then
> > +           if [ $pass_count -lt 5 ]; then
> >                    tst_resm TPASS "cpu consolidation failed for sched_mc=\
> >  $sched_mc for workload=$work_load"
> >                else
> > @@ -360,6 +326,33 @@ $sched_mc for workload=$work_load"
> >        fi
> >  }
> >
> > +function analyze_core_consolidation_result() {
> > +       sched_smt=$1
> > +       work_load=$2
> > +       pass_count=$3
> > +
> > +       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
> > +}
> > +
> >  function analyze_sched_domain_result(){
> >        sched_mc=$1
> >        result=$2
> 
> 1. Check for files before cat'ing or at least redirect stderr to /dev/null.
> 2. Please quote any and all variables from files cat'ed out.
> 3. Please convert bash-ism's to bourne compatible routines, e.g.
> 
> function foo() {
> 
> }
> 
> ... to...
> 
> foo() {
> 
> }
> 
> 4. This form:
> 
> if [ $num_of_cpus -gt 1 ]; then
> +                       return 0
> +               else
> +                       return 1
> +               fi
> 
> Can be replaced by:
> 
> [ $num_of_cpus -gt 1 ]; return $?
> 
> etc.

Poornima,

Please address them as well.

Regards--
Subrata

> 
> Thanks,
> -Garrett
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with 
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2009-08-23  7:30 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-20 16:06 [LTP] Patch to fix kernbench integration issue Poornima Nayak
2009-08-20 16:07 ` [LTP] Patch to fix make install issue in ebizzy Poornima Nayak
2009-08-20 16:52   ` Garrett Cooper
2009-08-23  7:29     ` Subrata Modak
2009-08-20 16:07 ` [LTP] Patch to include workload for consolidation verification Poornima Nayak
2009-08-23  7:29   ` Subrata Modak
2009-08-20 16:07 ` [LTP] Patch to get max sched mc & smt values based on kernel version Poornima Nayak
2009-08-23  7:29   ` Subrata Modak
2009-08-20 16:07 ` [LTP] New & modified reusable functions for new & existing testcases Poornima Nayak
2009-08-20 16:51   ` Garrett Cooper
2009-08-23  7:29     ` Subrata Modak [this message]
2009-08-20 16:07 ` [LTP] Patch for PM makefile for new testcases & fix test_sched_smt integration issue Poornima Nayak
2009-08-20 17:01   ` Garrett Cooper
2009-08-23  7:28     ` Subrata Modak
2009-08-20 16:07 ` [LTP] Patch for PM Master script to integrate new testcases Poornima Nayak
2009-08-23  7:29   ` Subrata Modak
2009-08-20 16:08 ` [LTP] Patch to fix cpu consolidation failure for kernbench on HT system Poornima Nayak
2009-08-20 17:00   ` Garrett Cooper
2009-08-23  7:28   ` Subrata Modak
2009-08-20 16:08 ` [LTP] New testcase to test timer_migration interface Poornima Nayak
2009-08-20 16:57   ` Garrett Cooper
2009-08-20 16:57     ` Garrett Cooper
2009-08-23  7:29     ` Subrata Modak
2009-08-20 16:53 ` [LTP] Patch to fix kernbench integration issue Garrett Cooper
2009-08-23  7:29   ` 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=1251012555.16822.40.camel@subratamodak.linux.ibm.com \
    --to=subrata@linux.vnet.ibm.com \
    --cc=arun@linux.vnet.ibm.com \
    --cc=ego@in.ibm.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=mpnayak@linux.vnet.ibm.com \
    --cc=svaidy@linux.vnet.ibm.com \
    --cc=yanegomi@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox