This should be fine for the time being. I will look in to the same.
Regards--
Subrata

Ricardo Salveti de Araujo wrote:
Hi Subrata,

On Tuesday 24 July 2007 07:50:04 Subrata Modak wrote:
With this you have sent 2 patches regarding the new way by which
./runltp and pan will behave. Can you kindly document this somewhere in
ltp/doc/* file or create a new document?? You can send me a separate
patch after adding documentation for the same.

I just added a new section and one example at pan's man file. I guess that the usage function from 'runltp' is enough to understand how to use it, so I didn't create any document about it, but, if you want, we can create a man page for 'runltp' later.

Here's the final patch, with both patches that I sent, plus some modification at pan's man page.

Thanks,
------------------------------------------------------------------------

Author: Ricardo Salveti de Araujo <[EMAIL PROTECTED]>
Date:   Wed Jul 25 00:11:11 2007 -0300

       Changes:
       - Now you can put '-f' and/or '-N' with '-s' flag.
           At the current version, '-s' (pattern) is only supported when we 
don't
           use both '-f' and '-N' flags. I changed in a way where the user can 
pass
           the pattern to search in any command files that he want, for 
example, the
           user can only run the 'arp' test case, that's inside 'tcp_cmds' 
command
           file, calling "./runltp -f tcp_cmds -s arp".

       - '-f' flag (CMDFILE) now supports more then one command file.
           With this patch you can call runltp with more then one command file, 
you
           just need to separate them with ',', like "./runltp -f 
math,mm,/tmp/file"

       - Added new option '-w' (CMDFILEADDR)
           This new option let the user pass an address for the command file, 
the
           script will get it with wget. You can use it like
           "./runltp -w http://localhost/cmdfile";

       - Created a new option at 'pan' and 'runltp' (-C file) that creates a 
file with all failed
         test cases and its commands.

       With this, you can run 'runltp' and pass -C failcmdfile to get all test 
cases and commands
       that failed. To run only the failed test cases, pass the file to 
'runltp' with flag '-f'.

        Signed-off-by: Ricardo Salveti de Araujo <[EMAIL PROTECTED]>

diff --git a/doc/man1/pan.1 b/doc/man1/pan.1
index 7db7bc0..30575d1 100644
--- a/doc/man1/pan.1
+++ b/doc/man1/pan.1
@@ -34,7 +34,7 @@
 .SH NAME
 pan \- A light-weight driver to run tests and clean up their pgrps
 .SH SYNOPSIS
-\fBpan -n tagname [-SyAehp] [-t #s|m|h|d \fItime\fB] [-s \fIstarts\fB] [\fI-x 
nactive\fB] [\fI-l logfile\fB] [\fI-a active-file\fB] [\fI-f command-file\fB] 
[\fI-d debug-level\fB] [\fI-o output-file\fB] [\fI-O buffer_directory\fB] 
[\fI-r report_type\fB] [cmd]
+\fBpan -n tagname [-SyAehp] [-t #s|m|h|d \fItime\fB] [-s \fIstarts\fB] [\fI-x 
nactive\fB] [\fI-l logfile\fB] [\fI-a active-file\fB] [\fI-f command-file\fB] 
[\fI-d debug-level\fB] [\fI-o output-file\fB] [\fI-O buffer_directory\fB] 
[\fI-r report_type\fB] [\fI-C fail-command-file\fB] [cmd]
 .SH DESCRIPTION

 Pan will run a command, as specified on the commandline, or collection of
@@ -88,6 +88,9 @@ of a directory where the active file will be placed, and in 
this case the
 active file's name will be "active".  A single active file may be shared
 by any number of Zoo tools.
 .TP 1i
+\fB-C \fIfail-command-file\fB
+The file to which all failed test commands will be saved.  You can use it 
later with \fI-f\fP option if you want to run only the failed test cases.
+.TP 1i
 \fB-d \fIdebug-level\fB
 See the source for settings.
 .TP 1i
@@ -95,6 +98,9 @@ See the source for settings.
 Pan will exit non-zero if any of its commands exited non-zero.  By default
 pan ignores command exit statuses.
 .TP 1i
+\fB-f \fIcommand-file\fB
+The file that has a collection of commands that pan will execute.
+.TP 1i
 \fB-h\fP
 Print some simple help.
 .TP 1i
@@ -187,6 +193,12 @@ terminate immediately.  An exit log is kept for all the 
commands.

 $ pan -n ex3 -S -A -f /tmp/cmds1 -l ex3.log

+Here is just a simple stress case. In this case the test will run for 24 hours,
+printing the output as a human readable format, with the test output at 
/tmp/output-file
+and all failed test commands (if you have any) at /tmp/fail-command-file.
+
+$ pan -n stress -e -p -q -S -t 24h -a stress -l logfile -f command-file \
+               -o /tmp/output-file -C /tmp/fail-command-file

 .SH LAYERING

diff --git a/pan/pan.c b/pan/pan.c
index 78e46e6..c9504fc 100644
--- a/pan/pan.c
+++ b/pan/pan.c
@@ -44,6 +44,10 @@
  *
  *     01/29/03 - Added: Manoj Iyer, [EMAIL PROTECTED]
  *                        - added code supresses test start and test end tags.
+ *
+ *     07/22/07 - Added: Ricardo Salveti de Araujo, [EMAIL PROTECTED]
+ *                        - added option to create a command file with all 
failed tests.
+ *     
  */
 /* $Id: pan.c,v 1.24 2006/12/13 22:55:21 vapier Exp $ */

