int main(int argc, char *argv[]) { if (argc != 2) { printf("Invalid argument count, should pass json file to " "parse.\n"); } tst_info_t test_info = parse_test_file(argv[1]); printf("Successfully parsed.\n"); printf("config_value: 0x%08X\n", get_config_value(test_info)); return 0; }
static struct TestFile * generate_code(char *infile, char *outfile, const struct Config *conf) { struct TestFile *tf; FILE *fout; int dep_added; tf = parse_test_file(infile); if (!tf) return NULL; if (!tf->sets) { close_testfile(tf); return NULL; } dep_added = file_dependency(infile, tf->sets, conf); // XXX if we're generating code just to run a test, use a mkstemp if (!outfile) { outfile = make_fortran_name(infile, conf); } tf->exe = outfile; fout = fopen(outfile, "w"); if (!fout) { fprintf(stderr, "FUnit: could not open %s for writing\n", outfile); return NULL; } if (generate_code_file(tf->sets, fout)) { close_testfile(tf); return NULL; } if (fclose(fout)) { fprintf(stderr, "FUnit: error closing %s\n", outfile); close_testfile(tf); return NULL; } if (dep_added) { // XXX wtf is this doing? struct TestSet *set = tf->sets; while (set) { set->deps = set->deps->next; set = set->next; } } return tf; }