tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
bat: move nixos test to installCheckPhase
Mrinal Purohit
4 years ago
f88695d0
47b36ad1
+12
-15
3 changed files
expand all
collapse all
unified
split
nixos
tests
all-tests.nix
bat.nix
pkgs
tools
misc
bat
default.nix
-1
nixos/tests/all-tests.nix
reviewed
···
34
34
avahi-with-resolved = handleTest ./avahi.nix { networkd = true; };
35
35
awscli = handleTest ./awscli.nix { };
36
36
babeld = handleTest ./babeld.nix {};
37
37
-
bat = handleTest ./bat.nix {};
38
37
bazarr = handleTest ./bazarr.nix {};
39
38
bcachefs = handleTestOn ["x86_64-linux"] ./bcachefs.nix {}; # linux-4.18.2018.10.12 is unsupported on aarch64
40
39
beanstalkd = handleTest ./beanstalkd.nix {};
-12
nixos/tests/bat.nix
reviewed
···
1
1
-
import ./make-test-python.nix ({ pkgs, ... }: {
2
2
-
name = "bat";
3
3
-
meta = with pkgs.lib.maintainers; { maintainers = [ nequissimus ]; };
4
4
-
5
5
-
machine = { pkgs, ... }: { environment.systemPackages = [ pkgs.bat ]; };
6
6
-
7
7
-
testScript = ''
8
8
-
machine.succeed("echo 'Foobar\n\n\n42' > /tmp/foo")
9
9
-
assert "Foobar" in machine.succeed("bat -p /tmp/foo")
10
10
-
assert "42" in machine.succeed("bat -p /tmp/foo -r 4:4")
11
11
-
'';
12
12
-
})
+12
-2
pkgs/tools/misc/bat/default.nix
reviewed
···
1
1
{ lib
2
2
, stdenv
3
3
-
, nixosTests
4
3
, rustPlatform
5
4
, fetchFromGitHub
6
5
, pkg-config
···
41
40
42
41
checkFlags = [ "--skip=pager_more" "--skip=pager_most" ];
43
42
44
44
-
passthru.tests = { inherit (nixosTests) bat; };
43
43
+
doInstallCheck = true;
44
44
+
installCheckPhase = ''
45
45
+
runHook preInstallCheck
46
46
+
47
47
+
testFile=$(mktemp /tmp/bat-test.XXXX)
48
48
+
echo -ne 'Foobar\n\n\n42' > $testFile
49
49
+
$out/bin/bat -p $testFile | grep "Foobar"
50
50
+
$out/bin/bat -p $testFile -r 4:4 | grep 42
51
51
+
rm $testFile
52
52
+
53
53
+
runHook postInstallCheck
54
54
+
'';
45
55
46
56
meta = with lib; {
47
57
description = "A cat(1) clone with syntax highlighting and Git integration";