Commit Graph

115 Commits

Author SHA1 Message Date
Mark Thomas
e453f31b7d hghave: remove hasattr test
Summary:
Remove the test for the `search` attribute on the passed-in regexp in
`hghave.matchoutput`.  It's not necessary, and causes new check-code errors.

Reviewed By: quark-zju

Differential Revision: D7098248

fbshipit-source-id: b5f18c0db3cfbb37c9f7e23e2cdfdef9cedd3f49
2018-04-13 21:51:16 -07:00
Adam Simpkins
0e49f78053 help: update the test to exclude eden help
Summary:
Some of our internal hg builds include the Eden extension now.  This was
causing the test-help.t test to fail since it included help output for the Eden
extension, but the test code did not expect this.

We unfortunately cannot update the test output to always expect help output for
Eden since the Eden extension is only included in buck-based builds.

Reviewed By: quark-zju, farnz

Differential Revision: D7063937

fbshipit-source-id: e503ddc6889e546b5333a8d9e3555097d689e24c
2018-04-13 21:51:16 -07:00
Jun Wu
b58ff2f085 tests: run pyflakes tests in buck test
Summary:
Within buck test envirionment there is no guarnatee that `pyflakes` binary is
in `PATH`.  This patch builds pyflakes as a test dependency so buck test will
run `test-check-pyflakes.t` instead of skipping it.

Reviewed By: markbt

Differential Revision: D7008100

fbshipit-source-id: eca6f0174dbc9c12d45eca2f17f70a9805f13094
2018-04-13 21:51:12 -07:00
Jun Wu
f5924da1d3 tests: improve test compatibility with different zlib
Summary:
When running with a Python runtime with a slightly different zlib module,
some `zlib.compress` outputs are different. Some tests are testing the
length, or the content of `zlib.compress` output, directly or indirectly.
That's causing issues.

This patch adds a `common-zlib` hghave test so it can be used to gate tests
checking zlib output. Some lengths are also changed to glob patterns to be
compatible.

Reviewed By: ryanmce

Differential Revision: D6937735

fbshipit-source-id: 2328a39d7f2022f16d51f61b6178568b26dfe2fb
2018-04-13 21:51:09 -07:00
Jun Wu
f9ba760920 lz4: fix "import lz4.block" compatibility with demandimport
Summary:
`import lz4.block` is incompatible with demandimport. Let's use
`from lz4 import block` instead.

Reviewed By: DurhamG

Differential Revision: D6908162

fbshipit-source-id: 37119e21f7b289f89e41ad04fbb7f1ec81181259
2018-04-13 21:51:04 -07:00
Jun Wu
e92a601d9b hghave: add normal-layout feature
Summary:
With `buck build`, the single hg binary won't be guarnateed to have
access to i18n messages because directories like `mercurial/locale`
do not exist on filesystem. It could also mess up with `PYTHONPATH`
somehow because the python binary wrapper sometimes ignores
`PYTHONPATH`.

So let's add a hghave feature for it. And gate troublesome tests
with `#if normal-layout`.

Reviewed By: DurhamG, phillco

Differential Revision: D6879876

fbshipit-source-id: 3d63605b55c8f7096093b89be824add2ec491f81
2018-04-13 21:51:02 -07:00
Jun Wu
cc33c003c2 lz4: import lz4.block
Summary:
`lz4.block` needs to be imported explicitly before being able to
use `lz4.block.compress`.

We didn't notice this because we're using an old version of
`python-lz4`.

Reviewed By: DurhamG

Differential Revision: D6879877

fbshipit-source-id: 37e8fdc00386bef3733753f925ad308f42e5a740
2018-04-13 21:51:01 -07:00
Phil Cohen
e45033bb3c hghave: make the test-repo feature always return True
Summary:
Enables running `check-*` tests from fbsource. This used to check for the existence of a `.hg` folder to detect a repo (so
it can run `hg files`). Internally, we'll always have a repo, and externally we'll likely use git to publish so we'll need another
solution there anyway.

(Note: this ignores all push blocking failures!)

Reviewed By: DurhamG

Differential Revision: D6792787

fbshipit-source-id: 342e29d3a99e82ccd24effb8df02ac6309e80909
2018-04-13 21:50:55 -07:00
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