apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jani Averbach <...@cc.jyu.fi>
Subject apr-util: testmd4.c: Minor Bug in test suite + patch
Date Thu, 06 Feb 2003 15:59:07 GMT

Hi!

Make check of apr-util will hang because of conflicting logic
between Makefile and testmd4.c.

HEAD:apr-util/test/testmd4.c:

int main(...)

   260      if (argc > 1)
   261      {
   262          for (i = 1; i < argc; i++)
   263              if (argv[i][0] == '-' && argv[i][1] == 's')
   264                  MDString(argv[i] + 2);
   265              else if (strcmp(argv[i], "-t") == 0)
   266                  MDTimeTrial();
   267              else if (strcmp (argv[i], "-x") == 0)
   268                  MDTestSuite();
   269              else
   270                  MDFile(argv[i]);
   271      }
   272      else
   273          MDFilter();


However, this test is called like that from Makefile:

HEAD:apr-util/test/Makefile.in:

    19  check: $(PROGRAMS)
    20          for prog in $(PROGRAMS); do \
    21                  ./$$prog ;\
    22                  if test $$? = 255; then \
    23                          echo "$$prog failed"; \
    24                          break; \
    25                  fi; \


So this check will be hang for ever (waiting input from stdin?). Secondly,
this test does not check anything except that the program will run, the
result is not checked (it is only printed to the stdout).


Here is small patch for first problem. Should there be same type of
construction than is in testmd5.c for checking the test results, or are
testmd4 and md4 algorithm retired?

--- testmd4.c.orig      2003-02-06 17:39:12.000000000 +0200
+++ testmd4.c   2003-02-06 17:49:55.000000000 +0200
@@ -239,9 +239,8 @@
    Arguments (may be any combination):
      -sstring - digests string
      -t       - runs time trial
-     -x       - runs test script
-     filename - digests file
-     (none)   - digests standard input
+     (none)   - runs test script
+     -f [filename] - diges file or stdin
  */
 int main (int argc, char **argv)
 {
@@ -264,10 +263,14 @@
                 MDString(argv[i] + 2);
             else if (strcmp(argv[i], "-t") == 0)
                 MDTimeTrial();
-            else if (strcmp (argv[i], "-x") == 0)
-                MDTestSuite();
+            else if (strcmp (argv[i], "-f") == 0){
+                if (i+1 < argc)
+                   MDFile(argv[++i]);
+                else
+                   MDFile(argv[i]);
+            }
             else
-                MDFile(argv[i]);
+                MDTestSuite();
     }
     else
         MDFilter();


BR, Jani

P.S. Please Cc:, I am not on the list.

--
Jani Averbach


Mime
View raw message