Commit Graph

107 Commits

Author SHA1 Message Date
Jun Wu
8a4cb4f683 test-lz4revlog: skip if lz4 module is unavailable
Summary: The test shouldn't run if the dependency (lz4) cannot be imported.

Test Plan:
Run the test on a machine that does not have Python lz4 module installed and
make sure the test gets skipped.

Reviewers: durham, #mercurial

Reviewed By: durham

Subscribers: durham

Differential Revision: https://phabricator.intern.facebook.com/D6678494

Signature: 6678494:1515454247:245401173d9e1ef16ab865c210b1f5412039c1e1
2018-01-08 15:28:27 -08:00
Matt Harbison
f4937719cf hghave: add a check for lfs-test-server
This is consistent with how the other tests require a feature.
2017-11-14 22:35:42 -05:00
Anton Shestakov
034b4b25c1 tests: use jshint when available to check .js files 2017-11-11 15:07:21 +08:00
Augie Fackler
3ea4e52f7c hghave: fix clang-format check to use bytes regex
Fixes hghave on Python 3.

Differential Revision: https://phab.mercurial-scm.org/D1182
2017-10-18 18:29:17 -04:00
Gregory Szorc
35538a441a fsmonitor: warn when fsmonitor could be used
fsmonitor can significantly speed up operations on large working
directories. But fsmonitor isn't enabled by default, so naive users
may not realize there is a potential to make Mercurial faster.

This commit introduces a warning to working directory updates when
fsmonitor could be used.

The following conditions must be met:

* Working directory is previously empty
* New working directory adds >= N files (currently 50,000)
* Running on Linux or MacOS
* fsmonitor not enabled
* Warning not disabled via config override

Because of the empty working directory restriction, most users will
only see this warning during `hg clone` (assuming very few users
actually do an `hg up null`).

The addition of a warning may be considered a BC change. However, clone
has printed warnings before. Until recently, Mercurial printed a warning
with the server's certificate fingerprint when it wasn't explicitly
trusted for example. The warning goes to stderr. So it shouldn't
interfere with scripts parsing meaningful output.

The OS restriction was on the advice of Facebook engineers, who only
feel confident with watchman's stability on the supported platforms.

.. feature::

   Print warning when fsmonitor isn't being used on a large repository

Differential Revision: https://phab.mercurial-scm.org/D894
2017-10-18 22:57:15 +02:00
Saurabh Singh
f7a6f008b9 hghave: disable demandimport when chg is running
Chg disables demandimport on purpose for performance wins and
therefore, it probably makes sense to indicate that demandimport is disabled
when chg is running.

Test Plan:
Ran all the tests.

Differential Revision: https://phab.mercurial-scm.org/D1161
2017-10-17 11:35:58 -07:00
Augie Fackler
e06dbb26d0 hghave: add a check for clang-format
Differential Revision: https://phab.mercurial-scm.org/D1068
2015-09-14 14:16:31 -04:00
Kyle Lippincott
a9ec21ac02 tests: add "have" check for dpkg builddeps
Differential Revision: https://phab.mercurial-scm.org/D879
2017-10-01 05:21:32 -07:00
Kyle Lippincott
8b9d729ef1 hghave: check for debuild being installed as well
Differential Revision: https://phab.mercurial-scm.org/D874
2017-10-01 04:10:01 -07:00
Kyle Lippincott
cfad578e95 hghave: fix dpkg --version check to work on recent dpkg versions
Differential Revision: https://phab.mercurial-scm.org/D869
2017-10-01 03:48:28 -07:00
Rishabh Madan
3c2249874a releasenotes: add import check for fuzzywuzzy
This patch adds the has_fuzzywuzzy for import check of external dependency
fuzzywuzzy.
2017-07-29 14:06:26 +05:30
Yuya Nishihara
f04eb5a8cd tests: drop "absimport" conditionals which should be always true 2017-07-16 17:47:10 +09:00
Sean Farley
cbdeeeebdc hghave: add has_git_range for testing if git understands ext::sh
Even on CentOS 7, git is at version 1.8. It seems git 1.9 is when
ext::sh was introduced so we a check for that. The way these functions
are written follows the same style and format for the way we check svn
and bzr versions.
2017-06-15 17:13:23 -07:00
Matt Harbison
72dbdbc1d5 hghave: enable 'serve' on Windows
I've been using a local hghaveaddon.py to enable this for a couple of months
with reasonable success, and 'killdaemons' is already enabled on Windows.
There's one failure[1] in test-http-proxy.t that this adds, which I can't figure
out.

