Please find below a Problem reported by Santwana on the syslogtst test
case, and, then the fix given by Vinay Sridhar:

===================================================================
Problem Description by Santwana
===================================================================
syslogtst fails in ltp testsuite.
 
Contact Information = Santwana Samantray/[EMAIL PROTECTED]
 
---uname output---
Linux <> 2.6.18-53.el5xen #1 SMP Wed Oct 10 16:48:44 EDT 2007
x86_64 x86_64 x86_64 GNU/Linux
 
Machine Type = e326m
 
---Debugger---
A debugger is not configured
 
---Steps to Reproduce---
1.Copy and untar the ltp testsuite.
2.Issue make followed by make install.
3.Inside runtest directory of ltp create a file as syscalls-syslog.
4.The contents of the file should be as: syslogtst syslogtst
5.Run the file from the ltp testsuite as ./runltp -f syscalls-syslog.
6.It says that "pan reported some tests FAIL".
7.Check in ltp's output directory (i.e ltp-full-20071130/output).
8.It contains only one file which mentions syslogtst as the failure.

===================================================================
Description and Solution by Sridhar Vinay:
===================================================================
This ltp test case seems to fail because of a missing argument to the
syslogtst test case. The syslogtst needs an argument to test one of the
syslog calls. On adding an argument to the test case it passes.

The input file to the test case contains the type of the test to be run
which should also contain another argument to choose which log test is
to be run. This input file is passed on from the runltp script to pan
which runs the test case. In order to ensure the test case runs without
the extra argument, random number generation is used to generate the
required argument(s).
The is a patch for the syslogtst test case

The patch is for the file ltp/testcases/kernel/syscalls/syslog/syslogtst.c
===================================================================
===================================================================



Vinay, Can you please sign off this Patch ?

--Subrata


--- syslogtst.c.old	2008-01-07 17:25:19.000000000 +0530
+++ syslogtst.c	2008-01-07 17:24:50.000000000 +0530
@@ -26,12 +26,14 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <time.h>
 #include "test.h"
 #include "usctest.h"
 /*
  *These globals must be defined in the test.
  */
 
+
 char *TCID="syslogtst";           /* Test program identifier.    */
 int TST_TOTAL=1;                /* Total number of test cases. */
 extern int Tst_count;           /* Test Case counter for tst_* routines */
@@ -43,9 +45,10 @@ void sig_handler(int signal); 
 
 int main(int argc, char *argv[])
 {
-	int status, flag3, fd;
+	int status, flag3, fd, ch, ch1;
 	int exit_flag = 0;	/* used for syslog test case 6. */
         char* config_file;
+	time_t t;
 
 	signal(SIGINT, sig_handler);
 	signal(SIGTERM, sig_handler);
@@ -54,17 +57,38 @@ int main(int argc, char *argv[])
 	signal(SIGSEGV, sig_handler);
 	signal(SIGQUIT, sig_handler);
 
+	time(&t);
+	srandom((unsigned int)getpid()^(((unsigned int)t<<16)| (unsigned int)t>>16));
+
+	if(argc < 2) {
+		ch = (random() % 10) + 1;
+		if(ch == 2) ch1 = random() % 8;
+		if(ch == 8) ch1 = (random() % 5) + 1;	
+		tst_resm(TINFO, "\nrandom numbers were generated for the case numbers : %d, %d\n", ch, ch1);
+	}
 
+	else if(argc == 2 && (atoi(argv[1]) == 2 || atoi(argv[1]) == 8)) { 
+		ch = atoi(argv[1]);
+		if(ch == 2) ch1 = random() % 8;
+		if(ch == 8) ch1 = (random() % 5) + 1;
+		tst_resm(TINFO, "\nrandom number was generated for case %d : %d\n", ch, ch1);
+	}
+	
+	else {
+		ch = atoi(argv[1]);
+		ch1 = atoi(argv[2]);
+	}
+		
 	/*
 	 * Send syslog messages according to the case number, which
 	 * we will know from command line.
 	 */
-	switch(atoi(argv[1])) {
+	switch(ch) {
 	case 1:
 		syslog(LOG_MAIL | LOG_INFO, "syslogtst: mail info test.");
 		break;
 	case 2:
-		switch(atoi(argv[2])) {
+		switch(ch1) {
 		case 0:
 			syslog(LOG_MAIL | LOG_EMERG, "syslogtst: mail emerg test.");
 			break;
@@ -204,7 +228,7 @@ int main(int argc, char *argv[])
 		syslog(LOG_USER | LOG_DEBUG, "syslogtst: debug log");
 		break;
 	case 8:
-		switch(atoi(argv[2])) {
+		switch(ch1) {
 		/*
 		 * Kernel messages cannot be send by user, so skipping the
 		 * LOG_KERN facility.
@@ -238,6 +262,7 @@ int main(int argc, char *argv[])
 		break;
 	}
 	
+
 	/*
 	 * Check the exit_flag and if it is set,
 	 * exit with status 1, indicating failure.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to