diff options
author | Vincent Haupert <mail@vincent-haupert.de> | 2022-01-18 16:30:21 +0100 |
---|---|---|
committer | Vincent Haupert <mail@vincent-haupert.de> | 2022-01-19 14:06:28 +0100 |
commit | 4351cfa35c8ddc484289858e07625b9ddb1733a8 (patch) | |
tree | 931cf1aa5ce9414733e61815ec93f96593d45a67 | |
parent | c859908cd68d842b6204d9fe6521e911f57e565e (diff) | |
download | nixpkgs-4351cfa35c8ddc484289858e07625b9ddb1733a8.tar nixpkgs-4351cfa35c8ddc484289858e07625b9ddb1733a8.tar.gz nixpkgs-4351cfa35c8ddc484289858e07625b9ddb1733a8.tar.bz2 nixpkgs-4351cfa35c8ddc484289858e07625b9ddb1733a8.tar.lz nixpkgs-4351cfa35c8ddc484289858e07625b9ddb1733a8.tar.xz nixpkgs-4351cfa35c8ddc484289858e07625b9ddb1733a8.tar.zst nixpkgs-4351cfa35c8ddc484289858e07625b9ddb1733a8.zip |
ronn: add test for HTML reproducibility
-rw-r--r-- | pkgs/development/tools/ronn/default.nix | 4 | ||||
-rw-r--r-- | pkgs/development/tools/ronn/test-reproducible-html.nix | 30 |
2 files changed, 33 insertions, 1 deletions
diff --git a/pkgs/development/tools/ronn/default.nix b/pkgs/development/tools/ronn/default.nix index 3569638b218..4d06db77a69 100644 --- a/pkgs/development/tools/ronn/default.nix +++ b/pkgs/development/tools/ronn/default.nix @@ -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/"; diff --git a/pkgs/development/tools/ronn/test-reproducible-html.nix b/pkgs/development/tools/ronn/test-reproducible-html.nix new file mode 100644 index 00000000000..6bc9d6cdbf9 --- /dev/null +++ b/pkgs/development/tools/ronn/test-reproducible-html.nix @@ -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 +'' |