Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] pan/ltp-pan.c: Add execution time field in results/logs
@ 2022-08-09  8:27 Dylan Jhong
  2022-08-11 11:41 ` Cyril Hrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Dylan Jhong @ 2022-08-09  8:27 UTC (permalink / raw)
  To: ltp; +Cc: alankao, dminus, randolph, x5710999x

The current log only shows the success or failure of testcases, but
execution time is also one of the important indicators to observe LTP
testcases.

In this patch, we modified the format of the logs in results/ and added
a column to record the execution time.

Signed-off-by: Dylan Jhong <dylan@andestech.com>
---
 pan/ltp-pan.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/pan/ltp-pan.c b/pan/ltp-pan.c
index 0bdb51477..1bb255b4a 100644
--- a/pan/ltp-pan.c
+++ b/pan/ltp-pan.c
@@ -132,7 +132,11 @@ zoo_t zoofile;
 static char *reporttype = NULL;
 
 /* Common format string for ltp-pan results */
-#define ResultFmt	"%-50s %-10.10s"
+#define ResultFmt           "%-50s %-10.10s"
+#define ExitValTitleFmt     "%-12.12s"
+#define ExitValFmt          "%-12d"
+#define ExecTimeTitleFmt    "%-20.20s"
+#define ExecTimeFmt         "%-20d"
 
 /* zoolib */
 int rec_signal;			/* received signal */
@@ -354,10 +358,10 @@ int main(int argc, char **argv)
 			fprintf(logfile, "Test Start Time: %s\n", s);
 			fprintf(logfile,
 				"-----------------------------------------\n");
-			fprintf(logfile, ResultFmt" %-10.10s\n",
-				"Testcase", "Result", "Exit Value");
-			fprintf(logfile, ResultFmt" %-10.10s\n",
-				"--------", "------", "------------");
+			fprintf(logfile, ResultFmt" "ExitValTitleFmt" "ExecTimeTitleFmt"\n",
+				"Testcase", "Result", "Exit Value", "Execution Time(sec)");
+			fprintf(logfile, ResultFmt" "ExitValTitleFmt" "ExecTimeTitleFmt"\n",
+				"--------", "------", "----------", "-------------------");
 		}
 		fflush(logfile);
 	}
@@ -829,10 +833,11 @@ check_pids(struct tag_pgrp *running, int *num_active, int keep_active,
 						}
 
 						fprintf(logfile,
-							ResultFmt" %-5d\n",
+							ResultFmt" "ExitValFmt" "ExecTimeFmt"\n",
 							running[i].cmd->name,
 							result_str,
-							w);
+							w,
+							(int)(t - running[i].mystime));
 					}
 
 					fflush(logfile);
@@ -1108,10 +1113,11 @@ run_child(struct coll_entry *colle, struct tag_pgrp *active, int quiet_mode,
 				if (termid != 0)
 					++ * failcnt;
 
-				fprintf(logfile, ResultFmt" %-5d\n",
+				fprintf(logfile, ResultFmt" "ExitValFmt" "ExecTimeFmt"\n",
 					colle->name,
 					((termid != 0) ? "FAIL" : "PASS"),
-					termid);
+					termid,
+					(int)(end_time - active->mystime));
 			}
 			fflush(logfile);
 		}
-- 
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-11 11:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-09  8:27 [LTP] [PATCH] pan/ltp-pan.c: Add execution time field in results/logs Dylan Jhong
2022-08-11 11:41 ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox