Detect test results more accurately when generating HTML. PFA the patch for the changes to pan driver for a possible fix to the report generation issue. I have modified genhtml.pl script to reflect changes in pan driver. Note: The 'Initiation-status' column is now present after Test-output column. Signed-off-by: rohit verma <rohit.170309@gmail.com>.
diff --git a/pan/ltp-pan.c b/pan/ltp-pan.c
index 607c007..a875370 100644
--- a/pan/ltp-pan.c
+++ b/pan/ltp-pan.c
@@ -49,7 +49,7 @@
  *			   - added option to create a command file with all failed tests.
  * 	
  */
-/* $Id: ltp-pan.c,v 1.2 2009/06/01 10:25:49 subrata_modak Exp $ */
+/* $Id: ltp-pan.c,v 1.3 2009/06/09 16:14:40 subrata_modak Exp $ */
 
 #include <errno.h>
 #include <string.h>
@@ -115,8 +115,8 @@
 static void check_orphans(struct orphan_pgrp *orphans, int sig);
 
 static void copy_buffered_output(struct tag_pgrp *running);
-static void write_test_start(struct tag_pgrp *running, const char *init_status);
-static void write_test_end(struct tag_pgrp *running,
+static void write_test_start(struct tag_pgrp *running);
+static void write_test_end(struct tag_pgrp *running, const char *init_status,
 			   time_t exit_time, char *term_type, int stat_loc,
 			   int term_id, struct tms *tms1, struct tms *tms2);
 
@@ -755,12 +755,12 @@
 
 		if (test_out_dir) {
 			if (!quiet_mode)
-				write_test_start(running+i, "ok");
+				write_test_start(running+i);
 			copy_buffered_output(running + i);
 			unlink(running[i].output);
 		}
 		if (!quiet_mode)
-			write_test_end(running+i, t, status,
+			write_test_end(running+i, "ok", t, status,
 			   stat_loc, w, &tms1, &tms2);
 
 		/* If signaled and we weren't expecting
@@ -844,6 +844,13 @@
 	return -1;
     }
 
+    time(&active->mystime);
+    active->cmd = colle;
+
+    if (!test_out_dir) 
+	if (!quiet_mode)
+		write_test_start(active);
+
     if ((cpid = fork()) < 0) {
 	fprintf(stderr, "pan(%s): fork failed (tag %s).  errno:%d  %s\n",
 		panname, colle->name, errno, strerror(errno));
@@ -926,8 +933,6 @@
     if (colle->pcnt_f) free(c_cmdline); 
 
     close(errpipe[1]);
-    time(&active->mystime);
-    active->cmd = colle;
 
     /* if the child couldn't go through with the exec, 
      * clean up the mess, note it, and move on
@@ -960,8 +965,8 @@
 	time(&end_time);
 	if (!quiet_mode) 
 	{
-		write_test_start(active, errbuf);
-		write_test_end(active, end_time, termtype, status, 
+		//write_test_start(active, errbuf);
+		write_test_end(active, errbuf, end_time, termtype, status, 
 			termid, &notime, &notime);
 	}
         if (capturing) {
@@ -973,10 +978,6 @@
 
     close(errpipe[0]);
     if (capturing) close(c_stdout);
-	
-    if (!test_out_dir) 
-	if (!quiet_mode)
-		write_test_start(active, "ok");
 
     active->pgrp = cpid;
     active->stopping = 0;
@@ -1212,14 +1213,14 @@
 
 
 static void
-write_test_start(struct tag_pgrp *running, const char *init_status)
+write_test_start(struct tag_pgrp *running)
 {
     if (!strcmp(reporttype, "rts")) {
 
-	printf("%s\ntag=%s stime=%ld\ncmdline=\"%s\"\ncontacts=\"%s\"\nanalysis=%s\ninitiation_status=\"%s\"\n%s\n",
+	printf("%s\ntag=%s stime=%ld\ncmdline=\"%s\"\ncontacts=\"%s\"\nanalysis=%s\n%s\n",
 			"<<<test_start>>>",
 			running->cmd->name, running->mystime, running->cmd->cmdline, "",
-			"exit", init_status,
+			"exit",
 			"<<<test_output>>>");
     }
     fflush(stdout);
@@ -1227,13 +1228,14 @@
 
 
 static void
-write_test_end(struct tag_pgrp *running, time_t exit_time,
-	       char *term_type, int stat_loc, int term_id,
-	       struct tms *tms1, struct tms *tms2)
+write_test_end(struct tag_pgrp *running, const char *init_status,
+		time_t exit_time, char *term_type, int stat_loc,
+		int term_id, struct tms *tms1, struct tms *tms2)
 {
     if (!strcmp(reporttype, "rts")) {
-	printf("%s\nduration=%ld termination_type=%s termination_id=%d corefile=%s\ncutime=%d cstime=%d\n%s\n",
-		  	"<<<execution_status>>>", 
+	printf("%s\ninitiation_status=\"%s\"\nduration=%ld termination_type=%s "
+		"termination_id=%d corefile=%s\ncutime=%d cstime=%d\n%s\n",
+		  	"<<<execution_status>>>", init_status,
 			(long) (exit_time - running->mystime),
 			term_type, term_id, (stat_loc & 0200) ? "yes" : "no",
 			(int) (tms2->tms_cutime - tms1->tms_cutime),
diff --git a/tools/genhtml.pl b/tools/genhtml.pl
index ab3e49c..df390d5 100644
--- a/tools/genhtml.pl
+++ b/tools/genhtml.pl
@@ -144,12 +144,12 @@
                              @variable_value_pair = split(/=/, $line);
                              $row_line = $row_line . "<td><p><strong>$variable_value_pair[1]</strong></p></td>\n";
                         }
-                        if ( $flag == 6) { #Assuming we will find "initiation_status" value here
-                             @variable_value_pair = split(/=/, $line);
-                             $row_line = $row_line . "<td><p><strong>$variable_value_pair[1]</strong></p></td>\n";
-                        }
                         if ( $flag3 == 1 ) {
                              if ( $flag4 == 1 ) {
+				  @variable_value_pair = split(/=/, $line);
+				  $row_line = $row_line . "<td><p><strong>$variable_value_pair[1]</strong></p></td>\n";
+			     }
+                             if ( $flag4 == 2 ) {
                                   @variable_value_pair    = split(/\ /, $line);
                                   @duration_value         = split(/=/, $variable_value_pair[0]);
                                   @termination_type_value = split(/=/, $variable_value_pair[1]);
@@ -162,7 +162,7 @@
                                               "<td><p><strong>$corefile_value[1]</strong></p></td>\n";
                                   $row_line =~ s/<tr>/<tr\ bgcolor=$background_colour>/;
                              }
-                             if ( $flag4 == 2 ) {
+                             if ( $flag4 == 3 ) {
                                   @variable_value_pair    = split(/\ /, $line);
                                   @cutime_value           = split(/=/, $variable_value_pair[0]);
                                   @cstime_value           = split(/=/, $variable_value_pair[1]);
diff --git a/tools/html_report_header.txt b/tools/html_report_header.txt
index 4099e88..608f76c 100644
--- a/tools/html_report_header.txt
+++ b/tools/html_report_header.txt
@@ -46,8 +46,8 @@
       <td bgcolor="Silver"><strong>Command-Line</strong></td>
       <td bgcolor="Silver"><strong>Contacts</strong></td>
       <td bgcolor="Silver"><strong>Analysis</strong></td>
-      <td bgcolor="Silver"><strong>Initiation-Status</strong></td>
       <td bgcolor="Silver"><strong>Test-Output</strong></td>
+      <td bgcolor="Silver"><strong>Initiation-Status</strong></td>
       <td bgcolor="Silver"><strong>Duration</strong></td>
       <td bgcolor="Silver"><strong>Termination-type</strong></td>
       <td bgcolor="Silver"><strong>Termination-id</strong></td>