ronn: add test for HTML reproducibility

This commit is contained in:
Vincent Haupert 2022-01-18 16:30:21 +01:00
parent c859908cd6
commit 4351cfa35c
2 changed files with 33 additions and 1 deletions

View file

@ -1,4 +1,4 @@
{ stdenv, lib, bundlerEnv, bundlerUpdateScript, makeWrapper, groff }:
{ stdenv, lib, bundlerEnv, bundlerUpdateScript, makeWrapper, groff, callPackage }:
stdenv.mkDerivation rec {
pname = "ronn";
@ -21,6 +21,8 @@ stdenv.mkDerivation rec {
passthru.updateScript = bundlerUpdateScript "ronn";
passthru.tests.reproducible-html-manpage = callPackage ./test-reproducible-html.nix { };
meta = with lib; {
description = "markdown-based tool for building manpages";
homepage = "https://rtomayko.github.io/ronn/";

View file

@ -0,0 +1,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
''