[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-April/096987.html
2017-05-07 14:58:40 -04:00
Siddharth Agarwal
1d32a76696 hghave: add test for whether fsmonitor is enabled
This uses the HGFSMONITOR_TESTS environment variable that
fsmonitor-run-tests.py adds.
2017-06-10 14:07:31 -07:00
Augie Fackler
3ec7cf5f67 hghave: add check for virtualenv 2017-06-06 11:16:10 -04:00
Kyle Lippincott
9d816ecc30 tests: hint how to run slow tests when rejecting 2017-05-26 14:52:54 -07:00
Martin von Zweigbergk
09d53c160b merge with stable 2017-05-12 11:20:25 -07:00
Pierre-Yves David
970619c327 hghave: prefill more version of Mercurial
The previous code was unable to go above version 4.0.
2017-05-09 15:08:47 +02:00
Gregory Szorc
23a56c76db hghave: remove py27+ capability
It is now unused. And we require Python 2.7+ now so this check is not
necessary.
2017-05-08 15:31:34 -07:00
Bryan O'Sullivan
cb19aa07d3 stdio: add Linux-specific tests for error checking 2017-04-11 14:54:12 -07:00
Yuya Nishihara
91f8f53f3a statfs: make getfstype() raise OSError
It's better for getfstype() function to not suppress an error. Callers can
handle it as necessary. Now "hg debugfsinfo" will report OSError.
2017-03-25 17:25:23 +09:00
Yuya Nishihara
aa4a627b31 hghave: use util.getfstype 2017-03-25 18:22:27 +09:00
Jun Wu
06da2c689d hghave: add a check about whitelisted filesystem that supports hardlink
This is needed for the test added by the next patch.
2017-03-12 00:26:20 -08:00
Pierre-Yves David
a51384137e test: add a basic 'test-check-pylint.t'
We add a minimal check using pylint for one case we knows we care about:
"mutable default" argument.

We'll likely extend this over time to cover other useful checks but this is a
good starting point.
2016-12-28 23:42:50 +01:00
Yuya Nishihara
1d44bd2bbb ui: factor out ui.load() to create a ui without loading configs (API)
This allows us to write doctests depending on a ui object, but not on global
configs.

ui.load() is a class method so we can do wsgiui.load(). All ui() calls but
for doctests are replaced with ui.load(). Some of them could be changed to
not load configs later.
2016-10-22 14:35:10 +09:00
Gregory Szorc
a002443acc hghave: add check for zstd support
Not all configurations will support zstd. Add a check so we can
conditionalize tests.
2016-11-10 23:38:41 -08:00
Yuya Nishihara
6aeed209ab hghave: check darcs version more strictly
test-convert-darcs.t suddenly started failing on my Debian sid machine. The
reason was Darcs was upgraded from 2.12.0 to 2.12.4 so the original pattern
got to match the last two digits. Fix the pattern to match 2.2+.
2016-11-05 13:20:53 +09:00
Yuya Nishihara
26d053eede hghave: fix 'rmcwd' to ensure temporary directory is removed
On platforms where cwd can't be removed, it should try rmdir() after chdir
to the original cwd.
2016-11-01 21:14:33 +09:00
Yuya Nishihara
85c5af29fa tests: run "cwd was removed" test only if cwd can actually be removed
On some platforms, cwd can't be removed. In which case, util.unlinkpath()
continues with no error since the failure of directory removal isn't critical.
So it doesn't make sense to run the test added by 6395630fdfdc on those
platforms. OTOH, we need to run the test in test-rebase-scenario-global.t
since the repository is referenced after that.
2016-10-26 22:50:06 +09:00
Yuya Nishihara
9acdc7a967 hghave: fix has_bzr() to not try to import RevisionSpec as module
Since RevisionSpec isn't a module, "import bzrlib.revisionspec.RevisionSpec"
would always raise ImportError.
2016-09-04 17:19:44 +09:00
Yuya Nishihara
64a2940225 test-gpg: start gpg-agent by gpg-connect-agent only if GnuPG v2.1+ detected
Danek Duvall found that gpg-connect-agent of GnuPG 2.0 never starts gpg-agent
daemon. The 2.1 way is documented as "gpg-coonect-agent /bye" [1], which
appears to be different from the 2.0 way [2].

 [1]: https://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html
 [2]: https://www.gnupg.org/documentation/manuals/gnupg-2.0/Invoking-GPG_002dAGENT.html

Since "gpg-agent --daemon" of GnuPG 2.1 never prints environment variables,
"eval $(gpg-agent --daemon)" would be valid only for GnuPG < 2.1, and we'll
need a different workaround for 2.0. I have no 2.0 environment, I won't
implement it.
2016-08-29 22:59:39 +09:00
timeless
eab7889a37 hghave: add demandimport checking 2016-08-25 22:30:35 +00:00
timeless
1e21e7a9f5 hghave: make bzr checks stricter
My bzr does not have bzrlib.revisionspec.RevisionSpec,
and thus tests were failing because convert refused to believe in bzr,
but hghave without this change thought it was available.
2016-08-25 22:51:39 +00:00
Augie Fackler
51a50cbe97 hghave: add a check for unzip(1) that understands symlinks
unzip(1) from the FreeBSD base system does not understand symlinks, so
test-archive-symlinks is busted.
2016-08-25 01:25:52 -04:00
Yuya Nishihara
41507deea4 py3: have check-py3-compat require pygments to get stable result 2016-08-17 20:52:50 +09:00
Yuya Nishihara
7f925d7d30 test-gpg: start gpg-agent under control of the test runner
GnuPG v2 automatically starts gpg-agent. We should kill the daemon process.
2016-08-14 17:01:33 +09:00
Yuya Nishihara
6e8614df57 hghave: fix typo of sslutil.supportedprotocols 2016-07-19 21:16:44 +09:00
Gregory Szorc
6ba507acfc sslutil: more robustly detect protocol support
The Python ssl module conditionally sets the TLS 1.1 and TLS 1.2
constants depending on whether HAVE_TLSv1_2 is defined. Yes, these
are both tied to the same constant (I would think there would be
separate constants for each version). Perhaps support for TLS 1.1
and 1.2 were added at the same time and the assumption is that
OpenSSL either has neither or both. I don't know.

As part of developing this patch, it was discovered that Apple's
/usr/bin/python2.7 does not support TLS 1.1 and 1.2 (only TLS 1.0)!
On OS X 10.11, Apple Python has the modern ssl module including
SSLContext, but it doesn't appear to negotiate TLS 1.1+ nor does
it expose the constants related to TLS 1.1+. Since this code is
doing more robust feature detection (and not assuming modern ssl
implies TLS 1.1+ support), we now get TLS 1.0 warnings when running
on Apple Python. Hence the test changes.

I'm not super thrilled about shipping a Mercurial that always
whines about TLS 1.0 on OS X. We may want a follow-up patch to
suppress this warning.
2016-07-18 11:27:27 -07:00
Gregory Szorc
3601cf654f hghave: add test for Python 2.7+
Setting ciphers in the ssl module requires Python 2.7. Surprisingly,
we didn't have a test for running on Python 2.7.
2016-07-17 10:50:51 -07:00
Gregory Szorc
73bc04ad9d sslutil: pass ui to _defaultcacerts
We'll use this shortly.
2016-07-01 19:04:39 -07:00
Gregory Szorc
2121e65956 tests: better testing of loaded certificates
Tests were failing on systems like RHEL 7 where loading the system
certificates results in CA certs being reported to Python. We add
a feature that detects when we're able to load *and detect* the
loading of system certificates. We update the tests to cover the
3 scenarios:

1) system CAs are loadable and detected
2) system CAs are loadable but not detected
3) system CAs aren't loadable
2016-07-01 19:27:34 -07:00
timeless
223ed96d6d hghave: matchoutput needs to use bytes for regexp
file output is bytes in py3, so we need each regexp to be bytes
2016-05-05 09:07:01 +00:00
Gregory Szorc
051832cb8b sslutil: move code examining _canloaddefaultcerts out of _defaultcacerts
Before, the return of _defaultcacerts() was 1 of 3 types. This was
difficult to read. Make it return a path or None.