@@ -99,8 +103,9 @@ static struct collection *get_collection(char *file, int 
optind, int argc,
                                         char **argv);
 static void pids_running(struct tag_pgrp *running, int keep_active);
 static int check_pids(struct tag_pgrp *running, int *num_active,
-                     int keep_active, FILE * logfile, struct orphan_pgrp 
*orphans,
-                         int fmt_print, int *failcnt, int quiet_mode);
+ int keep_active, FILE * logfile, FILE * failcmdfile, + struct orphan_pgrp *orphans, int fmt_print,
+                     int *failcnt, int quiet_mode);
 static void propagate_signal(struct tag_pgrp *running, int keep_active,
                             struct orphan_pgrp *orphans);
 static void dump_coll(struct collection *coll);
@@ -146,12 +151,14 @@ main(int argc, char **argv)
     char *zooname = NULL;      /* name of the zoo file to use */
     char *filename = "/dev/null";    /* filename to read test tags from */
     char *logfilename = NULL;
+    char *failcmdfilename = NULL;
     char *outputfilename = NULL;
     struct collection *coll = NULL;
     struct tag_pgrp *running;
     struct orphan_pgrp *orphans, *orph;
        struct utsname unamebuf;
     FILE *logfile = NULL;
+    FILE *failcmdfile = NULL;
     int keep_active = 1;
     int num_active = 0;
        int failcnt = 0;           /* count of total testcases that failed. */
@@ -171,7 +178,7 @@ main(int argc, char **argv)
     pid_t cpid;
     struct sigaction sa;

-    while ((c = getopt(argc, argv, "AO:Sa:d:ef:hl:n:o:pqr:s:t:x:y")) != -1) {
+    while ((c = getopt(argc, argv, "AO:Sa:C:d:ef:hl:n:o:pqr:s:t:x:y")) != -1) {
        switch (c) {
        case 'A':       /* all-stop flag */
            has_brakes = 1;
@@ -186,6 +193,9 @@ main(int argc, char **argv)
        case 'a':       /* name of the zoo file to use */
            zooname = strdup(optarg);
            break;
+       case 'C':       /* name of the file where all failed commands will be */
+           failcmdfilename = strdup(optarg);
+           break;
        case 'd':       /* debug options */
            sscanf(optarg, "%i", &Debug);
            break;
@@ -199,6 +209,7 @@ main(int argc, char **argv)
            fprintf(stdout, "Usage: pan -n name [ -SyAehp ] [ -s starts ]"
                                 " [-t time[s|m|h|d] [ -x nactive ] [ -l logfile 
]\n\t"
                                 "[ -a active-file ] [ -f command-file ] "
+                                "[ -C fail-command-file ] "
                                 "[ -d debug-level ]\n\t[-o output-file] "
                                 "[-O output-buffer-directory] [cmd]\n");
            exit(0);
@@ -386,6 +397,15 @@ main(int argc, char **argv)
        }
     }

