1 import ./make-test-python.nix ({ pkgs, lib, ... }:
3 secret-key = "key-name:/COlMSRbehSh6YSruJWjL+R0JXQUKuPEn96fIb+pLokEJUjcK/2Gv8Ai96D7JGay5gDeUTx5wdpPgNvum9YtwA==";
4 public-key = "key-name:BCVI3Cv9hr/AIveg+yRmsuYA3lE8ecHaT4Db7pvWLcA=";
7 name = "nixseparatedebuginfod";
8 /* A binary cache with debug info and source for nix */
9 nodes.cache = { pkgs, ... }: {
10 services.nix-serve = {
12 secretKeyFile = builtins.toFile "secret-key" secret-key;
15 system.extraDependencies = [
21 /* the machine where we need the debuginfo */
24 ../modules/installer/cd-dvd/channel.nix
26 services.nixseparatedebuginfod.enable = true;
28 substituters = lib.mkForce [ "http://cache:5000" ];
29 trusted-public-keys = [ public-key ];
31 environment.systemPackages = [
34 (pkgs.writeShellScriptBin "wait_for_indexation" ''
36 while debuginfod-find debuginfo /run/current-system/sw/bin/nix |& grep 'File too large'; do
44 cache.wait_for_unit("nix-serve.service")
45 cache.wait_for_open_port(5000)
46 machine.wait_for_unit("nixseparatedebuginfod.service")
47 machine.wait_for_open_port(1949)
49 with subtest("show the config to debug the test"):
50 machine.succeed("nix --extra-experimental-features nix-command show-config |& logger")
51 machine.succeed("cat /etc/nix/nix.conf |& logger")
52 with subtest("check that the binary cache works"):
53 machine.succeed("nix-store -r ${pkgs.sl}")
55 # nixseparatedebuginfod needs .drv to associate executable -> source
56 # on regular systems this would be provided by nixos-rebuild
57 machine.succeed("nix-instantiate '<nixpkgs>' -A nix")
59 machine.succeed("timeout 600 wait_for_indexation")
61 # test debuginfod-find
62 machine.succeed("debuginfod-find debuginfo /run/current-system/sw/bin/nix")
64 # test that gdb can fetch source
65 out = machine.succeed("gdb /run/current-system/sw/bin/nix --batch -x ${builtins.toFile "commands" ''
70 assert 'int main(' in out
72 # test that valgrind can display location information
73 # this relies on the fact that valgrind complains about nix
74 # libgc helps in this regard, and we also ask valgrind to show leak kinds
75 # which are usually false positives.
76 out = machine.succeed("valgrind --leak-check=full --show-leak-kinds=all nix-env --version 2>&1")
78 assert 'main.cc' in out