From: Dmitry V. Levin Date: Wed, 6 Jan 2016 11:29:16 +0000 (+0000) Subject: tests/bpf.c: use libtests X-Git-Tag: v4.12~704 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b2ae749ab1693f24de1d5a96f3d2ca2177bd8af5;p=strace tests/bpf.c: use libtests * tests/bpf.c: Use SKIP_MAIN_UNDEFINED. (main) Use perror_msg_and_skip. --- diff --git a/tests/bpf.c b/tests/bpf.c index eafd801a..d9b05e5d 100644 --- a/tests/bpf.c +++ b/tests/bpf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Dmitry V. Levin + * Copyright (c) 2015-2016 Dmitry V. Levin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,39 +80,39 @@ int main(void) { if (!map_create()) - return 77; + perror_msg_and_skip("BPF_MAP_CREATE"); printf("bpf\\(BPF_MAP_CREATE, " "\\{map_type=BPF_MAP_TYPE_UNSPEC, key_size=4, value_size=8, max_entries=256\\}, " "%u\\) += -1 .*\n", (unsigned) sizeof(union bpf_attr)); if (!map_any(BPF_MAP_LOOKUP_ELEM)) - return 77; + perror_msg_and_skip("BPF_MAP_LOOKUP_ELEM"); printf("bpf\\(BPF_MAP_LOOKUP_ELEM, " "\\{map_fd=-1, key=0xdeadbeef\\}, %u\\) += -1 .*\n", (unsigned) sizeof(union bpf_attr)); if (!map_any(BPF_MAP_UPDATE_ELEM)) - return 77; + perror_msg_and_skip("BPF_MAP_UPDATE_ELEM"); printf("bpf\\(BPF_MAP_UPDATE_ELEM, " "\\{map_fd=-1, key=0xdeadbeef, value=0xbadc0ded, flags=BPF_ANY\\}, " "%u\\) += -1 .*\n", (unsigned) sizeof(union bpf_attr)); if (!map_any(BPF_MAP_DELETE_ELEM)) - return 77; + perror_msg_and_skip("BPF_MAP_DELETE_ELEM"); printf("bpf\\(BPF_MAP_DELETE_ELEM, " "\\{map_fd=-1, key=0xdeadbeef\\}, %u\\) += -1 .*\n", (unsigned) sizeof(union bpf_attr)); if (!map_any(BPF_MAP_GET_NEXT_KEY)) - return 77; + perror_msg_and_skip("BPF_MAP_GET_NEXT_KEY"); printf("bpf\\(BPF_MAP_GET_NEXT_KEY, " "\\{map_fd=-1, key=0xdeadbeef\\}, %u\\) += -1 .*\n", (unsigned) sizeof(union bpf_attr)); if (!prog_load()) - return 77; + perror_msg_and_skip("BPF_PROG_LOAD"); printf("bpf\\(BPF_PROG_LOAD, " "\\{prog_type=BPF_PROG_TYPE_UNSPEC, insn_cnt=1, insns=%p, " "license=\"GPL\", log_level=42, log_size=4096, log_buf=%p, " @@ -124,10 +124,6 @@ main(void) #else -int -main(void) -{ - return 77; -} +SKIP_MAIN_UNDEFINED("__NR_bpf") #endif