@@ -85,6 +85,7 @@ FEATURE_TESTS_EXTRA := \
libbfd-liberty \
libbfd-liberty-z \
libopencsd \
+ libpcap \
libunwind-x86 \
libunwind-x86_64 \
libunwind-arm \
@@ -113,6 +114,7 @@ FEATURE_DISPLAY ?= \
libelf \
libnuma \
numa_num_possible_cpus \
+ libpcap \
libperl \
libpython \
libcrypto \
@@ -27,6 +27,7 @@ FILES= \
test-libelf-mmap.bin \
test-libnuma.bin \
test-numa_num_possible_cpus.bin \
+ test-libpcap.bin \
test-libperl.bin \
test-libpython.bin \
test-libpython-version.bin \
@@ -209,6 +210,9 @@ FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
$(OUTPUT)test-libperl.bin:
$(BUILD) $(FLAGS_PERL_EMBED)
+$(OUTPUT)test-libpcap.bin:
+ $(BUILD) -lpcap
+
$(OUTPUT)test-libpython.bin:
$(BUILD) $(FLAGS_PYTHON_EMBED)
new file mode 100644
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <pcap.h>
+
+#define PKTLEN 100
+
+int main(void)
+{
+ char dummy_data[PKTLEN] = { 0 };
+ pcap_dumper_t *pcap_dumper;
+ struct pcap_pkthdr hdr;
+ int proto = 1;
+ pcap_t *pcap;
+
+ pcap = pcap_open_dead(proto, PKTLEN);
+ pcap_dumper = pcap_dump_open(pcap, "-");
+ hdr.caplen = PKTLEN;
+ hdr.len = PKTLEN;
+ hdr.ts.tv_sec = 0;
+ hdr.ts.tv_usec = 0;
+ pcap_dump((u_char *)pcap_dumper, &hdr, (const u_char *)dummy_data);
+ pcap_dump_flush(pcap_dumper);
+ pcap_dump_close(pcap_dumper);
+ pcap_close(pcap);
+
+ return 0;
+}
this test will be used when deciding whether to add the pcap support features in the following patch Signed-off-by: Alan Maguire <alan.maguire@oracle.com> --- tools/build/Makefile.feature | 2 ++ tools/build/feature/Makefile | 4 ++++ tools/build/feature/test-libpcap.c | 26 ++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 tools/build/feature/test-libpcap.c