+    if (failcmdfilename) {
+       if (!(failcmdfile = fopen(failcmdfilename, "a+"))) {
+           fprintf(stderr,
+                   "pan(%s): Error %s (%d) opening fail cmd file '%s'\n",
+                   panname, strerror(errno), errno, failcmdfilename);
+           exit(1);
+       }
+    }
+
     if ((zoofile = zoo_open(zooname)) == NULL) {
        fprintf(stderr, "pan(%s): %s\n", panname, zoo_error);
        exit(1);
@@ -503,8 +523,8 @@ main(int argc, char **argv)
            }
        }

-       err = check_pids(running, &num_active, keep_active,
-                        logfile, orphans, fmt_print, &failcnt, quiet_mode);
+       err = check_pids(running, &num_active, keep_active, logfile,
+                        failcmdfile, orphans, fmt_print, &failcnt, quiet_mode);
        if (Debug & Drunning) {
            pids_running(running, keep_active);
            orphans_running(orphans);
@@ -615,8 +635,8 @@ propagate_signal(struct tag_pgrp *running, int keep_active,

 static int
 check_pids(struct tag_pgrp *running, int *num_active, int keep_active,
- FILE * logfile, struct orphan_pgrp *orphans, int fmt_print, - int *failcnt, int quiet_mode)
+          FILE * logfile, FILE * failcmdfile, struct orphan_pgrp *orphans,
+          int fmt_print, int *failcnt, int quiet_mode)
 {
     int w;
     pid_t cpid;
@@ -716,6 +736,9 @@ check_pids(struct tag_pgrp *running, int *num_active, int 
keep_active,
                                fflush(logfile);
                }

+               if ((failcmdfile != NULL) && (w !=0)) {
+                       fprintf(failcmdfile, "%s %s\n", running[i].cmd->name, 
running[i].cmd->cmdline);
+               }

                if (running[i].stopping)
                    status = "driver_interrupt";
diff --git a/runltp b/runltp
index 3a9d0d8..aa281fc 100755
--- a/runltp
+++ b/runltp
@@ -34,6 +34,18 @@
 #               - fixed bug in creating results directory
 #               - all checks should be enlclosed in " " to avoid bash error
 #               - exit with error if pan is not found in pan directory
+#
+#               Jul 22 2007 - Modified - Ricardo Salveti de Araujo
+#               - added support to put more then one file at CMDLINE (-f)
+#               - added a new option, that the user can pass the address of
+#               the command file, and it'll use wget to get it (-w)
+#               - now -s does the grep at the selected command files (default,
+#               -f or -w)
+#
+#               Jul 23 2007 - Modified - Ricardo Salveti de Araujo
+#               - added flag to get the command file that has all failed tests
+
+


 setup()
@@ -73,14 +85,16 @@ usage()
 {
     cat <<-EOF >&2

- usage: ./${0##*/} -c [-d TMPDIR] [-f CMDFILE ] [-i # (in Mb)] - [ -l LOGFILE ] [ -o OUTPUTFILE ] [ -m # (in Mb)] -N -n -q - [ -r LTPROOT ] [ -s PATTERN ] [ -t DURATION ] -v [ -x INSTANCES ] + usage: ./${0##*/} -c [-C FAILCMDFILE ] [-d TMPDIR] [-f CMDFILES(,...) ]
+    [-i # (in Mb)] [ -l LOGFILE ] [ -o OUTPUTFILE ] [ -m # (in Mb)] -N -n -q
+    [ -r LTPROOT ] [ -s PATTERN ] [ -t DURATION ] -v [ -w CMDFILEADDR ]
+    [ -x INSTANCES ]
+ -C FAILCMDFILE Command file with all failed test cases.
     -c NUM_PROCS    Run LTP under additional background CPU load.
     -d TMPDIR       Directory where temporary files will be created.
     -e              Prints the date of the current LTP release
-    -f CMDFILE      Execute user defined list of testcases.
+    -f CMDFILES     Execute user defined list of testcases (separate with ',')
     -h              Help. Prints all available options.
     -i # (in Mb)    Run LTP with a _min_ IO load of # Mb in background.
     -l LOGFILE      Log results of test in a logfile.
@@ -98,6 +112,7 @@ usage()
                       -t 24h = 24 hours
                       -t 2d  = 2 days
-v Print more verbose output to screen. + -w CMDFILEADDR Uses wget to get the user's list of testcases.
     -x INSTANCES    Run multiple instances of this testsuite.

     example: ./${0##*/} -i 1024 -m 128 -p -q  -l /tmp/resultlog.$$ -d ${PWD}
@@ -109,7 +124,7 @@ exit 0

 main()
 {
-    local CMDFILE=""
+    local CMDFILES=""
     local PRETTY_PRT=""
     local ALT_DIR=0
     local RUN_NETEST=0
@@ -119,6 +134,7 @@ main()
     local GENLOAD=0
     local MEMSIZE=0
     local DURATION=""
+    local CMDFILEADDR=""
     local BYTESIZE=0
     local LOGFILE=""
     local SCENFILES=""
@@ -127,12 +143,14 @@ main()
     local PAN_COMMAND=""
     version_date=`head -n 1 $LTPROOT/ChangeLog`

-    while getopts c:d:f:ehi:l:m:Nno:pqr:s:t:vx: arg
+    while getopts c:C:d:f:ehi:l:m:Nno:pqr:s:t:vw:x: arg
     do  case $arg in
c) NUM_PROCS=$(($OPTARG))
             $LTPROOT/testcases/bin/genload --cpu $NUM_PROCS >/dev/null 2>&1 &
             GENLOAD=1 ;;
+
+        C)  FAILCMDFILE="-C $OPTARG" ;;
d) # append $$ to TMP, as it is recursively # removed at end of script.
@@ -143,7 +161,9 @@ main()
             version_of_ltp
            ;;
         f)  # Execute user defined set of testcases.
-            CMDFILE=$OPTARG;;
+            # Can be more then one file, just separate it with ',', like:
+            # -f nfs,commands,/tmp/testfile
+            CMDFILES=$OPTARG;;
h) usage;; @@ -200,6 +220,8 @@ main()
             DURATION="-t $OPTARG" ;;
v) VERBOSE_MODE=1;;
+
+        w)  CMDFILEADDR=$OPTARG;;
x) # number of ltp's to run
             cat <<-EOF >&1
