depot/third_party/nixpkgs/nixos/tests/zram-generator.nix
Default email 4bac34ead1 Project import generated by Copybara.
GitOrigin-RevId: 724bfc0892363087709bd3a5a1666296759154b1
2023-02-09 12:40:11 +01:00

24 lines
659 B
Nix

import ./make-test-python.nix {
name = "zram-generator";
nodes.machine = { ... }: {
zramSwap = {
enable = true;
priority = 10;
algorithm = "lz4";
swapDevices = 2;
memoryPercent = 30;
memoryMax = 10 * 1024 * 1024;
};
};
testScript = ''
machine.wait_for_unit("systemd-zram-setup@zram0.service")
machine.wait_for_unit("systemd-zram-setup@zram1.service")
zram = machine.succeed("zramctl --noheadings --raw")
swap = machine.succeed("swapon --show --noheadings")
for i in range(2):
assert f"/dev/zram{i} lz4 10M" in zram
assert f"/dev/zram{i} partition 10M" in swap
'';
}