[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp

Reid Spencer reid at x10sys.com
Wed Feb 21 17:03:29 PST 2007



Changes in directory llvm-test/SingleSource/UnitTests/Integer/APInt:

gptest.cpp updated: 1.2 -> 1.3
---
Log message:

Don't invoke gp with the --test flag, it causes the output lines to wrap and 
that causes false positives.


---
Diffs of the changes:  (+13 -6)

 gptest.cpp |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.2 llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.3
--- llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.2	Wed Feb 21 02:28:20 2007
+++ llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp	Wed Feb 21 19:03:12 2007
@@ -182,7 +182,7 @@
 }
 
 /* function executed by the user-interacting process. */
-void test_driver(int input_pipe[], int output_pipe[]) {
+void test_driver(int low, int high, int input_pipe[], int output_pipe[]) {
 
   int c;    /* user input - must be 'int', to recognize EOF (= -1). */
   char ch;  /* the same - as a char. */
@@ -203,7 +203,7 @@
   srand(0);
 
   // Start loop over the range of bits of interest
-  for (unsigned bits = 1; bits <= 1024; bits++) {
+  for (int bits = low; bits <= high; bits++) {
     // Indicate which test case we are running
     printf("\nTEST CASE: %d BITS\n", bits);
     fflush(stdout);
@@ -270,8 +270,7 @@
     // exec gp with modes:
     //   --quiet (don't print banner), 
     //   --fast (don't read init files) 
-    //   --test (no history, wrap long lines)
-    execlp("gp", "gp", "--quiet", "--fast", "--test", (char*)NULL);
+    execlp("gp", "gp", "--quiet", "--fast", (char*)NULL);
     perror("execlp");
     exit(1);
 }
@@ -285,6 +284,14 @@
     int translator_to_user[2];
     int pid;       /* pid of child process, or 0, as returned via fork.    */
     int rc;        /* stores return values of various routines.            */
+    int low_bit = 1;
+    int high_bit = 1024;
+
+    // Get the arguments
+    if (argc > 2) {
+      low_bit = atoi(argv[1]);
+      high_bit = atoi(argv[2]);
+    }
 
     /* first, create one pipe. */
     rc = pipe(user_to_translator);
@@ -307,10 +314,10 @@
 	    perror("main: fork");
 	    exit(1);
 	case 0:		/* inside child process.  */
-	    calculator(user_to_translator, translator_to_user); /* line 'A' */
+	    calculator(user_to_translator, translator_to_user);
 	    /* NOT REACHED */
 	default:	/* inside parent process. */
-	    test_driver(translator_to_user, user_to_translator); /* line 'B' */
+	    test_driver(low_bit, high_bit, translator_to_user, user_to_translator);
 	    /* NOT REACHED */
     }
 






More information about the llvm-commits mailing list