summaryrefslogtreecommitdiff
path: root/pkgs/applications/networking/cloudflared/tests.nix
blob: c1c081c0a503bca27ff9e7533a91494574cbdb7b (about) (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
60
61
62
{
  version,
  lib,
  stdenv,
  pkgsCross,
  testers,
  cloudflared,
  runCommand,
  wine,
  wine64,
}:

let
  inherit (stdenv) buildPlatform;
in
{
  version = testers.testVersion {
    package = cloudflared;
    command = "cloudflared help";
  };
  refuses-to-autoupdate =
    runCommand "cloudflared-${version}-refuses-to-autoupdate"
      {
        nativeBuildInputs = [ cloudflared ];
      }
      ''
        set -e
        cloudflared update 2>&1 | tee output.txt
        if ! grep "cloudflared was installed by nixpkgs" output.txt
        then
          echo "cloudflared's output didn't contain the package manager name"
          exit 1
        fi
        mkdir $out
      '';
}
// lib.optionalAttrs (buildPlatform.isLinux && (buildPlatform.isi686 || buildPlatform.isx86_64)) {
  runs-through-wine =
    runCommand "cloudflared-${version}-runs-through-wine"
      {
        nativeBuildInputs = [ wine ];
        exe = "${pkgsCross.mingw32.cloudflared}/bin/cloudflared.exe";
      }
      ''
        export HOME="$(mktemp -d)"
        wine $exe help
        mkdir $out
      '';
}
// lib.optionalAttrs (buildPlatform.isLinux && buildPlatform.isx86_64) {
  runs-through-wine64 =
    runCommand "cloudflared-${version}-runs-through-wine64"
      {
        nativeBuildInputs = [ wine64 ];
        exe = "${pkgsCross.mingwW64.cloudflared}/bin/cloudflared.exe";
      }
      ''
        export HOME="$(mktemp -d)"
        wine64 $exe help
        mkdir $out
      '';
}