We had to update hghave.py in the same patch because it was also
looking at this internal function. I wasted dozens of minutes
trying to figure out why tests were failing until I found the
code in hghave.py...
2016-05-04 23:38:34 -07:00
Kevin Bullock
5296280949 hghave: remove unused check for bdist_mpkg 2016-04-29 14:14:00 -05:00
Augie Fackler
5b68eb5b4f hghave: add check for OS X packaging tools 2016-04-27 11:45:55 -04:00
Augie Fackler
2f69b1cab6 hghave: add check for bdist_mpkg 2016-04-18 23:55:58 -04:00
Sean Farley
51cd78fbe1 tests: relax pattern matching for newer docker 2016-04-15 14:47:32 -07:00
Yuya Nishihara
87bcd87c28 hghave: add "chg" flag to skip tests that can't be compatible with chg
Several tests fail with chg for several reasons such as loaded chgserver
extension, running uisetup() per server instead of per runcommand, etc.
Since these tests can't/shouldn't be changed to be chg friendly, we need
a flag to skip them.

This patch explicitly drops CHGHG environment if chg isn't involved. This
way, hghave can just check if CHGHG exists.
2016-03-20 14:55:56 -07:00
timeless
80a5c496d9 hghave: add cvsnt
cvsnt is a maintained commercial fork of cvs
https://en.wikipedia.org/wiki/CVSNT

