diff mbox series

[v1,bpf-next,02/17] selftests/bpf: Use program name for skel load/destroy functions

Message ID 20240510190246.3247730-3-jrife@google.com (mailing list archive)
State Accepted
Commit 86b65c6db0190fb6c119e83da4de0eccf74fb1ff
Delegated to: BPF
Headers show
Series Retire progs/test_sock_addr.c | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-VM_Test-22 success Logs for x86_64-gcc / test (test_progs, false, 360) / test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-23 success Logs for x86_64-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-24 success Logs for x86_64-gcc / test (test_progs_no_alu32_parallel, true, 30) / test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-25 success Logs for x86_64-gcc / test (test_progs_parallel, true, 30) / test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-27 success Logs for x86_64-gcc / veristat / veristat on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-30 success Logs for x86_64-llvm-17 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-31 success Logs for x86_64-llvm-17 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-32 success Logs for x86_64-llvm-17 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-37 success Logs for x86_64-llvm-18 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-38 success Logs for x86_64-llvm-18 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-39 success Logs for x86_64-llvm-18 / test (test_progs_cpuv4, false, 360) / test_progs_cpuv4 on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-40 success Logs for x86_64-llvm-18 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-5 success Logs for aarch64-gcc / build-release
bpf/vmtest-bpf-next-VM_Test-3 success Logs for Validate matrix.py
bpf/vmtest-bpf-next-VM_Test-2 success Logs for Unittests
bpf/vmtest-bpf-next-VM_Test-8 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-0 success Logs for Lint
bpf/vmtest-bpf-next-PR fail merge-conflict
bpf/vmtest-bpf-next-VM_Test-6 success Logs for aarch64-gcc / test (test_maps, false, 360) / test_maps on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-7 success Logs for aarch64-gcc / test (test_progs, false, 360) / test_progs on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-9 success Logs for aarch64-gcc / test (test_verifier, false, 360) / test_verifier on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-4 success Logs for aarch64-gcc / build / build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-10 success Logs for aarch64-gcc / veristat
bpf/vmtest-bpf-next-VM_Test-11 success Logs for s390x-gcc / build / build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-12 success Logs for s390x-gcc / build-release
bpf/vmtest-bpf-next-VM_Test-13 success Logs for s390x-gcc / test (test_maps, false, 360) / test_maps on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-14 success Logs for s390x-gcc / test (test_progs, false, 360) / test_progs on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-15 success Logs for s390x-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-16 success Logs for s390x-gcc / test (test_verifier, false, 360) / test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-17 success Logs for s390x-gcc / veristat
bpf/vmtest-bpf-next-VM_Test-18 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-19 success Logs for x86_64-gcc / build / build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-20 success Logs for x86_64-gcc / build-release
bpf/vmtest-bpf-next-VM_Test-21 success Logs for x86_64-gcc / test (test_maps, false, 360) / test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-26 success Logs for x86_64-gcc / test (test_verifier, false, 360) / test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-28 success Logs for x86_64-llvm-17 / build / build for x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-29 success Logs for x86_64-llvm-17 / build-release / build for x86_64 with llvm-17 and -O2 optimization
bpf/vmtest-bpf-next-VM_Test-33 success Logs for x86_64-llvm-17 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-34 success Logs for x86_64-llvm-17 / veristat
bpf/vmtest-bpf-next-VM_Test-35 success Logs for x86_64-llvm-18 / build / build for x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-36 success Logs for x86_64-llvm-18 / build-release / build for x86_64 with llvm-18 and -O2 optimization
bpf/vmtest-bpf-next-VM_Test-41 success Logs for x86_64-llvm-18 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-42 success Logs for x86_64-llvm-18 / veristat

Commit Message

Jordan Rife May 10, 2024, 7:02 p.m. UTC
In preparation to migrate tests from bpf/test_sock_addr.c to
sock_addr.c, update BPF_SKEL_FUNCS so that it generates functions
based on prog_name instead of skel_name. This allows us to differentiate
between programs in the same skeleton.

