···
1
-
import ./make-test-python.nix (
4
-
manImplementations = [
3
+
manImplementations = [
9
-
machineNames = builtins.map machineSafe manImplementations;
8
+
machineNames = builtins.map machineSafe manImplementations;
11
-
makeConfig = useImpl: {
12
-
# Note: mandoc currently can't index symlinked section directories.
13
-
# So if a man section comes from one package exclusively (e. g.
14
-
# 1p from man-pages-posix and 2 from man-pages), it isn't searchable.
15
-
environment.systemPackages = [
10
+
makeConfig = useImpl: {
11
+
# Note: mandoc currently can't index symlinked section directories.
12
+
# So if a man section comes from one package exclusively (e. g.
13
+
# 1p from man-pages-posix and 2 from man-pages), it isn't searchable.
14
+
environment.systemPackages = [
23
-
nixos.enable = lib.mkForce true;
28
-
generateCaches = true;
30
-
// lib.listToAttrs (
31
-
builtins.map (impl: {
34
-
enable = useImpl == impl;
36
-
}) manImplementations
22
+
nixos.enable = lib.mkForce true;
27
+
generateCaches = true;
29
+
// lib.listToAttrs (
30
+
builtins.map (impl: {
33
+
enable = useImpl == impl;
35
+
}) manImplementations
41
-
machineSafe = builtins.replaceStrings [ "-" ] [ "_" ];
45
-
meta.maintainers = [ lib.maintainers.sternenseemann ];
40
+
machineSafe = builtins.replaceStrings [ "-" ] [ "_" ];
44
+
meta.maintainers = [ lib.maintainers.sternenseemann ];
47
-
nodes = lib.listToAttrs (
49
-
name = machineSafe i;
50
-
value = makeConfig i;
51
-
}) manImplementations
46
+
nodes = lib.listToAttrs (
48
+
name = machineSafe i;
49
+
value = makeConfig i;
50
+
}) manImplementations
59
-
def match_man_k(page, section, haystack):
61
-
Check if the man page {page}({section}) occurs in
62
-
the output of `man -k` given as haystack. Note:
63
-
This is not super reliable, e. g. it can't deal
64
-
with man pages that are in multiple sections.
58
+
def match_man_k(page, section, haystack):
60
+
Check if the man page {page}({section}) occurs in
61
+
the output of `man -k` given as haystack. Note:
62
+
This is not super reliable, e. g. it can't deal
63
+
with man pages that are in multiple sections.
67
-
for line in haystack.split("\n"):
68
-
# man -k can look like this:
71
-
# pagea, pageb (3, 3P) - foo
72
-
# pagea, pageb, pagec(3) - bar
73
-
pages = line.split("(")[0]
74
-
sections = re.search("\\([a-zA-Z1-9, ]+\\)", line)
75
-
if sections is None:
78
-
sections = sections.group(0)[1:-1]
66
+
for line in haystack.split("\n"):
67
+
# man -k can look like this:
70
+
# pagea, pageb (3, 3P) - foo
71
+
# pagea, pageb, pagec(3) - bar
72
+
pages = line.split("(")[0]
73
+
sections = re.search("\\([a-zA-Z1-9, ]+\\)", line)
74
+
if sections is None:
77
+
sections = sections.group(0)[1:-1]
80
-
if page in pages and f'{section}' in sections:
79
+
if page in pages and f'{section}' in sections:
86
-
+ lib.concatMapStrings (machine: ''
87
-
with subtest("Test direct man page lookups in ${machine}"):
89
-
${machine}.succeed("man man > /dev/null")
91
-
${machine}.succeed("man 3 libunwind > /dev/null")
92
-
# NixOS configuration man page is installed
93
-
${machine}.succeed("man configuration.nix > /dev/null")
85
+
+ lib.concatMapStrings (machine: ''
86
+
with subtest("Test direct man page lookups in ${machine}"):
88
+
${machine}.succeed("man man > /dev/null")
90
+
${machine}.succeed("man 3 libunwind > /dev/null")
91
+
# NixOS configuration man page is installed
92
+
${machine}.succeed("man configuration.nix > /dev/null")
95
-
with subtest("Test generateCaches via man -k in ${machine}"):
97
-
("openssl", "ssl", 3),
98
-
("unwind", "libunwind", 3),
99
-
("user", "useradd", 8),
100
-
("user", "userdel", 8),
101
-
("mem", "free", 3),
102
-
("mem", "free", 1),
94
+
with subtest("Test generateCaches via man -k in ${machine}"):
96
+
("openssl", "ssl", 3),
97
+
("unwind", "libunwind", 3),
98
+
("user", "useradd", 8),
99
+
("user", "userdel", 8),
100
+
("mem", "free", 3),
101
+
("mem", "free", 1),
105
-
for (keyword, page, section) in expected:
106
-
matches = ${machine}.succeed(f"man -k {keyword}")
107
-
if not match_man_k(page, section, matches):
108
-
raise Exception(f"{page}({section}) missing in matches: {matches}")
104
+
for (keyword, page, section) in expected:
105
+
matches = ${machine}.succeed(f"man -k {keyword}")
106
+
if not match_man_k(page, section, matches):
107
+
raise Exception(f"{page}({section}) missing in matches: {matches}")