@@ -214,17 +236,6 @@ main()
         \?) usage;;
         esac
     done
- - if [ -n "$TAG_RESTRICT_STRING" ] ; then - if [ -n "$CMDFILE" ]; then
-           echo "FATAL  -s and -f not supported together"
-           exit 1
-       fi
-        if [ "$RUN_NETEST" -eq 1 ]; then
-           echo "FATAL  -s and -N not supported together"
-           exit 1
-       fi
- fi # Added -m 777 for tests that call tst_tmpdir() and try to # write to it as user nobody
@@ -268,9 +279,9 @@ main()
# If user does not provide a command file select a default set of testcases
     # to execute.
-    if [ -z "$CMDFILE" ]
+    if [ -z "$CMDFILES" ] && [ -z "$CMDFILEADDR" ]
     then
-    cat <<-EOF >&1
+        cat <<-EOF >&1

     INFO: no command files were provided, using default,
           system calls, memory management, IPC, scheduler
@@ -279,7 +290,7 @@ main()
EOF

-    for SCENFILES in ${LTPROOT}/runtest/syscalls ${LTPROOT}/runtest/fs \
+        for SCENFILES in ${LTPROOT}/runtest/syscalls ${LTPROOT}/runtest/fs \
                      ${LTPROOT}/runtest/fsx ${LTPROOT}/runtest/dio \
                      ${LTPROOT}/runtest/mm ${LTPROOT}/runtest/ipc \
                      ${LTPROOT}/runtest/sched ${LTPROOT}/runtest/math \
