#!/bin/bash

make allnoconfig
scripts/config --file .config \
               --enable 64BIT \
               --enable BPF_JIT \
               --enable BPF_SYSCALL \
               --enable DEBUG_INFO_BTF \
               --enable DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT \
               --enable DEBUG_KERNEL \
               --enable MODULES
make olddefconfig

# v7.3-rc5
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] arena_kfunc.bpf.o
#progs/../test_kmods/bpf_testmod_kfunc.h:80:12: error: invalid application of 'sizeof' to an
#      incomplete type 'struct __kernel_sockaddr_storage'
scripts/config --file .config --enable NET
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] bpf_cc_cubic.bpf.o
#progs/bpf_cc_cubic.c:122:11: error: use of undeclared identifier 'TCP_CA_CWR'
scripts/config --file .config --enable INET
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] bpf_iter_setsockopt_unix.bpf.o
#progs/bpf_iter_setsockopt_unix.c:29:26: error: declaration of 'struct bpf_iter__unix' will not
#      be visible outside of this function [-Werror,-Wvisibility]
scripts/config --file .config --enable UNIX
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] bpf_iter_task_btf.bpf.o
#progs/bpf_iter_task_btf.c:20:24: error: variable has incomplete type 'struct btf_ptr'
scripts/config --file .config --enable KPROBES --enable FTRACE --enable KPROBE_EVENTS
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] bpf_qdisc_dynptr_use_after_invalidate_clone.bpf.o
#progs/bpf_qdisc_dynptr_use_after_invalidate_clone.c:26:3: error: call to undeclared function
#      'bpf_qdisc_skb_drop'
scripts/config --file .config --enable NET_SCHED
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] bpf_qdisc_dynptr_use_after_invalidate_clone.bpf.o
#progs/bpf_qdisc_dynptr_use_after_invalidate_clone.c:26:3: error: call to undeclared function
#      'bpf_qdisc_skb_drop'
scripts/config --file .config --enable NET_SCH_BPF
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] btf_type_tag_percpu.bpf.o
#progs/btf_type_tag_percpu.c:53:17: error: incomplete definition of type 'struct cgroup'
scripts/config --file .config --enable CGROUPS
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] cgroup_iter_memcg.bpf.o
#progs/cgroup_iter_memcg.c:23:10: error: call to undeclared function 'bpf_get_mem_cgroup'
scripts/config --file .config --enable MEMCG
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] cgroup_mprog.bpf.o
#progs/cgroup_mprog.c:9:25: error: declaration of 'struct bpf_sockopt' will not be visible
#      outside of this function [-Werror,-Wvisibility]
scripts/config --file .config --enable CGROUP_BPF
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] crypto_basic.bpf.o
#progs/crypto_basic.c:15:27: error: variable has incomplete type 'struct bpf_crypto_params'
scripts/config --file .config --enable CRYPTO
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] dmabuf_iter.bpf.o
#progs/dmabuf_iter.c:31:29: error: declaration of 'struct bpf_iter__dmabuf' will not be visible
#      outside of this function [-Werror,-Wvisibility]
scripts/config --file .config --enable SYNC_FILE
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] file_reader.bpf.o
#progs/file_reader.c:45:9: error: call to undeclared function 'bpf_get_task_exe_file'
scripts/config --file .config --enable SECURITY --enable BPF_LSM
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] lsm_cgroup.bpf.o
#progs/lsm_cgroup.c:107:21: error: variable has incomplete type 'struct sockaddr_ll'
scripts/config --file .config --enable PACKET
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] lwt_misc.bpf.o
#progs/lwt_misc.c:17:26: error: use of undeclared identifier 'BPF_LWT_ENCAP_IP'
scripts/config --file .config --enable LWTUNNEL --enable LWTUNNEL_BPF
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] mptcp_sock.bpf.o
#progs/mptcp_sock.c:49:40: error: no member named 'is_mptcp' in 'struct tcp_sock'
#progs/mptcp_sock.c:69:25: error: no member named 'token' in 'struct mptcp_sock'
scripts/config --file .config --enable MPTCP
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] profiler1/2/3.bpf.o
#progs/profiler.inc.h:599:49: error: declaration of 'struct syscall_trace_enter' will not be
#      visible outside of this function [-Werror,-Wvisibility]
scripts/config --file .config --enable FTRACE_SYSCALLS
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] test_bpf_nf.bpf.o
#progs/test_bpf_nf.c:89:49: error: declaration of 'union nf_inet_addr' will not be visible ...
#progs/test_bpf_nf.c:200:5: error: incomplete definition of type 'struct nf_conn'
#progs/test_bpf_nf.c:233:12: error: use of undeclared identifier 'IPS_CONFIRMED'
scripts/config --file .config \
               --enable NETFILTER \
               --enable NF_CONNTRACK \
               --enable NF_CONNTRACK_MARK \
               --enable NF_NAT
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] test_lwt_ip_encap.bpf.o
#progs/test_lwt_ip_encap.c:105:19: error: field has incomplete type 'struct vxlanhdr'
scripts/config --file .config --enable NETDEVICES --enable VXLAN
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1

#  CLNG-BPF [test_progs] test_tunnel_kern.bpf.o
#progs/test_tunnel_kern.c:964:24: error: variable has incomplete type 'struct bpf_xfrm_state'
#progs/test_tunnel_kern.c:983:29: error: variable has incomplete type 'struct bpf_xfrm_state_opts'
scripts/config --file .config --enable XFRM_USER
make olddefconfig
make -j
make -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf FORCE_TARGETS=1