Signed-off-by: Jordan Rife <jrife@google.com>
---
 .../selftests/bpf/prog_tests/sock_addr.c      | 96 ++++++++++---------
 1 file changed, 50 insertions(+), 46 deletions(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/prog_tests/sock_addr.c b/tools/testing/selftests/bpf/prog_tests/sock_addr.c
index 9c709c33f8899..039c3e38e1bc2 100644
--- a/tools/testing/selftests/bpf/prog_tests/sock_addr.c
+++ b/tools/testing/selftests/bpf/prog_tests/sock_addr.c
@@ -357,7 +357,7 @@  struct sock_addr_test {
 };
 
 #define BPF_SKEL_FUNCS(skel_name, prog_name) \
-static void *skel_name##_load(int cgroup_fd) \
+static void *prog_name##_load(int cgroup_fd) \
 { \
 	struct skel_name *skel; \
 	skel = skel_name##__open_and_load(); \
@@ -372,7 +372,7 @@  cleanup: \
 	skel_name##__destroy(skel); \
 	return NULL; \
 } \
-static void skel_name##_destroy(void *skel) \
+static void prog_name##_destroy(void *skel) \
 { \
 	skel_name##__destroy(skel); \
 }
@@ -396,8 +396,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_BIND,
 		"bind4: bind (stream)",
-		bind4_prog_load,
-		bind4_prog_destroy,
+		bind_v4_prog_load,
+		bind_v4_prog_destroy,
 		&user_ops,
 		AF_INET,
 		SOCK_STREAM,
@@ -405,12 +405,13 @@  static struct sock_addr_test tests[] = {
 		SERV4_PORT,
 		SERV4_REWRITE_IP,
 		SERV4_REWRITE_PORT,
+		NULL,
 	},
 	{
 		SOCK_ADDR_TEST_BIND,
 		"bind4: bind (dgram)",
-		bind4_prog_load,
-		bind4_prog_destroy,
+		bind_v4_prog_load,
+		bind_v4_prog_destroy,
 		&user_ops,
 		AF_INET,
 		SOCK_DGRAM,
@@ -418,12 +419,13 @@  static struct sock_addr_test tests[] = {
 		SERV4_PORT,
 		SERV4_REWRITE_IP,
 		SERV4_REWRITE_PORT,
+		NULL,
 	},
 	{
 		SOCK_ADDR_TEST_BIND,
 		"bind6: bind (stream)",
-		bind6_prog_load,
-		bind6_prog_destroy,
+		bind_v6_prog_load,
+		bind_v6_prog_destroy,
 		&user_ops,
 		AF_INET6,
 		SOCK_STREAM,
@@ -431,12 +433,13 @@  static struct sock_addr_test tests[] = {
 		SERV6_PORT,
 		SERV6_REWRITE_IP,
 		SERV6_REWRITE_PORT,
+		NULL,
 	},
 	{
 		SOCK_ADDR_TEST_BIND,
 		"bind6: bind (dgram)",
-		bind6_prog_load,
-		bind6_prog_destroy,
+		bind_v6_prog_load,
+		bind_v6_prog_destroy,
 		&user_ops,
 		AF_INET6,
 		SOCK_DGRAM,
@@ -444,14 +447,15 @@  static struct sock_addr_test tests[] = {
 		SERV6_PORT,
 		SERV6_REWRITE_IP,
 		SERV6_REWRITE_PORT,
+		NULL,
 	},
 
 	/* bind - kernel calls */
 	{
 		SOCK_ADDR_TEST_BIND,
 		"bind4: kernel_bind (stream)",
-		bind4_prog_load,
-		bind4_prog_destroy,
+		bind_v4_prog_load,
+		bind_v4_prog_destroy,
 		&kern_ops_sock_sendmsg,
 		AF_INET,
 		SOCK_STREAM,
@@ -463,8 +467,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_BIND,
 		"bind4: kernel_bind (dgram)",
-		bind4_prog_load,
-		bind4_prog_destroy,
+		bind_v4_prog_load,
+		bind_v4_prog_destroy,
 		&kern_ops_sock_sendmsg,
 		AF_INET,
 		SOCK_DGRAM,
@@ -476,8 +480,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_BIND,
 		"bind6: kernel_bind (stream)",
-		bind6_prog_load,
-		bind6_prog_destroy,
+		bind_v6_prog_load,
+		bind_v6_prog_destroy,
 		&kern_ops_sock_sendmsg,
 		AF_INET6,
 		SOCK_STREAM,
@@ -489,8 +493,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_BIND,
 		"bind6: kernel_bind (dgram)",
-		bind6_prog_load,
-		bind6_prog_destroy,
+		bind_v6_prog_load,
+		bind_v6_prog_destroy,
 		&kern_ops_sock_sendmsg,
 		AF_INET6,
 		SOCK_DGRAM,
@@ -504,8 +508,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_CONNECT,
 		"connect4: connect (stream)",
-		connect4_prog_load,
-		connect4_prog_destroy,
+		connect_v4_prog_load,
+		connect_v4_prog_destroy,
 		&user_ops,
 		AF_INET,
 		SOCK_STREAM,
@@ -518,8 +522,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_CONNECT,
 		"connect4: connect (dgram)",
-		connect4_prog_load,
-		connect4_prog_destroy,
+		connect_v4_prog_load,
+		connect_v4_prog_destroy,
 		&user_ops,
 		AF_INET,
 		SOCK_DGRAM,
@@ -532,8 +536,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_CONNECT,
 		"connect6: connect (stream)",
-		connect6_prog_load,
-		connect6_prog_destroy,
+		connect_v6_prog_load,
+		connect_v6_prog_destroy,
 		&user_ops,
 		AF_INET6,
 		SOCK_STREAM,
@@ -546,8 +550,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_CONNECT,
 		"connect6: connect (dgram)",
-		connect6_prog_load,
-		connect6_prog_destroy,
+		connect_v6_prog_load,
+		connect_v6_prog_destroy,
 		&user_ops,
 		AF_INET6,
 		SOCK_DGRAM,
@@ -576,8 +580,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_CONNECT,
 		"connect4: kernel_connect (stream)",
-		connect4_prog_load,
-		connect4_prog_destroy,
+		connect_v4_prog_load,
+		connect_v4_prog_destroy,
 		&kern_ops_sock_sendmsg,
 		AF_INET,
 		SOCK_STREAM,
@@ -590,8 +594,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_CONNECT,
 		"connect4: kernel_connect (dgram)",
-		connect4_prog_load,
-		connect4_prog_destroy,
+		connect_v4_prog_load,
+		connect_v4_prog_destroy,
 		&kern_ops_sock_sendmsg,
 		AF_INET,
 		SOCK_DGRAM,
@@ -604,8 +608,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_CONNECT,
 		"connect6: kernel_connect (stream)",
-		connect6_prog_load,
-		connect6_prog_destroy,
+		connect_v6_prog_load,
+		connect_v6_prog_destroy,
 		&kern_ops_sock_sendmsg,
 		AF_INET6,
 		SOCK_STREAM,
@@ -618,8 +622,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_CONNECT,
 		"connect6: kernel_connect (dgram)",
-		connect6_prog_load,
-		connect6_prog_destroy,
+		connect_v6_prog_load,
+		connect_v6_prog_destroy,
 		&kern_ops_sock_sendmsg,
 		AF_INET6,
 		SOCK_DGRAM,
@@ -648,8 +652,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_SENDMSG,
 		"sendmsg4: sendmsg (dgram)",
-		sendmsg4_prog_load,
-		sendmsg4_prog_destroy,
+		sendmsg_v4_prog_load,
+		sendmsg_v4_prog_destroy,
 		&user_ops,
 		AF_INET,
 		SOCK_DGRAM,
@@ -662,8 +666,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_SENDMSG,
 		"sendmsg6: sendmsg (dgram)",
-		sendmsg6_prog_load,
-		sendmsg6_prog_destroy,
+		sendmsg_v6_prog_load,
+		sendmsg_v6_prog_destroy,
 		&user_ops,
 		AF_INET6,
 		SOCK_DGRAM,
@@ -692,8 +696,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_SENDMSG,
 		"sendmsg4: sock_sendmsg (dgram)",
-		sendmsg4_prog_load,
-		sendmsg4_prog_destroy,
+		sendmsg_v4_prog_load,
+		sendmsg_v4_prog_destroy,
 		&kern_ops_sock_sendmsg,
 		AF_INET,
 		SOCK_DGRAM,
@@ -706,8 +710,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_SENDMSG,
 		"sendmsg6: sock_sendmsg (dgram)",
-		sendmsg6_prog_load,
-		sendmsg6_prog_destroy,
+		sendmsg_v6_prog_load,
+		sendmsg_v6_prog_destroy,
 		&kern_ops_sock_sendmsg,
 		AF_INET6,
 		SOCK_DGRAM,
@@ -736,8 +740,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_SENDMSG,
 		"sendmsg4: kernel_sendmsg (dgram)",
-		sendmsg4_prog_load,
-		sendmsg4_prog_destroy,
+		sendmsg_v4_prog_load,
+		sendmsg_v4_prog_destroy,
 		&kern_ops_kernel_sendmsg,
 		AF_INET,
 		SOCK_DGRAM,
@@ -750,8 +754,8 @@  static struct sock_addr_test tests[] = {
 	{
 		SOCK_ADDR_TEST_SENDMSG,
 		"sendmsg6: kernel_sendmsg (dgram)",
-		sendmsg6_prog_load,
-		sendmsg6_prog_destroy,
+		sendmsg_v6_prog_load,
+		sendmsg_v6_prog_destroy,
 		&kern_ops_kernel_sendmsg,
 		AF_INET6,
 		SOCK_DGRAM,