nixpkgs/nixos/tests/zram-generator.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.1 KiB
Nix
Raw Normal View History

2023-01-18 14:40:42 +00:00
import ./make-test-python.nix {
name = "zram-generator";
nodes = {
single = { ... }: {
virtualisation = {
emptyDiskImages = [ 512 ];
};
zramSwap = {
enable = true;
priority = 10;
algorithm = "lz4";
swapDevices = 1;
memoryPercent = 30;
memoryMax = 10 * 1024 * 1024;
writebackDevice = "/dev/vdb";
};
};
machine = { ... }: {
zramSwap = {
enable = true;
priority = 10;
algorithm = "lz4";
swapDevices = 2;
memoryPercent = 30;
memoryMax = 10 * 1024 * 1024;
};
2023-02-02 03:28:12 +00:00
};
2023-01-18 14:40:42 +00:00
};
testScript = ''
single.wait_for_unit("systemd-zram-setup@zram0.service")
2023-01-18 14:40:42 +00:00
machine.wait_for_unit("systemd-zram-setup@zram0.service")
2023-02-02 03:28:12 +00:00
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
2023-01-18 14:40:42 +00:00
'';
}