Changeset e5e9888


Ignore:
Timestamp:
May 22, 2010, 10:37:26 PM (10 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
22e02cd
Parents:
98d7757
git-author:
Nelson Elhage <nelhage@mit.edu> (05/22/10 18:19:35)
git-committer:
Nelson Elhage <nelhage@mit.edu> (05/22/10 22:37:26)
Message:
tester: Better error handling.

* Use 'do' instead of slurping the file and eval'ing, which gives the
  right filename in error messages.
* Catch errors reported by do due to compilation failures.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester.c

    r98d7757 re5e9888  
    5353
    5454  if (argc > 1) {
    55     char *code;
    56     FILE *f;
     55    ENTER;
     56    SAVETMPS;
    5757
    5858    if (strcmp(argv[1], "-le") == 0 && argc > 2) {
     
    6262       */
    6363      moreswitches("l");
    64       code = argv[2];
     64      eval_pv(argv[2], true);
    6565    } else {
    66       f = fopen(argv[1], "r");
    67       if (!f) {
    68         perror(argv[1]);
    69         status = 1;
    70         goto out;
    71       }
    72       code = owl_slurp(f);
    7366      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);
    7470    }
    75 
    76     ENTER;
    77     SAVETMPS;
    78 
    79     eval_pv(code, true);
    8071
    8172    status = 0;
Note: See TracChangeset for help on using the changeset viewer.