Commit Graph

59 Commits

Author SHA1 Message Date
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
Yuya Nishihara
bd8b8c2e65 hghave: replace relative import of docutils.core 2016-04-03 19:47:29 +09:00
timeless
f5cd960a9a hghave: add hg06..hg39
hg output varies by version, this helps the hgbook

hg 0.6 did not have a version command, so special case it...
hg 0.7-0.8 had a version command which returned unknown...
hg 0.8 added a --date flag to annotate
hg 0.9 had a working version command!
2016-04-01 13:20:47 +00:00
timeless
6d4cf8d156 hghave: use checkvers for bzr114 2016-04-01 13:19:29 +00:00
timeless
620c0a80fe hghave: replace has_svn13/has_svn15 with checkvers
This would make it possible to easily add a svn14 or svn16 or...
2016-04-01 13:04:41 +00:00
timeless
048ac3436b hghave: add checkvers function 2016-04-01 13:04:16 +00:00
timeless
054ef1ce74 hghave: add docstring for check 2016-04-04 02:17:36 +00:00
timeless
940756392c hghave: update cvs112 description
Classic cvs stopped at 1.11.
There was a beta version 1.12 that never had a final release.
CVS NT is a fork which starts with versions numbered 2.0+.

We should have an hg have cvsnt, but to test that requires getting
cvsnt, and it's commercial / its older source versions are
hard to find.
2016-04-01 13:19:58 +00:00
Gregory Szorc
0bbaa7c0a3 hghave: change ssl check to just check ssl module
Previously, the "ssl" check effectively looked for PyOpenSSL
or Python 2.7.9. After this patch, we simply look for just the
"ssl" module.

