MCPcopy Create free account
hub / github.com/F-Stack/f-stack / run_test

Function run_test

dpdk/app/test/test_bpf.c:3200–3245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3198};
3199
3200static int
3201run_test(const struct bpf_test *tst)
3202{
3203 int32_t ret, rv;
3204 int64_t rc;
3205 struct rte_bpf *bpf;
3206 struct rte_bpf_jit jit;
3207 uint8_t tbuf[tst->arg_sz];
3208
3209 printf("%s(%s) start\n", __func__, tst->name);
3210
3211 bpf = rte_bpf_load(&tst->prm);
3212 if (bpf == NULL) {
3213 printf("%s@%d: failed to load bpf code, error=%d(%s);\n",
3214 __func__, __LINE__, rte_errno, strerror(rte_errno));
3215 return -1;
3216 }
3217
3218 tst->prepare(tbuf);
3219 rc = rte_bpf_exec(bpf, tbuf);
3220 ret = tst->check_result(rc, tbuf);
3221 if (ret != 0) {
3222 printf("%s@%d: check_result(%s) failed, error: %d(%s);\n",
3223 __func__, __LINE__, tst->name, ret, strerror(ret));
3224 }
3225
3226 /* repeat the same test with jit, when possible */
3227 rte_bpf_get_jit(bpf, &jit);
3228 if (jit.func != NULL) {
3229
3230 tst->prepare(tbuf);
3231 rc = jit.func(tbuf);
3232 rv = tst->check_result(rc, tbuf);
3233 ret |= rv;
3234 if (rv != 0) {
3235 printf("%s@%d: check_result(%s) failed, "
3236 "error: %d(%s);\n",
3237 __func__, __LINE__, tst->name,
3238 rv, strerror(rv));
3239 }
3240 }
3241
3242 rte_bpf_destroy(bpf);
3243 return ret;
3244
3245}
3246
3247static int
3248test_bpf(void)

Callers 3

WORKER_DEFINEFunction · 0.70
test_trace_perfFunction · 0.70
test_bpfFunction · 0.70

Calls 5

rte_bpf_loadFunction · 0.85
rte_bpf_execFunction · 0.85
rte_bpf_get_jitFunction · 0.85
rte_bpf_destroyFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected