2021-10-17 02:12:59 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, bison, flex, cmake, libpcap }:
|
2020-10-11 12:50:04 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "packetdrill";
|
2020-10-11 12:50:04 +00:00
|
|
|
version = "unstable-2020-08-22";
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "packetdrill";
|
2020-10-11 12:50:04 +00:00
|
|
|
rev = "68a34fa73cf221e5f52d6fa4f203bcd93062be1b";
|
|
|
|
sha256 = "0djkwb6l2959f44d98vwb092rghf0qmii8391vrpxqb99j6pv4h6";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2021-10-17 02:12:59 +00:00
|
|
|
patches = [
|
|
|
|
# Upstream fix for -fno-common toolchains
|
|
|
|
(fetchpatch {
|
|
|
|
name = "fno-common.patch";
|
|
|
|
url = "https://github.com/google/packetdrill/commit/c08292838de81a71ee477d5bf9d95b1130a1292b.patch";
|
|
|
|
sha256 = "1irbar1zkydmgqb12r3xd80dwj2jfxnxayxpb4nmbma8xm7knb10";
|
|
|
|
stripLen = 3;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
setSourceRoot = ''
|
|
|
|
export sourceRoot=$(realpath */gtests/net/packetdrill)
|
|
|
|
'';
|
2020-10-11 12:50:04 +00:00
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [
|
2020-04-24 23:36:52 +00:00
|
|
|
"-Wno-error=unused-result"
|
|
|
|
"-Wno-error=stringop-truncation"
|
|
|
|
"-Wno-error=address-of-packed-member"
|
|
|
|
];
|
2020-10-11 12:50:04 +00:00
|
|
|
nativeBuildInputs = [ bison flex cmake libpcap ];
|
|
|
|
buildInputs = [ libpcap ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -m 0755 -t $out/bin -D \
|
|
|
|
packetdrill \
|
|
|
|
packet_parser_test \
|
|
|
|
packet_to_string_test \
|
|
|
|
checksum_test
|
|
|
|
mkdir -p $out/share
|
|
|
|
cp -r ../tests $out/share/packetdrill-tests
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
description = "Quick, precise tests for entire TCP/UDP/IPv4/IPv6 network stacks";
|
|
|
|
homepage = "https://github.com/google/packetdrill";
|
2024-05-15 15:35:15 +00:00
|
|
|
license = lib.licenses.gpl2Plus;
|
2021-01-15 22:18:51 +00:00
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
maintainers = with lib.maintainers; [ dmjio cleverca22 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|