about summary refs log tree commit diff
path: root/pkgs/development/tools/ronn/test-reproducible-html.nix
blob: 6bc9d6cdbf9fb9f2fe3f088013e90b57b0c3d240 (plain) (blame)
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
{ runCommand
, diffutils
, ronn
}:
runCommand "ronn-test-reproducible-html" { } ''
  set -euo pipefail

  cat > aprog.1.ronn << EOF
  aprog
  =====

  ## AUTHORS

  Vincent Haupert <veehaitch@users.noreply.github.com>
  EOF

  # We have to repeat the manpage generation a few times to be confident
  # it is in fact reproducible.
  for i in {1..20}; do
    ${ronn}/bin/ronn --html --pipe aprog.1.ronn > aprog.1.html-1
    ${ronn}/bin/ronn --html --pipe aprog.1.ronn > aprog.1.html-2

    ${diffutils}/bin/diff -q aprog.1.html-1 aprog.1.html-2 \
      || (printf 'The HTML manpage is not reproducible (round %d)' "$i" && exit 1)
  done

  echo 'The HTML manpage appears reproducible'

  mkdir $out
''