diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 723b030072e1..5f4aefad890f 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -138,6 +138,7 @@ in { borgbackup = handleTest ./borgbackup.nix {}; botamusique = handleTest ./botamusique.nix {}; bpf = handleTestOn ["x86_64-linux" "aarch64-linux"] ./bpf.nix {}; + bpftune = handleTest ./bpftune.nix {}; breitbandmessung = handleTest ./breitbandmessung.nix {}; brscan5 = handleTest ./brscan5.nix {}; btrbk = handleTest ./btrbk.nix {}; diff --git a/nixos/tests/bpftune.nix b/nixos/tests/bpftune.nix new file mode 100644 index 000000000000..63fcfc8b8199 --- /dev/null +++ b/nixos/tests/bpftune.nix @@ -0,0 +1,37 @@ +import ./make-test-python.nix ({ lib, pkgs, ... }: { + + name = "bpftune"; + + meta = { + maintainers = with lib.maintainers; [ nickcao ]; + }; + + nodes = { + client = { pkgs, ... }: { + services.bpftune.enable = true; + + boot.kernel.sysctl."net.ipv4.tcp_rmem" = "4096 131072 1310720"; + + environment.systemPackages = [ pkgs.iperf3 ]; + }; + + server = { ... }: { + services.iperf3 = { + enable = true; + openFirewall = true; + }; + }; + }; + + testScript = '' + with subtest("bpftune startup"): + client.wait_for_unit("bpftune.service") + client.wait_for_console_text("bpftune works fully") + + with subtest("bpftune tcp buffer size"): + server.wait_for_unit("iperf3.service") + client.succeed("iperf3 --reverse -c server") + client.wait_for_console_text("need to increase TCP buffer size") + ''; + +}) diff --git a/pkgs/os-specific/linux/bpftune/default.nix b/pkgs/os-specific/linux/bpftune/default.nix index 09d5f4756191..089aee11fb3f 100644 --- a/pkgs/os-specific/linux/bpftune/default.nix +++ b/pkgs/os-specific/linux/bpftune/default.nix @@ -7,6 +7,7 @@ , libbpf , libcap , libnl +, nixosTests }: stdenv.mkDerivation rec { @@ -55,6 +56,10 @@ stdenv.mkDerivation rec { "stackprotector" ]; + passthru.tests = { + inherit (nixosTests) bpftune; + }; + meta = with lib; { description = "BPF-based auto-tuning of Linux system parameters"; homepage = "https://github.com/oracle-samples/bpftune";