diff --git a/gtests/net/packetdrill/assert.h b/gtests/net/packetdrill/assert.h new file mode 100644 index 0000000000000000000000000000000000000000..9d038225392e81719c2eec4677d7d9a94436f441 --- /dev/null +++ b/gtests/net/packetdrill/assert.h @@ -0,0 +1,10 @@ +#include <stdio.h> + +extern void __attribute__((noreturn)) die(char *format, ...); + +#define assert(expr) \ + do { \ + if (!(expr)) \ + die("assertion %s failed at %s line %d",\ + __STRING(expr), __FILE__, __LINE__);\ + } while (0) diff --git a/gtests/net/packetdrill/checksum.c b/gtests/net/packetdrill/checksum.c index f7ae72d9004ec99f6a0fbdcb0243139cb9abba04..60dd6412596c3569dca4b4f00fc366a83870f186 100644 --- a/gtests/net/packetdrill/checksum.c +++ b/gtests/net/packetdrill/checksum.c @@ -24,8 +24,8 @@ #include "checksum.h" -#include <assert.h> #include <stdint.h> +#include "assert.h" /* Add bytes in buffer to a running checksum. Returns the new * intermediate checksum. Use ip_checksum_fold() to convert the diff --git a/gtests/net/packetdrill/checksum_test.c b/gtests/net/packetdrill/checksum_test.c index fb802dbcd4fac9547264dc51f2d9b5aa85f4fd65..34531efb3bbf3836ea2b688314849caca0f39feb 100644 --- a/gtests/net/packetdrill/checksum_test.c +++ b/gtests/net/packetdrill/checksum_test.c @@ -25,7 +25,7 @@ #include "checksum.h" #include <arpa/inet.h> -#include <assert.h> +#include "assert.h" #include "ip.h" #include "ipv6.h" #include "sctp.h" diff --git a/gtests/net/packetdrill/code.c b/gtests/net/packetdrill/code.c index 439695b8937bd49b7e8e064a9b09e9072745af74..69d86769d32f348ef73a944ff7ec893d7a51bbcf 100644 --- a/gtests/net/packetdrill/code.c +++ b/gtests/net/packetdrill/code.c @@ -25,7 +25,6 @@ #include "code.h" -#include <assert.h> #include <errno.h> #include <signal.h> #include <stdio.h> @@ -36,6 +35,7 @@ #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> +#include "assert.h" #include "run.h" #include "tcp.h" diff --git a/gtests/net/packetdrill/fmemopen.c b/gtests/net/packetdrill/fmemopen.c index 1d1989f8544c274d325fbdd18426ec34c3d47897..5ed2be5e92a93bd8073d5e86ff04f52bd44d946f 100644 --- a/gtests/net/packetdrill/fmemopen.c +++ b/gtests/net/packetdrill/fmemopen.c @@ -25,10 +25,10 @@ #include "types.h" -#include <assert.h> #include <stdio.h> #include <stdlib.h> +#include "assert.h" #include "fmemopen.h" #if !defined(HAVE_FMEMOPEN) diff --git a/gtests/net/packetdrill/header.h b/gtests/net/packetdrill/header.h index e0a3e09aa824c8eb603c4a82a371850527cb96d8..b85deac3082196346f6e054004a00d5f03c9cfd1 100644 --- a/gtests/net/packetdrill/header.h +++ b/gtests/net/packetdrill/header.h @@ -31,8 +31,8 @@ #include "types.h" -#include <assert.h> #include <sys/time.h> +#include "assert.h" #include "gre.h" #include "icmp.h" #include "icmpv6.h" diff --git a/gtests/net/packetdrill/netdev.c b/gtests/net/packetdrill/netdev.c index 3a95ced4989d022ada699306bbf722e64aae5685..ee092a8a8356081bce2abc895b17eb299aa8963d 100644 --- a/gtests/net/packetdrill/netdev.c +++ b/gtests/net/packetdrill/netdev.c @@ -26,7 +26,6 @@ #include "netdev.h" #include <arpa/inet.h> -#include <assert.h> #include <errno.h> #include <fcntl.h> #include <net/if.h> @@ -52,6 +51,7 @@ #include <sys/kern_control.h> #include <sys/kern_event.h> #endif +#include "assert.h" #include "ip.h" #include "ipv6.h" #include "logging.h" diff --git a/gtests/net/packetdrill/open_memstream.c b/gtests/net/packetdrill/open_memstream.c index d3d6e796016f2204f73433abfe88235ac1c26773..9114091aa59d294d928f68829a388bf225555ecc 100644 --- a/gtests/net/packetdrill/open_memstream.c +++ b/gtests/net/packetdrill/open_memstream.c @@ -27,12 +27,12 @@ #ifndef HAVE_OPEN_MEMSTREAM +#include "assert.h" #include "open_memstream.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> -#include <assert.h> /* Our internal state for the memstream. */ struct mem_stream { diff --git a/gtests/net/packetdrill/packet.c b/gtests/net/packetdrill/packet.c index ebaebd5e0fcd06296b30115ae7bb4d8dfa1ed8af..4fcc6b9cccd10b832906a869c7c58d8db07ccdc6 100644 --- a/gtests/net/packetdrill/packet.c +++ b/gtests/net/packetdrill/packet.c @@ -25,9 +25,9 @@ #include "packet.h" -#include <assert.h> #include <stdlib.h> #include <string.h> +#include "assert.h" #include "ethernet.h" #include "gre_packet.h" #include "ip_packet.h" diff --git a/gtests/net/packetdrill/packet.h b/gtests/net/packetdrill/packet.h index eb1ab64c46156d64cb32dc9073aedc2b21ca727c..6a13cd15a7a0355c2104eb61b68374907f33fadd 100644 --- a/gtests/net/packetdrill/packet.h +++ b/gtests/net/packetdrill/packet.h @@ -28,8 +28,8 @@ #include "types.h" -#include <assert.h> #include <sys/time.h> +#include "assert.h" #include "gre.h" #include "header.h" #include "icmp.h" diff --git a/gtests/net/packetdrill/packet_parser.c b/gtests/net/packetdrill/packet_parser.c index f5ac7a5ae80c44559a946afe489bc0caa0fa7f54..1f836e5a872e170ed3a3311dd842b3603445cb5a 100644 --- a/gtests/net/packetdrill/packet_parser.c +++ b/gtests/net/packetdrill/packet_parser.c @@ -25,7 +25,6 @@ #include "packet_parser.h" #include <arpa/inet.h> -#include <assert.h> #include <errno.h> #include <netinet/in.h> #include <stdio.h> @@ -35,6 +34,7 @@ #include <sys/types.h> #include <unistd.h> +#include "assert.h" #include "checksum.h" #include "ethernet.h" #include "gre.h" diff --git a/gtests/net/packetdrill/packet_parser_test.c b/gtests/net/packetdrill/packet_parser_test.c index 46c8fca4cca29432962516d60489febaddf30c38..c65b5f3fba46712bdd1f79825347033734306f2c 100644 --- a/gtests/net/packetdrill/packet_parser_test.c +++ b/gtests/net/packetdrill/packet_parser_test.c @@ -22,10 +22,10 @@ * Test for parsing IP packets. */ +#include "assert.h" #include "ethernet.h" #include "packet_parser.h" -#include <assert.h> #include <stdlib.h> #include <string.h> diff --git a/gtests/net/packetdrill/packet_socket_linux.c b/gtests/net/packetdrill/packet_socket_linux.c index bab7f34555530424498aefd6231f803cf4a7accb..a31873a2f79c855e7fc986695005d266534fe845 100644 --- a/gtests/net/packetdrill/packet_socket_linux.c +++ b/gtests/net/packetdrill/packet_socket_linux.c @@ -24,7 +24,6 @@ #include "packet_socket.h" -#include <assert.h> #include <errno.h> #include <net/if.h> #include <stdlib.h> @@ -38,6 +37,7 @@ #include <netpacket/packet.h> #include <linux/filter.h> +#include "assert.h" #include "ethernet.h" #include "logging.h" diff --git a/gtests/net/packetdrill/packet_socket_pcap.c b/gtests/net/packetdrill/packet_socket_pcap.c index e9ca862234e7989e05545bd9614a1dc5d492e068..cdbba1fc34ac41e26a0a26c74287d14077be03a0 100644 --- a/gtests/net/packetdrill/packet_socket_pcap.c +++ b/gtests/net/packetdrill/packet_socket_pcap.c @@ -24,7 +24,6 @@ #include "packet_socket.h" -#include <assert.h> #include <errno.h> #include <net/if.h> #include <stdlib.h> @@ -41,6 +40,7 @@ #include <pcap.h> #endif +#include "assert.h" #include "ethernet.h" #include "logging.h" diff --git a/gtests/net/packetdrill/packet_to_string_test.c b/gtests/net/packetdrill/packet_to_string_test.c index c40aa0cebddb1d966fb46c368b269072fd28a4be..72605909894798e99ec7fb7d277993bebad81290 100644 --- a/gtests/net/packetdrill/packet_to_string_test.c +++ b/gtests/net/packetdrill/packet_to_string_test.c @@ -24,9 +24,9 @@ #include "packet_to_string.h" -#include <assert.h> #include <stdlib.h> #include <string.h> +#include "assert.h" #include "ethernet.h" #include "packet_parser.h" #include "logging.h" diff --git a/gtests/net/packetdrill/packetdrill.c b/gtests/net/packetdrill/packetdrill.c index 574bf0b4a3edb1f071072fe178ad303ac867f5f2..6450e4b7b2ff05eecc1b969f53d025445bc9cbcf 100644 --- a/gtests/net/packetdrill/packetdrill.c +++ b/gtests/net/packetdrill/packetdrill.c @@ -25,7 +25,6 @@ #include "types.h" #include <arpa/inet.h> -#include <assert.h> #include <getopt.h> #include <pthread.h> #if defined(__FreeBSD__) @@ -34,6 +33,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include "assert.h" #include "config.h" #include "parse.h" #include "run.h" diff --git a/gtests/net/packetdrill/parse.h b/gtests/net/packetdrill/parse.h index 989ebcedad5cb6b71356bece67894d02d28b75f9..3ac8eae5b8768cb7f6104ce3c72559e47a833158 100644 --- a/gtests/net/packetdrill/parse.h +++ b/gtests/net/packetdrill/parse.h @@ -27,7 +27,7 @@ #include "types.h" -#include <assert.h> +#include "assert.h" #include "config.h" #include "script.h" diff --git a/gtests/net/packetdrill/run_system_call.c b/gtests/net/packetdrill/run_system_call.c index f2ed8d2b5e1cd8915d616e4e847a7c30ea4c5e1e..a68be5ae4dee77ff484686f3a71d84c83aa1ea9d 100644 --- a/gtests/net/packetdrill/run_system_call.c +++ b/gtests/net/packetdrill/run_system_call.c @@ -25,7 +25,6 @@ #include "run_system_call.h" #include <arpa/inet.h> -#include <assert.h> #include <errno.h> #include <fcntl.h> #include <limits.h> @@ -63,6 +62,7 @@ #endif #include <time.h> #include <unistd.h> +#include "assert.h" #include "logging.h" #include "run.h" #include "script.h" diff --git a/gtests/net/packetdrill/script.c b/gtests/net/packetdrill/script.c index 3bfc499339310dccda4a14088d69e17a67c5516f..cc82e4b33522602bbf590c29a5a349b5e0d463d6 100644 --- a/gtests/net/packetdrill/script.c +++ b/gtests/net/packetdrill/script.c @@ -24,11 +24,11 @@ #include "script.h" -#include <assert.h> #include <fcntl.h> #include <poll.h> #include <stdlib.h> +#include "assert.h" #include "symbols.h" /* Fill in a value representing the given expression in diff --git a/gtests/net/packetdrill/types.h b/gtests/net/packetdrill/types.h index 8a9808e960718dc7e1538f6865e3b718dfb1ae48..de0ce1956457ef2dcdb5a5f10f2caa5eb3f043ce 100644 --- a/gtests/net/packetdrill/types.h +++ b/gtests/net/packetdrill/types.h @@ -31,7 +31,6 @@ * convention of including types.h first, before everything else. */ #define _GNU_SOURCE /* for asprintf */ -#include <assert.h> #include <limits.h> #include <stdio.h> #include <string.h> @@ -43,6 +42,7 @@ #include <sys/socket.h> #include <sys/time.h> +#include "assert.h" #include "platforms.h" /* We use some unconventional formatting here to avoid checkpatch.pl