aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/sandbox/case/default.nix
blob: 9057776b9860027440e89af419a3a69368340b99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
  lib,
  callPackage,
  foot,

  version,
}:
let
  fs = mode: dir: data: {
    mode = lib.fromHexString mode;
    inherit
      dir
      data
      ;
  };

  ent = fsname: dir: type: opts: freq: passno: {
    inherit
      fsname
      dir
      type
      opts
      freq
      passno
      ;
  };

  checkSandbox = callPackage ../. { inherit version; };

  callTestCase =
    path:
    let
      tc = import path {
        inherit
          fs
          ent
          ;
      };
    in
    {
      name = "check-sandbox-${tc.name}";
      verbose = true;
      inherit (tc) tty mapRealUid;
      share = foot;
      packages = [ ];
      command = "${checkSandbox tc.name tc.want} > /dev/console";
      extraPaths = [
        {
          src = "/proc/mounts";
          dst = "/.fortify/mounts";
        }
      ];
    };
in
{
  preset = callTestCase ./preset.nix;
  tty = callTestCase ./tty.nix;
  mapuid = callTestCase ./mapuid.nix;
}