Merge pull request #154021 from lukegb/mercurialfull
mercurial: move tests to passthru.tests
This commit is contained in:
commit
bf2930306f
@ -7,6 +7,7 @@
|
||||
, highlightSupport ? fullBuild
|
||||
, ApplicationServices
|
||||
# test dependencies
|
||||
, runCommand
|
||||
, unzip
|
||||
, which
|
||||
, sqlite
|
||||
@ -39,15 +40,6 @@ let
|
||||
} else null;
|
||||
cargoRoot = if rustSupport then "rust" else null;
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs .
|
||||
|
||||
for f in **/*.{py,c,t}; do
|
||||
# not only used in shebangs
|
||||
substituteAllInPlace "$f" '/bin/sh' '${stdenv.shell}'
|
||||
done
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = lib.optional re2Support fb-re2
|
||||
++ lib.optional gitSupport pygit2
|
||||
++ lib.optional highlightSupport pygments;
|
||||
@ -63,31 +55,6 @@ let
|
||||
makeFlags = [ "PREFIX=$(out)" ]
|
||||
++ lib.optional rustSupport "PURE=--rust";
|
||||
|
||||
doCheck = stdenv.isLinux; # tests seem unstable on Darwin
|
||||
checkInputs = [
|
||||
unzip
|
||||
which
|
||||
sqlite
|
||||
git
|
||||
gnupg
|
||||
];
|
||||
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; # needed for git
|
||||
checkPhase = ''
|
||||
cat << EOF > tests/blacklists/nix
|
||||
# tests enforcing "/usr/bin/env" shebangs, which are patched for nix
|
||||
test-run-tests.t
|
||||
test-check-shbang.t
|
||||
|
||||
# unstable experimental/unsupported features
|
||||
# https://bz.mercurial-scm.org/show_bug.cgi?id=6633#c1
|
||||
test-git-interop.t
|
||||
EOF
|
||||
|
||||
# extended timeout necessary for tests to pass on the busy CI workers
|
||||
export HGTESTFLAGS="--blacklist blacklists/nix --timeout 1800"
|
||||
make check
|
||||
'';
|
||||
|
||||
postInstall = (lib.optionalString guiSupport ''
|
||||
mkdir -p $out/etc/mercurial
|
||||
cp contrib/hgk $out/bin
|
||||
@ -115,7 +82,9 @@ let
|
||||
--zsh contrib/zsh_completion
|
||||
'';
|
||||
|
||||
passthru.tests = {};
|
||||
passthru.tests = {
|
||||
mercurial-tests = makeTests { flags = "--with-hg=$MERCURIAL_BASE/bin/hg"; };
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "A fast, lightweight SCM system for very large distributed projects";
|
||||
@ -127,6 +96,67 @@ let
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
};
|
||||
|
||||
makeTests = { mercurial ? self, nameSuffix ? "", flags ? "" }: runCommand "${mercurial.pname}${nameSuffix}-tests" {
|
||||
inherit (mercurial) src;
|
||||
|
||||
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; # needed for git
|
||||
MERCURIAL_BASE = mercurial;
|
||||
nativeBuildInputs = [
|
||||
python
|
||||
unzip
|
||||
which
|
||||
sqlite
|
||||
git
|
||||
gnupg
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs .
|
||||
|
||||
for f in **/*.{py,c,t}; do
|
||||
# not only used in shebangs
|
||||
substituteAllInPlace "$f" '/bin/sh' '${stdenv.shell}'
|
||||
done
|
||||
|
||||
for f in **/*.t; do
|
||||
substituteInPlace 2>/dev/null "$f" \
|
||||
--replace '*/hg:' '*/*hg*:' \${/* paths emitted by our wrapped hg look like ..hg-wrapped-wrapped */""}
|
||||
--replace '"$PYTHON" "$BINDIR"/hg' '"$BINDIR"/hg' ${/* 'hg' is a wrapper; don't run using python directly */""}
|
||||
done
|
||||
'';
|
||||
|
||||
# This runs Mercurial _a lot_ of times.
|
||||
requiredSystemFeatures = [ "big-parallel" ];
|
||||
|
||||
# Don't run tests if not-Linux or if cross-compiling.
|
||||
meta.broken = !stdenv.hostPlatform.isLinux || stdenv.buildPlatform != stdenv.hostPlatform;
|
||||
} ''
|
||||
addToSearchPathWithCustomDelimiter : PYTHONPATH "${mercurial}/${python.sitePackages}"
|
||||
|
||||
unpackPhase
|
||||
cd "$sourceRoot"
|
||||
patchPhase
|
||||
|
||||
cat << EOF > tests/blacklists/nix
|
||||
# tests enforcing "/usr/bin/env" shebangs, which are patched for nix
|
||||
test-run-tests.t
|
||||
test-check-shbang.t
|
||||
|
||||
# unstable experimental/unsupported features
|
||||
# https://bz.mercurial-scm.org/show_bug.cgi?id=6633#c1
|
||||
test-git-interop.t
|
||||
|
||||
# doesn't like the extra setlocale warnings emitted by our bash wrappers
|
||||
test-locale.t
|
||||
EOF
|
||||
|
||||
export HGTEST_REAL_HG="${mercurial}/bin/hg"
|
||||
# extended timeout necessary for tests to pass on the busy CI workers
|
||||
export HGTESTFLAGS="--blacklist blacklists/nix --timeout 1800 -j$NIX_BUILD_CORES ${flags}"
|
||||
make check
|
||||
touch $out
|
||||
'';
|
||||
in
|
||||
self.overridePythonAttrs (origAttrs: {
|
||||
passthru = origAttrs.passthru // rec {
|
||||
|
Loading…
Reference in New Issue
Block a user