- Timestamp:
- Jun 17, 2010, 9:41:41 AM (15 years ago)
- Branches:
- master, release-1.10, release-1.7, release-1.8, release-1.9
- Children:
- 3c2c7fc
- Parents:
- 68e5464 (diff), 95414bf (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tester.c
r3f6555d rdec60b4 1 #define OWL_PERL 2 #define WINDOW FAKE_WINDOW 1 3 #include "owl.h" 4 #undef WINDOW 5 2 6 #include <unistd.h> 3 7 #include <stdlib.h> 4 8 9 #undef instr 10 #include <curses.h> 11 5 12 owl_global g; 6 13 7 14 int numtests; 8 15 16 int owl_regtest(void); 9 17 int owl_util_regtest(void); 10 18 int owl_dict_regtest(void); … … 14 22 int owl_editwin_regtest(void); 15 23 24 extern void owl_perl_xs_init(pTHX); 25 16 26 int main(int argc, char **argv, char **env) 17 27 { 28 FILE *rnull; 29 FILE *wnull; 30 char *perlerr; 31 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 18 38 /* initialize a fake ncurses, detached from std{in,out} */ 19 FILE *rnull = fopen("/dev/null", "r");20 FILE *wnull = fopen("/dev/null", "w");39 wnull = fopen("/dev/null", "w"); 40 rnull = fopen("/dev/null", "r"); 21 41 newterm("xterm", wnull, rnull); 22 42 /* initialize global structures */ 23 43 owl_global_init(&g); 24 44 45 perlerr = owl_perlconfig_initperl(NULL, &argc, &argv, &env); 46 if (perlerr) { 47 endwin(); 48 fprintf(stderr, "Internal perl error: %s\n", perlerr); 49 status = 1; 50 goto out; 51 } 52 53 owl_global_complete_setup(&g); 54 owl_global_setup_default_filters(&g); 55 56 owl_view_create(owl_global_get_current_view(&g), "main", 57 owl_global_get_filter(&g, "all"), 58 owl_global_get_style_by_name(&g, "default")); 59 60 owl_function_firstmsg(); 61 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); 74 } else { 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; 85 86 out: 87 perl_destruct(owl_global_get_perlinterp(&g)); 88 perl_free(owl_global_get_perlinterp(&g)); 89 /* probably not necessary, but tear down the screen */ 90 endwin(); 91 fclose(rnull); 92 fclose(wnull); 93 return status; 94 } 95 96 int owl_regtest(void) { 25 97 numtests = 0; 26 98 int numfailures=0; … … 38 110 } 39 111 printf("1..%d\n", numtests); 40 41 /* probably not necessary, but tear down the screen */42 endwin();43 fclose(rnull);44 fclose(wnull);45 112 46 113 return(numfailures);
Note: See TracChangeset
for help on using the changeset viewer.