int main (int argc, char *argv[]) { if (InitCVIRTE (0, argv, 0) == 0) return -1; /* out of memory */ if (argc != 2) { fprintf(stderr, "you must pass the path to a module to test"); return -1; } char *testModule = argv[1]; if (!FileExists(testModule, 0)) { fprintf(stderr, "you must pass the path to a module to test"); } ListType names; SymbolParser *parser = MakeParser(testModule); names = GetExports(parser); context = CreateContext(); LoadTestInfo info = { .parser = parser, .executeOnContext = context->ExecuteTests }; ListApplyToEach(names, 1, LoadUserTests, &info); DeleteParser(parser); FreeContext(context); return 0; }
int main(int argc, char *argv[]) { char name[100]; lst = stderr; if (argc == 1) { Help(); exit(EXIT_FAILURE); } InitFrameVars(); source_name[0] = '\0'; param_options(argc, argv); /* check on correct parameter usage */ if (source_name[0] == 0) { fprintf(stderr, "No input file specified"); exit(EXIT_FAILURE); } /* open the Source file (Scanner.S_src) */ if ((S_src = open(source_name, O_RDONLY|O_BINARY)) == -1) { fprintf(stderr, "Unable to open input file %s\n", source_name); exit(EXIT_FAILURE); } /* open the listing file */ if (L_option) { FileGetName(name, source_name); strcat(name, ".lst"); lstfile = OpenFile(name, "w", 1); } else if (!Q_option) lstfile = stderr; else lstfile = stdout; /* install error reporting procedure */ Custom_Error = (Error_Func) StoreError; InitTab(); InitScannerTab(); Parse(); close(S_src); lst = lstfile; if (Errors && !L_option) SummarizeErrors(); else if (Errors || L_option) PrintListing(); if (Errors) { /* Check for Syntax Errors */ fclose(lstfile); exit(EXIT_FAILURE); } MakeScanner(); MakeParser(); if (Errors) { /* Check for LL(1) Errors, Undeclared Symbols, etc */ fclose(lstfile); exit(EXIT_FAILURE); } SetupFrameVars(); if (!T_option) { if (!P_option) GenScanner(); GenParser(); GenHeaders(); if (C_option) GenCompiler(); } if (L_option) { if (S_option) { ShowClassTab(); ShowTermTab(); ShowCommentTab(); ShowSymSetTab(); ShowNTermTab(); } if (A_option) ShowDFA(); fclose(lstfile); } DoneTab(); DoneScannerTab(); return (EXIT_SUCCESS); }