Mads Kiilerich <mads@kiilerich.com> [Thu, 23 Mar 2023 16:45:12 +0100] rev 50729
tests: use simple mock smtp server instead of deprecated asyncore smtpd
test-patchbomb-tls.t would fail with:
.../hg/tests/dummysmtpd.py:6: DeprecationWarning: The asyncore module is deprecated and will be removed in Python 3.12. The recommended replacement is asyncio
import asyncore
.../hg/tests/dummysmtpd.py:8: DeprecationWarning: The smtpd module is deprecated and unmaintained and will be removed in Python 3.12. Please see aiosmtpd (https://aiosmtpd.readthedocs.io/) for the recommended replacement.
import smtpd
The recommended migration path to the standalone asiosmtpd would be overkill.
The tests do not need a full smtp server - we can just use a very simple mock
hack to preserve the existing test coverage.
Mads Kiilerich <mads@kiilerich.com> [Mon, 26 Jun 2023 16:45:13 +0200] rev 50728
tests: fix dummysmtpd argument check
Mads Kiilerich <mads@kiilerich.com> [Mon, 26 Jun 2023 15:51:39 +0200] rev 50727
tests: improve test-patchbomb-tls.t by by logging errors and data
The actual SSL error might be like:
::1 ssl error: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:1002)
and will probably vary so much that it can't be checked in the test. It is
however very useful when debugging failures.
Mads Kiilerich <mads@kiilerich.com> [Thu, 23 Mar 2023 16:48:44 +0100] rev 50726
tests: show test-patchbomb-tls.t smtp server log
Improve test coverage by exposing what the smtp server actually receives.
Make dummystmtpd redirect stderr to a log file.
Mads Kiilerich <mads@kiilerich.com> [Wed, 28 Jun 2023 01:31:10 +0200] rev 50725
demandimport: don't delay _distutils_hack import
test-demandimport.py would fail on 'import distutils.msvc9compiler' because
warnings:
/usr/lib/python3.11/site-packages/_distutils_hack/__init__.py:18: UserWarning: Distutils was imported before Setuptools, but importing Setuptools also replaces the `distutils` module in `sys.modules`. This may lead to undesirable behaviors or errors. To avoid these issues, avoid using distutils directly, ensure that setuptools is installed in the traditional way (e.g. not an editable install), and/or make sure that setuptools is always imported before distutils.
warnings.warn(
/usr/lib/python3.11/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
Telling demandimport to ignore this module will allow the hack to work as
intended.
Note:
The test for distutils.msvc9compiler comes from 2205d00b6d2b. But since then,
distutils is going away, and setuptools has moved forward and is replacing it.
It is unclear exactly what is being tested here and how setuptools should
depended on msvc9compiler. The test might no longer be relevant.
Mads Kiilerich <mads@kiilerich.com> [Wed, 22 Mar 2023 16:05:59 +0100] rev 50724
tests: update test-remotefilelog-gc.t for Python 3.11
The test output changed because test coverage changed because normpath changed:
$ python3.10 -c 'import os; print(repr(os.path.normpath("asdas\0das")))'
'asdas\x00das'
$ python3.11 -c 'import os; print(repr(os.path.normpath("asdas\0das")))'
'asdas'
Mads Kiilerich <mads@kiilerich.com> [Mon, 26 Jun 2023 14:54:00 +0200] rev 50723
tests: use grep -F instead of obsolescent fgrep
Testing on Fedora 38 failed with:
fgrep: warning: fgrep is obsolescent; using grep -F
The warning comes from
https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d480e3142fd959bccd1c9372d1
. For further anecdotal evidence of the change, see
https://www.phoronix.com/news/GNU-Grep-3.8-Stop-egrep-fgrep .
grep -F is POSIX, but there is a risk that it doesn't work the same on all
platforms - especially older Unix versions. It should however always be
possible to put a GNU grep in $PATH before running the tests.
Mads Kiilerich <mads@kiilerich.com> [Mon, 26 Jun 2023 14:34:58 +0200] rev 50722
tests: use grep -E instead of obsolescent egrep
Testing on Fedora 38 failed with:
egrep: warning: egrep is obsolescent; using grep -E
The warning comes from
https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d480e3142fd959bccd1c9372d1
. For further anecdotal evidence of the change, see
https://www.phoronix.com/news/GNU-Grep-3.8-Stop-egrep-fgrep .
This reverses the code check that goes back to e7d3b509af8b. grep -E is POSIX,
but there is a risk that it doesn't work the same on all platforms - especially
older Unix versions. It should however always be possible to put a GNU grep in
$PATH before running the tests.
Arseniy Alekseyev <aalekseyev@janestreet.com> [Mon, 26 Jun 2023 11:15:30 +0100] rev 50721
dirstate: avoid leaking disk space in `hg debugrebuilddirstate`
Before this MR running `hg debugrebuilddirstate` simply grows the dirstate
without bound, never shrinking it, because the unused bytes counter stays low,
even though the entirety of the file becomes unused.
Arseniy Alekseyev <aalekseyev@janestreet.com> [Mon, 26 Jun 2023 11:21:43 +0100] rev 50720
dirstate-v2: actually fix the dirstate-v2 upgrade race
It looks like the previous fix for the dirstate-v2 upgrade race didn't work.
The problem is that it only recovers in case the size of the v1 `dirstate` file
is smaller than the `v2` one, whereas in real life it's always larger.
This commit changes the test to be more realistic, which reveals the crash,
and changes the code to fix the crash.