After b93c7184b1ea, there have been no references to PyOpenSSL in
the tree (the previous usage of PyOpenSSL was to implement ssl
support on old, no longer supported Python versions that didn't
have an ssl module (e.g. Python 2.4). So, the check for PyOpenSSL
served no purpose.

Pythons we support ship with the ssl module. Although it may not be
available in all installations. So, we still need the check for
whether the ssl module imports, hence the hghave check.

The main side-effect of this change is that we now run test-https.t
(the only test requiring the "ssl" hghave feature) on Python <2.7.9
when PyOpenSSL is not installed (which is probably most installations)
and the ssl module is available. Before, we wouldn't run this test
on these older Python versions.

I confirmed that test-https.t passes with Python 2.6.9 and 2.7.8 on
OS X 10.11.
2016-03-19 13:51:00 -07:00
Gregory Szorc
464bf4c7e9 run-tests: add --with-python3 to define a Python 3 interpreter
Currently, very few parts of Mercurial run under Python 3, notably the
test harness.

We want to write tests that run Python 3. For example, we want to
extend test-check-py3-compat.t to parse and load Python files.
However, we have a problem: finding appropriate files requires
running `hg files` and this requires Python 2 until `hg` works
with Python 3.

As a temporary workaround, we add --with-python3 to the test harness
to allow us to define the path to a Python 3 interpreter. This
interpreter is made available to the test environment via $PYTHON3 so
tests can run things with Python 3 while the test harness and `hg`
invocations continue to run from Python 2. To round out the feature,
a "py3exe" hghave check has been added.
2016-03-18 16:17:56 -07:00
timeless
dd989dbe5f hghave: improve description of Hypothesis 2016-03-08 14:32:03 +00:00
Yuya Nishihara
ad2de493a5 tests: load json with no fallback
The json module should be available in Python 2.6 or newer.
2016-01-09 13:20:15 +09:00
timeless
16cc66dbc7 hghave: support HGMODULEPOLICY for pure
HGMODULEPOLICY was introduced in 78e8dae3a240
2016-01-11 23:13:34 +00:00
Gregory Szorc
dd5b65b197 tests: use absolute_import in hghave.py 2015-12-06 22:27:18 -08:00
timeless
9b03525e5c hghave.py: fix matchoutput documentation 2015-11-24 22:31:56 +00:00
timeless
90609ddfb2 hghave.py: remove execute bit 2015-11-24 22:26:43 +00:00
David R. MacIver
ffbcb6c497 testing: add hypothesis fuzz testing
Hypothesis a library for adding fuzzing over a range of structure
data to your test suite: http://hypothesis.readthedocs.org/en/latest/

This adds the ability to build tests using Hypothesis within the Mercurial test
suite. New tests and fixes using this helpers comes in later changesets.
2015-10-24 12:46:03 +01:00
Augie Fackler
48d9b40177 hghave: correct test for debhelper
debhelper exits with a nonzero status when you pass --help, at least
on jessie.
2015-08-31 22:43:33 -04:00
Augie Fackler
3ef1c74897 hghave: use subprocess instead of os.popen
os.popen was deprecated in Python 2.6 in favor of subprocess, so let's
move into the future.
2015-08-31 22:44:20 -04:00
Augie Fackler
a638241af1 hghave: add a check for docker support
This currently refuses to operate if on a non-Linux host. I suspect
that Docker running on FreeBSD 11 or on an Illumos derivative would
work fine, but I don't have ready access to such a system.

On OS X using boot2docker (I used a hacky xhyve-based one for
testing), it won't work because $TESTTEMP doesn't end up inside the
set of directories that get forwarded to the boot2docker VM, so you
can't actually drop debs in the $TESTTEMP at all. It would be possible
(probably even trivial) to hack around this by using a randomly-named
temporary directory inside the working directory, but that seems
unlikely to be useful enough to justify the ugliness.
2015-08-25 00:06:41 -04:00
Augie Fackler
424fcf4978 hghave: add a check for debian packaging tools 2015-08-25 00:03:15 -04:00
Augie Fackler
cd6222a983 run-tests: add support for marking tests as very slow
I want to add tests for our packaging rules, but those necessarily run
a whole build, or possibly two if both native packaging and docker are
available. This lets us flag such tests with a `#require slow` so that
they don't unnecessarily slow down normal test runs.
2015-08-24 22:23:45 -04:00
Gregory Szorc
0b8074fef5 hghave: remove quiet option
The --quiet flag appears to be unused. Kill it.
2015-08-22 10:37:38 -07:00
Gregory Szorc
c7aeb97f0b hghave: move feature checking into hghave.py
Upcoming patches will kill hghave (the script - not hghave.py) and
will move to a model where requirements checking is performed as
a function call.

Start diminishing the utility of hghave by moving some code to
hghave.py.
2015-08-22 10:28:34 -07:00
Yuya Nishihara
d7d0977d82 tests: disable test of buffer overflow in parsers.c if --pure
It fails with AttributeError and there's no benefit to make it runnable
with pure Python code.
2015-07-19 15:27:28 +09:00
Gregory Szorc
3aa1c73868 global: mass rewrite to use modern octal syntax
Python 2.6 introduced a new octal syntax: "0oXXX", replacing "0XXX". The
old syntax is not recognized in Python 3 and will result in a parse
error.

Mass rewrite all instances of the old octal syntax to the new syntax.

This patch was generated by `2to3 -f numliterals -w -n .` and the diff
was selectively recorded to exclude changes to "<N>l" syntax conversion,
which will be handled separately.
2015-06-23 22:30:33 -07:00
Yuya Nishihara
b87e06a760 test-https: test basic functions of client certificate authentication
Because hgweb doesn't support client certificates, I just patched it to
require client certificates that are signed and verified by the server
certificate. This won't be ideal for production servers, but should be okay
for the test.

The encrypted key file will be used by future patches. I couldn't figure out
a way to redirect a password prompt provided by OpenSSL, so it isn't tested
for now.
2015-05-07 17:38:22 +09:00
Gilles Moris
0226ba418b test-http: drop compatibility check on Python >= 2.4.3
This is obsolete now that Python < 2.6 is no more supported.
This is thus a backout of fce95ba9c79d.
2015-05-15 10:24:59 +02:00
Matt Mackall
9065a1f3fb hghave: use try/except/finally 2015-05-15 10:29:39 -05:00
Yuya Nishihara
29fb442439 ssl: set explicit symbol "!" to web.cacerts to disable SSL verification (BC)
The next patch will enable verification by using the system's CA store if
possible, which means we would have to distinguish None (=use default) from
'' (=--insecure). This smells bug-prone and provides no way to override
web.cacerts to forcibly use the system's store by --config argument.

This patch changes the meaning of web.cacerts as follows:

  value   behavior
  ------- ---------------------------------------
  None/'' use default
  '!'     never use CA certs (set by --insecure)
  <path>  verify by the specified CA certificates

Values other than <path> are for internal use and therefore undocumented.
2015-03-04 23:27:04 +09:00
Yuya Nishihara
6b95472c9c test-https: enable dummycert test only if Apple python is used (issue4500)
The dummycert trick works only if Python is linked to Apple's patched OpenSSL.
2015-03-04 22:41:48 +09:00
Augie Fackler
39d629927d hghave: we now support Python 2.7.9's ssl for https 2015-01-13 15:08:55 -05:00
Augie Fackler
c2e4fc2371 hghave: use a less brittle have-json check 2014-11-10 13:27:25 -05:00
Yuya Nishihara
0baf7a676d cmdserver: add service that listens on unix domain socket and forks process
Typical use case of 'unix' mode is a background hg daemon.

    $ hg serve --cmdserver unix --cwd / -a /tmp/hg-`id -u`.sock

Unlike 'pipe' mode in which parent process keeps stdio channel, 'unix' server
can be detached.  So clients can freely connect and disconnect from server,
saving Python start-up time.

It might be better to write "--cmdserver socket -a unix:/sockpath" instead
of "--cmdserver unix -a /sockpath" in case hgweb gets the ability to listen
on unix domain socket.
2014-10-04 16:46:50 +09:00
Pierre-Yves David
65dc6712bd test: protect the run-tests.py --json test behind an hghave rule
We add a rules to detect availability of a json module and skip if json is not
available.
2014-09-18 11:43:47 -07:00
Mads Kiilerich
69f5c2ecc6 ssl: on OS X, use a dummy cert to trick Python/OpenSSL to use system CA certs
This will give PKI-secure behaviour out of the box, without any configuration.

Setting web.cacerts to any value or empty will disable this trick.

This dummy cert trick only works on OS X 10.6+, but 10.5 had Python 2.5 which
didn't have certificate validation at all.
2014-09-26 02:19:48 +02:00
Mads Kiilerich
5d1360e0ed cleanup: make sure we always access members of imported modules
This will make sure we get import errors, even if demandimport is enabled.

This will also mute some pyflakes 'imported but unused' warnings.
2014-08-15 04:37:45 +02:00
Matt Mackall
74cb506481 tests: use a decorator for hghave checks 2014-08-11 09:35:24 -05:00
Matt Mackall
36234f5a00 tests: add repository check for pyflakes test
If this test was run from a tarball with no Mercurial repository, it
would fail because 'hg manifest' didn't work.
2014-05-01 09:42:23 -05:00
Matt Mackall
eb09e501b5 tests: fix unused imports from inotify removal caught by pyflakes 2014-03-04 09:56:59 -06:00
Matt Mackall
66c8bd54e8 extensions: remove the inotify extension (BC)
This extension has always had correctness issues and has been
unmaintained for years. It is now removed in favor of the third-party
hgwatchman which is maintained and appears to be correct.

Users with inotify enabled in their config files will fall back to
standard status performance.
2014-03-01 16:20:15 -06:00
Mads Kiilerich
59b97fe104 tests: ignore http tests that are known wontfix failures on python 2.4
As mentioned on http://bz.selenic.com/show_bug.cgi?id=2739#c17 , babf177f9036
left test-http.t failing on Python < 2.4.3. That has not been noticed because
most 2.4 testing has been done with a patched 2.4.2.

This makes sure that the tests only are run for Python >= 2.4.3. That makes it
possible to verify that everything else works with Python 2.4.
2014-02-05 01:37:37 +01:00
Mads Kiilerich
5be7383671 tests: 'hghave tic' also requires curses support in Python
test-status-color.t would fail when using a Python without curses.
2014-01-20 01:29:54 +01:00
Simon Heimberg
2f030231df tests: fix hghave root on windows
This lets tests\test-hghave.t pass on windows where geteuid does not exist.
2013-11-23 01:06:20 +01:00
Matt Mackall
280eec0087 tests: skip tests that require not having root (issue4089)
This adds a new root hghave to test against. Almost all of these are a
subset of unix-permissions, but that is also used for checking exec
bit handling.
2013-11-14 18:07:43 -06:00
FUJIWARA Katsunori
aa64a2119a hghave: add "py3k" feature to check whether test runs with Python 3.x
This patch adds "py3k" feature to check whether test runs with Python
3.x.

This check is needed for portability of test code: for example, in the
default, modules are imported relatively first with python 2.x, but
imported absolutely with Python 3.x.
2013-10-05 01:02:22 +09:00
FUJIWARA Katsunori
c46519c9ab hghave: add "absimport" feature to check "absolute_import" in __future__
This patch adds "absimport" feature to check whether "absolute_import"
exists in __future__, which means supporting module loading by
absolute name.

This check is needed for portability of test code using
"absolute_import", because Python earlier than 2.5 doesn't support it.
2013-10-05 01:02:22 +09:00
Simon Heimberg
6059e06d0f cleanup: drop unused variables and an unused import 2013-07-01 20:48:56 +02:00
Jim Hague
3d040369cd tests: AIX can't handle negative date in test-dirstate.t
test-dirstate.t fails on AIX in the absurd date test. AIX touch errors on
any date prior to 1970. AIX mktime() gives an error on such dates, so the
problem is deeper than touch and attempts to work around touch in Python
failed.

Give up. Add an AIX test to hghave and skip the absurd date test on AIX.
2013-04-30 14:56:33 +01:00