@@ -292,27 +303,41 @@ main()
                 exit 1
             }

-           if [ -z "$TAG_RESTRICT_STRING" ]
-           then
             cat $SCENFILES >> ${TMP}/alltests || \
             {
                 echo "FATAL: unable to create command file"
                 exit 1
             }
-           else
-           grep $TAG_RESTRICT_STRING $SCENFILES >> ${TMP}/alltests #Not worth 
checking return codes for this case
-           fi
        done
-    else
-        [ -f $CMDFILE ] || \
-                CMDFILE="$LTPROOT/runtest/$CMDFILE"
-        cat $CMDFILE > ${TMP}/alltests || \
+    fi
+
+    [ -n "$CMDFILES" ] && \
+    {
+        for SCENFILES in `echo "$CMDFILES" | sed 's/,/\n/g'`
+        do
+            [ -f "$SCENFILES" ] || SCENFILES="$LTPROOT/runtest/$SCENFILES"
+            cat "$SCENFILES" >> ${TMP}/alltests || \
+            {
+                echo "FATAL: unable to create command file"
+                exit 1
+            }
+        done
+    }
+ + [ -n "$CMDFILEADDR" ] && \
+    {
+        wget -q "${CMDFILEADDR}" -O ${TMP}/wgetcmdfile
+        if [ $? -ne 0 ]; then
+            echo "FATAL: error while getting the command file with wget (address 
$CMDFILEADDR)"
+            exit 1
+        fi
+        cat "${TMP}/wgetcmdfile" >> ${TMP}/alltests || \
         {
-            echo "FATAL: Unable to create command file"
+            echo "FATAL: unable to create command file"
             exit 1
         }
-    fi
- + }
+
     [ "$RUN_NETEST" -eq 1 ] && \
     {
         for SCENFILES in ${LTPROOT}/runtest/tcp_cmds \
@@ -326,14 +351,14 @@ main()
                 exit 1
             }
- cat $SCENFILES >> ${TMP}/alltests || \
+            cat "$SCENFILES" >> ${TMP}/alltests || \
             {
                 echo "FATAL: unable to create command file"
                 exit 1
             }
         done
} - +
     # The fsx-linux tests use the SCRATCHDEV environment variable as a location
# that can be reformatted and run on. Set SCRATCHDEV if you want to run # these tests. As a safeguard, this is disabled.
@@ -346,6 +371,13 @@ main()
              exit 1
          }
     }
+
+    # If enabled, execute only test cases that match the PATTERN
+    if [ -n "$TAG_RESTRICT_STRING" ]
+    then
+        mv -f ${TMP}/alltests ${TMP}/alltests.orig
+           grep $TAG_RESTRICT_STRING ${TMP}/alltests.orig > ${TMP}/alltests 
#Not worth checking return codes for this case
+    fi
# check for required users and groups
     ${LTPROOT}/IDcheck.sh &>/dev/null || \
@@ -366,7 +398,7 @@ main()

     [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test start time: $(date)" ; }
     PAN_COMMAND="${LTPROOT}/pan/pan $QUIET_MODE -e -S $INSTANCES $DURATION -a 
$$ \
-    -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE"
+    -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE"
     if [ ! -z "$VERBOSE_MODE" ] ; then
       echo "COMMAND:    $PAN_COMMAND"
       if [ ! -z "$TAG_RESTRICT_STRING" ] ; then
@@ -375,7 +407,7 @@ main()
     fi
     #$PAN_COMMAND #Duplicated code here, because otherwise if we fail, only 
"PAN_COMMAND" gets output
     ${LTPROOT}/pan/pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \
-    -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE
+    -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE
if [ $? -eq 0 ]; then
       echo "INFO: pan reported all tests PASS"

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to