diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2021-09-11 00:38:47 +0200 | 
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2021-09-11 00:38:47 +0200 | 
| commit | c2f4954c2d3fc4f77b46c67585e17a58df4ba8e4 (patch) | |
| tree | 533a2077028e02a851e51ad509a0aa3a9107999f /tools/testing/selftests/bpf/prog_tests/get_func_ip_test.c | |
| parent | 4b92d4add5f6dcf21275185c997d6ecb800054cd (diff) | |
| parent | 926de8c4326c14fcf35f1de142019043597a4fac (diff) | |
Merge branch 'linus' into smp/urgent
Ensure that all usage sites of get/put_online_cpus() except for the
struggler in drivers/thermal are gone. So the last user and the deprecated
inlines can be removed.
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/get_func_ip_test.c')
| -rw-r--r-- | tools/testing/selftests/bpf/prog_tests/get_func_ip_test.c | 55 | 
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/get_func_ip_test.c b/tools/testing/selftests/bpf/prog_tests/get_func_ip_test.c new file mode 100644 index 000000000000..02a465f36d59 --- /dev/null +++ b/tools/testing/selftests/bpf/prog_tests/get_func_ip_test.c @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <test_progs.h> +#include "get_func_ip_test.skel.h" + +void test_get_func_ip_test(void) +{ +	struct get_func_ip_test *skel = NULL; +	__u32 duration = 0, retval; +	int err, prog_fd; + +	skel = get_func_ip_test__open(); +	if (!ASSERT_OK_PTR(skel, "get_func_ip_test__open")) +		return; + +	/* test6 is x86_64 specifc because of the instruction +	 * offset, disabling it for all other archs +	 */ +#ifndef __x86_64__ +	bpf_program__set_autoload(skel->progs.test6, false); +	bpf_program__set_autoload(skel->progs.test7, false); +#endif + +	err = get_func_ip_test__load(skel); +	if (!ASSERT_OK(err, "get_func_ip_test__load")) +		goto cleanup; + +	err = get_func_ip_test__attach(skel); +	if (!ASSERT_OK(err, "get_func_ip_test__attach")) +		goto cleanup; + +	prog_fd = bpf_program__fd(skel->progs.test1); +	err = bpf_prog_test_run(prog_fd, 1, NULL, 0, +				NULL, NULL, &retval, &duration); +	ASSERT_OK(err, "test_run"); +	ASSERT_EQ(retval, 0, "test_run"); + +	prog_fd = bpf_program__fd(skel->progs.test5); +	err = bpf_prog_test_run(prog_fd, 1, NULL, 0, +				NULL, NULL, &retval, &duration); + +	ASSERT_OK(err, "test_run"); + +	ASSERT_EQ(skel->bss->test1_result, 1, "test1_result"); +	ASSERT_EQ(skel->bss->test2_result, 1, "test2_result"); +	ASSERT_EQ(skel->bss->test3_result, 1, "test3_result"); +	ASSERT_EQ(skel->bss->test4_result, 1, "test4_result"); +	ASSERT_EQ(skel->bss->test5_result, 1, "test5_result"); +#ifdef __x86_64__ +	ASSERT_EQ(skel->bss->test6_result, 1, "test6_result"); +	ASSERT_EQ(skel->bss->test7_result, 1, "test7_result"); +#endif + +cleanup: +	get_func_ip_test__destroy(skel); +}  | 
