mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 03:17:13 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
75 lines
2.3 KiB
Nix
75 lines
2.3 KiB
Nix
import ./make-test-python.nix (
|
|
{ lib, pkgs, ... }:
|
|
{
|
|
name = "bees";
|
|
|
|
nodes.machine =
|
|
{ config, pkgs, ... }:
|
|
{
|
|
boot.initrd.postDeviceCommands = ''
|
|
${pkgs.btrfs-progs}/bin/mkfs.btrfs -f -L aux1 /dev/vdb
|
|
${pkgs.btrfs-progs}/bin/mkfs.btrfs -f -L aux2 /dev/vdc
|
|
'';
|
|
virtualisation.emptyDiskImages = [
|
|
4096
|
|
4096
|
|
];
|
|
virtualisation.fileSystems = {
|
|
"/aux1" = {
|
|
# filesystem configured to be deduplicated
|
|
device = "/dev/disk/by-label/aux1";
|
|
fsType = "btrfs";
|
|
};
|
|
"/aux2" = {
|
|
# filesystem not configured to be deduplicated
|
|
device = "/dev/disk/by-label/aux2";
|
|
fsType = "btrfs";
|
|
};
|
|
};
|
|
services.beesd.filesystems = {
|
|
aux1 = {
|
|
spec = "LABEL=aux1";
|
|
hashTableSizeMB = 16;
|
|
verbosity = "debug";
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript =
|
|
let
|
|
someContentIsShared =
|
|
loc:
|
|
pkgs.writeShellScript "some-content-is-shared" ''
|
|
[[ $(btrfs fi du -s --raw ${lib.escapeShellArg loc}/dedup-me-{1,2} | awk 'BEGIN { count=0; } NR>1 && $3 == 0 { count++ } END { print count }') -eq 0 ]]
|
|
'';
|
|
in
|
|
''
|
|
# shut down the instance started by systemd at boot, so we can test our test procedure
|
|
machine.succeed("systemctl stop beesd@aux1.service")
|
|
|
|
machine.succeed(
|
|
"dd if=/dev/urandom of=/aux1/dedup-me-1 bs=1M count=8",
|
|
"cp --reflink=never /aux1/dedup-me-1 /aux1/dedup-me-2",
|
|
"cp --reflink=never /aux1/* /aux2/",
|
|
"sync",
|
|
)
|
|
machine.fail(
|
|
"${someContentIsShared "/aux1"}",
|
|
"${someContentIsShared "/aux2"}",
|
|
)
|
|
machine.succeed("systemctl start beesd@aux1.service")
|
|
|
|
# assert that "Set Shared" column is nonzero
|
|
machine.wait_until_succeeds(
|
|
"${someContentIsShared "/aux1"}",
|
|
)
|
|
machine.fail("${someContentIsShared "/aux2"}")
|
|
|
|
# assert that 16MB hash table size requested was honored
|
|
machine.succeed(
|
|
"[[ $(stat -c %s /aux1/.beeshome/beeshash.dat) = $(( 16 * 1024 * 1024)) ]]"
|
|
)
|
|
'';
|
|
}
|
|
)
|