int np_open(char *np_ip, char *np_port, char *ifname, char *ifip, int udprcvsize){ int status; status = np_init(np_ip, np_port, ifname, ifip, udprcvsize); if(status == 0) status = np_open_channels(); return(status); }
void fileinit(Void) { register char *s; register int i, j; lastiolabno = 100000; lastlabno = 0; lastvarno = 0; nliterals = 0; nerr = 0; infile = stdin; maxtoklen = 502; token = (char *)ckalloc(maxtoklen+2); memset(dflttype, tyreal, 26); memset(dflttype + 'i' - 'a', tyint, 6); memset(hextoi_tab, 16, sizeof(hextoi_tab)); for(i = 0, s = "0123456789abcdef"; *s; i++, s++) hextoi(*s) = i; for(i = 10, s = "ABCDEF"; *s; i++, s++) hextoi(*s) = i; for(j = 0, s = "abcdefghijklmnopqrstuvwxyz"; i = *s++; j++) Letters[i] = Letters[i+'A'-'a'] = j; ctls = ALLOCN(maxctl+1, Ctlframe); extsymtab = ALLOCN(maxext, Extsym); eqvclass = ALLOCN(maxequiv, Equivblock); hashtab = ALLOCN(maxhash, Hashentry); labeltab = ALLOCN(maxstno, Labelblock); litpool = ALLOCN(maxliterals, Literal); labarray = (struct Labelblock **)ckalloc(maxlablist* sizeof(struct Labelblock *)); fmt_init(); mem_init(); np_init(); ctlstack = ctls++; lastctl = ctls + maxctl; nextext = extsymtab; lastext = extsymtab + maxext; lasthash = hashtab + maxhash; labtabend = labeltab + maxstno; highlabtab = labeltab; main_alias[0] = '\0'; if (forcedouble) dfltproc[TYREAL] = dfltproc[TYDREAL]; /* Initialize the routines for providing C output */ out_init (); }
int main(int argc, char **argv) { np_init(); np_parse_args(argc, argv); if (opts.action == NP_CON_ESTAB) np_connection_establish(&opts); else if (opts.action == NP_CON_RESP) np_connection_response(&opts); else if (opts.action == NP_TEST) np_test(&opts); else printf("[WARN] no args specified\n"); return 0; }
void test_rp_ctx_create(rp_ctx_t **rp_ctx_p) { int rc = SR_ERR_OK; rp_ctx_t *ctx = NULL; ctx = calloc(1, sizeof(*ctx)); assert_non_null(ctx); rc = ac_init(TEST_DATA_SEARCH_DIR, &ctx->ac_ctx); assert_int_equal(SR_ERR_OK, rc); rc = np_init(ctx, &ctx->np_ctx); assert_int_equal(SR_ERR_OK, rc); rc = pm_init(ctx, TEST_INTERNAL_SCHEMA_SEARCH_DIR, TEST_DATA_SEARCH_DIR, &ctx->pm_ctx); assert_int_equal(SR_ERR_OK, rc); rc = dm_init(ctx->ac_ctx, ctx->np_ctx, ctx->pm_ctx, TEST_SCHEMA_SEARCH_DIR, TEST_DATA_SEARCH_DIR, &ctx->dm_ctx); assert_int_equal(SR_ERR_OK, rc); *rp_ctx_p = ctx; }
int main(int argc, char **argv) { int ec = 0; np_plan_t *plan = 0; np_runner_t *runner = 0; const char *output_format = 0; enum { UNKNOWN, RUN, LIST } mode = UNKNOWN; int concurrency = -1; int c; static const struct option opts[] = { { "format", required_argument, NULL, 'f' }, { "jobs", required_argument, NULL, 'j' }, { "list", no_argument, NULL, 'l' }, { NULL, 0, NULL, 0 }, }; /* Parse arguments */ while ((c = getopt_long(argc, argv, "f:j:l", opts, NULL)) >= 0) { switch (c) { case 'f': output_format = optarg; break; case 'j': if (!strcasecmp(optarg, "max")) concurrency = 0; else if ((concurrency = atoi(optarg)) <= 0) usage(argv[0]); break; case 'l': mode = LIST; break; default: usage(argv[0]); } } if (optind < argc) { /* Some tests were specified on the commandline */ plan = np_plan_new(); np_plan_add_specs(plan, argc-optind, (const char **)argv+optind); } /* Initialise the NovaProva library */ runner = np_init(); switch (mode) { case LIST: /* List the specified (or all the discovered) tests */ np_list_tests(runner, plan); break; case UNKNOWN: case RUN: /* Run the specified (or all the discovered) tests */ /* Set the output format */ if (output_format) { if (!np_set_output_format(runner, output_format)) { fprintf(stderr, "np: unknown output format '%s'\n", output_format); exit(1); } } /* Set how many tests will be run in parallel */ if (concurrency >= 0) np_set_concurrency(runner, concurrency); /* Run the specified tests */ ec = np_run_tests(runner, plan); break; } /* Shut down the NovaProva library */ if (plan) np_plan_delete(plan); np_done(runner); exit(ec); }