It is possible to build a version of it from sources (github),
it requires libpcre and libltdl (libtool).

We already have a test that relates to cvsnt:
test-convert-cvsnt-mergepoints.t

cvsnt installs: cvs, cvslockd, cvsnt, cvsscript

I think we should definitely have a check for cvsnt because it makes
the version checks for cvs make a lot more sense.

When I use the version I built, cvs --version says:

"""
Concurrent Versions System (CVSNT) 2.5.05 (Gan) Build 3744 (Suite) (client/server)

CVSNT 2.5.05 (Apr  4 2016) Copyright (c) 2008 March Hare Software Ltd.
see http://www.march-hare.com/cvspro


CVS Copyright (c) 1989-2001 Brian Berliner, david d `zoo' zuhn,

Jeff Polk, and other authors
CVSNT Copyright (c) 1999-2008 Tony Hoyle and others
see http://www.cvsnt.org

Commercial support and training provided by March Hare Software Ltd.
see http://www.march-hare.com/cvspro

CVSNT may be copied only under the terms of the GNU General Public License v2,
a copy of which can be found with the CVS distribution.

The CVSNT Application API is licensed under the terms of the
GNU Library (or Lesser) General Public License.

Specify the --help option for further information about CVS
"""
2016-04-04 06:27:12 +00:00