Changeset 95414bf for tester.c


Ignore:
Timestamp:
Jun 13, 2010, 7:53:22 PM (11 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
8ab1f28, 63d9de9
Parents:
22e02cd
Message:
tester: Require --builtin to run builtin tests
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester.c

    r22e02cd r95414bf  
    2626int main(int argc, char **argv, char **env)
    2727{
    28   /* initialize a fake ncurses, detached from std{in,out} */
    29   FILE *rnull = fopen("/dev/null", "r");
    30   FILE *wnull = fopen("/dev/null", "w");
     28  FILE *rnull;
     29  FILE *wnull;
    3130  char *perlerr;
    3231  int status = 0;
     32
     33  if (argc <= 1) {
     34    fprintf(stderr, "Usage: %s --builtin|TEST.t|-le CODE\n", argv[0]);
     35    return 1;
     36  }
     37
     38  /* initialize a fake ncurses, detached from std{in,out} */
     39  wnull = fopen("/dev/null", "w");
     40  rnull = fopen("/dev/null", "r");
    3341  newterm("xterm", wnull, rnull);
    3442  /* initialize global structures */
     
    5260  owl_function_firstmsg();
    5361
    54   if (argc > 1) {
    55     ENTER;
    56     SAVETMPS;
    57 
    58     if (strcmp(argv[1], "-le") == 0 && argc > 2) {
    59       /*
    60        * 'prove' runs its harness perl with '-le CODE' to get some
    61        * information out.
    62        */
    63       moreswitches("l");
    64       eval_pv(argv[2], true);
    65     } else {
    66       sv_setpv(get_sv("0", false), argv[1]);
    67       sv_setpv(get_sv("main::test_prog", TRUE), argv[1]);
    68 
    69       eval_pv("do $main::test_prog; die($@) if($@)", true);
    70     }
    71 
    72     status = 0;
    73 
    74     FREETMPS;
    75     LEAVE;
     62  ENTER;
     63  SAVETMPS;
     64
     65  if (strcmp(argv[1], "--builtin") == 0) {
     66    status = owl_regtest();
     67  } else if (strcmp(argv[1], "-le") == 0 && argc > 2) {
     68    /*
     69     * 'prove' runs its harness perl with '-le CODE' to get some
     70     * information out.
     71     */
     72    moreswitches("l");
     73    eval_pv(argv[2], true);
    7674  } else {
    77     status = owl_regtest();
    78   }
     75    sv_setpv(get_sv("0", false), argv[1]);
     76    sv_setpv(get_sv("main::test_prog", TRUE), argv[1]);
     77
     78    eval_pv("do $main::test_prog; die($@) if($@)", true);
     79  }
     80
     81  status = 0;
     82
     83  FREETMPS;
     84  LEAVE;
    7985
    8086 out:
Note: See TracChangeset for help on using the changeset viewer.