aboutsummaryrefslogtreecommitdiff
path: root/src/or/test_config.c
blob: 5f26334ade5a762db93bb95182b5da04381c7ab7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "or.h"

int main(int ac, char **av)
{
   or_options_t options;
   int argc, rtn_val, failures, total;
   char fname[512];
   FILE *pipe;
   char *argv[] = { "or", "-f", fname, NULL };
   argc = 4;
   failures = total = 0;
   printf("Config file test suite...\n\n");
   pipe = popen("ls -1 ../config/*orrc","r");
   while ( fgets(fname,sizeof(fname),pipe) )
   {
      fname[strlen(fname)-1] = '\0';
      printf("%s\n--------------------\n", fname);
      rtn_val = getconfig(argc,argv,&options);
      ++total;
      if ( rtn_val)
      {
         ++failures;
         printf("Test failed!\n\n");
      }
      else
         printf("Test succeeded\n\n");
   }
   printf("%6.2f percent. %d failures.\n",(total - failures)*100/(float)total,failures);
   return failures;
}