Commit Graph

77 Commits

Author SHA1 Message Date
Jun Wu
3ff054bf77 traceback: support collapsing traceback in tests
Summary:
The traceback output involves file paths and line numbers that are annoying to
be kept in test output. Collapse them in test so we can actually test traceback
related changes.

Reviewed By: DurhamG

Differential Revision: D32772631

fbshipit-source-id: c03495d01954fde59d46e44dced747f9e89db1ac
2021-12-06 11:42:16 -08:00
Alex Hornby
331120460c update python to 3.8
Summary:
Update to a newer python that builds on macOS Big Sur, make eden_scm depend on it and use it from PATH

python 3.8 requires libffi which is reference via its pkg-config setup,  however python's pkg-config libffi detection is broken (https://bugs.python.org/issue34823) with the documented workaround requiring an environment variable to be passed into its ./configure step, which is why this change also adds a feature to AutoconfBuilder

With the updated python in place I was able to remove disable_env_override_pkgconfig = 1
disable_env_override_path = 1 from the eden_scm config so that it actually uses the pkg-configs, PATHs and other settings from its dependencies. This should make future python and other dependency upgrades much simpler.

Reviewed By: HarveyHunt

Differential Revision: D32231261

fbshipit-source-id: a2b6addbe22f38e3d71618c802d2c6f836fdd86c
2021-11-26 00:02:45 -08:00
Jun Wu
eea8f86862 run-tests: bump default timeout
Summary:
`test-cross-repo-commit-validator.t` seems to take longer to run with the next
change. Bump the timeout to make it pass.

Reviewed By: markbt

Differential Revision: D31148285

fbshipit-source-id: 2c815d988b323eb08cf06256ee666130eeebf9a6
2021-09-24 10:58:35 -07:00
Robert Grosse
acc7a511d3 Refactor matching optional lines in run-tests.py
Summary:
Move optional line handling logic into a separate function and simplify.

This diff is intended to be a pure refactoring with no observable changes in behavior. In particular, all the code dealing with the "optional" list appears to be dead code because if the line is optional, linematch will return "retry", so that branch is never reachable.

Reviewed By: DurhamG

Differential Revision: D30849757

fbshipit-source-id: 17283f9217466b3f85d913da66222b9a6779abe4
2021-09-15 17:47:22 -07:00
Robert Grosse
ad2731099b Remove checkcodeglobpats from test runner
Summary:
I'm not sure what this was for, but it doesn't seem necessary, and removing it simplifies the code a lot, enabling us to make other improvements later.

This is an alternate, less ambitious version of https://www.internalfb.com/diff/D30620443.

Reviewed By: DurhamG

Differential Revision: D30674016

fbshipit-source-id: 17dee50b82c78d31e45492dc23826d8c3fe838e5
2021-09-07 11:43:18 -07:00
Jun Wu
0ec8d15512 run-tests: ignore tracing log related env vars
Summary: Those env vars might affect tests. Reset them in tests.

Reviewed By: andll

Differential Revision: D30314056

fbshipit-source-id: 2cedbe41a332fea582e8ad7577b9d5eaae79c015
2021-08-16 12:51:04 -07:00
Durham Goode
1183f14f11 treemanifest: disable flatcompat by default
Summary:
This was a hack to allow the tests to produce the same hashes as
before. Let's disable this and fix the remaining test failures. A future diff
will remove the feature entirely.

Where possible I changed input hashes to desc() and output hashes to globs so
hopefully future hash changes are a little easier.

Differential Revision: D29567762

fbshipit-source-id: cf5150c112c56b08f583feba80e5a636cc07db0a
2021-07-13 15:04:57 -07:00
CodemodService Bot
8cddb36cf2 Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D28957848

fbshipit-source-id: 80ce3c197a09bc924a8920aedb7c7fb093760dd3
2021-06-08 03:55:06 -07:00
Durham Goode
40f304d428 run-tests: more Python 3 fixes
Summary:
More things needing fixing to be python 3 compatible. Caught when
trying to remove the Python 2 build.

Reviewed By: quark-zju

Differential Revision: D28880028

fbshipit-source-id: d162c78237f330f1f931c3581b25ead24e3ea375
2021-06-07 16:46:18 -07:00
Durham Goode
ffa6c61481 run-tests: fix allow/deny list of tests with multiple cases
Summary:
The recent change to make run-tests work with Python 3 broke the
allow/deny list functionality because it started testing the full test name
instead of the base. This fixes that.

Reviewed By: quark-zju

Differential Revision: D28885125

fbshipit-source-id: 586a71e66e0f094b79e6a3e07e27813db6f662d3
2021-06-03 15:54:03 -07:00
Jun Wu
13ab29ce76 runtests: fix remaining issues
Summary:
Fix remaining issues like encoding and `bname` vs `name` difference
(bname was deleted by a previous change, but it's not just encoding
difference from name, bname does not have " (case x)" suffix).

Differential Revision: D28852092

fbshipit-source-id: df013b284414600deb6f20a5c0883f09906bf976
2021-06-02 16:08:06 -07:00
Durham Goode
a2410c8783 tests: fix more run-tests.py Python 3 issues
Summary: These are breaking buck test runs

Reviewed By: quark-zju

Differential Revision: D28802741

fbshipit-source-id: a30c7b64d72356df05676ffab87291a246033d49
2021-06-01 11:43:09 -07:00
Durham Goode
38be9c8f05 tests: fix run-tests.py diff output with Python 3
Summary:
The migration to Python 3 broke the unified diff code because difflib
expected the paths to also be bytes.

Reviewed By: quark-zju

Differential Revision: D28758876

fbshipit-source-id: 367ef237594d2908377cd8b81def364b77ee02e2
2021-05-27 14:10:07 -07:00
Durham Goode
92b4a86bf4 runtests: stop using bytes for paths and environment variables
Summary:
The usage of bytes for paths and environment variables makes this entire file hacky and makes it not work on Windows.  Let's remove all of that.

We still use bytes for test output and other file content type cases.

Reviewed By: andll

Differential Revision: D28227825

fbshipit-source-id: b15993601db501160c9fa4eb2463678cde1fa554
2021-05-27 09:52:16 -07:00
Jun Wu
2cf4957de0 runtests: expand $TESTTMP in hgrc
Summary:
This makes it easier to use `--keep` to investigate tests by using
`--configfile`.

Reviewed By: kulshrax

Differential Revision: D27971122

fbshipit-source-id: 8adcbeab825155858499c24ca74c2979049adeda
2021-05-05 17:53:39 -07:00
Jun Wu
60e240b17e eagerepo: fix Windows compatibility
Summary: Windows path like `eagerepo:///C:\foo\bar` needs special handling.

Reviewed By: kulshrax

Differential Revision: D27971119

fbshipit-source-id: 9d4b87782eca2734b708565f0ee22a7495253cff
2021-05-05 12:01:50 -07:00
Jun Wu
dcb7775096 changelog: remove Python zstore support
Summary:
The zstore for commit messages are now handled by Rust entirely. There is no
need to keep the Python zstore around, except for migration and doctor
use-cases.

Reviewed By: andll

Differential Revision: D27897893

fbshipit-source-id: 21b10596af28c45425f6f102fd13f0421d1e8373
2021-04-21 19:30:15 -07:00
Durham Goode
f0f6a38fbe dynamicconfig: backout D26801059 that enabled no-repo configs
Summary: This seems to have broken the EdenFS HgPrefetch test.

Reviewed By: xavierd

Differential Revision: D27795192

fbshipit-source-id: 80a748036961aa6a5750182bf65637fb76825341
2021-04-15 09:00:19 -07:00
Durham Goode
4803877dde dynamicconfig: generate dynamicconfigs when there's no repo
Summary:
Previously we'd skip dynamicconfigs when there wasn't a repo available.
Now that dynamicconfig can represent the NoRepo state, let's load dynamicconfigs
in that situation.

This also supports the case where there is no user name.

Reviewed By: kulshrax

Differential Revision: D26801059

fbshipit-source-id: 377cfffb6695a7fbe31303868a88862259ebf8c4
2021-04-14 14:32:16 -07:00
Carolyn Busch
86996ffa9f tests: Remove errno.WSAEACCES
Summary: WSAEACCES is included in Windows only. Only check it if the os is windows.

Reviewed By: quark-zju

Differential Revision: D27434606

fbshipit-source-id: 25eb8036363b42629fbd010f7637a404dccff236
2021-03-30 11:20:56 -07:00
Durham Goode
945a516c74 py3: fix tests on Windows
Summary: This fixes various tests on Windows. Many of these fixes were ported from upstream.

Reviewed By: markbt

Differential Revision: D27174617

fbshipit-source-id: b9f36ad0714793f2b76db32c1d840284b744a841
2021-03-29 12:56:48 -07:00
Durham Goode
752c5ccff5 tests: remove test environment when running system hg
Summary:
dynamicconfig has logic to avoid loading remote configs during tests,
by checking the TESTTMP variable. Unfortunately, the tests currently run system
hg with that environment set, which causes it to generate incorrect
configuration for the real repository (i.e. fbsource).

Let's get rid of all test specific environment variables when running the system
hg. There's a comment in the code saying this breaks some tests (from 2017
03a31be593db), but as far as I can see they still work.

Reviewed By: quark-zju

Differential Revision: D26758364

fbshipit-source-id: 945cbd36f7eccc98149772a42421cbc51b157c5b
2021-03-02 12:53:57 -08:00
generatedunixname89002005287564
cb2cc4ddb1 Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D26686094

fbshipit-source-id: e382675ff1c32f63467d464bce28f54024af35b9
2021-02-26 03:57:20 -08:00
Durham Goode
5ad8e5d836 py3: fix Windows tests
Summary:
Windows tests were failing to execute hg clone ssh://user@dummy/... lines because setconfig ui.ssh=C:/foo/bar was being translated to ui.ssh=c;c:\\foo\\bar by mingw, since it detected /foo/bar as a unix-style path. This seems to be caused by this one line reversing the slashes. I'm not sure why it exists, but deleting it makes the tests pass.

My guess is this has been broken for about a year.

Reviewed By: quark-zju

Differential Revision: D26639206

fbshipit-source-id: d89cae1ea3dd055b90ec6ee8f7cdbee2ae08b228
2021-02-25 09:59:55 -08:00
generatedunixname89002005287564
dafcfcd0bf Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D26660579

fbshipit-source-id: 2a6f2ff37e6509a59f4927ad5dfa2a84f3d4dc15
2021-02-25 04:29:50 -08:00
Jun Wu
62ba7447f6 ui: switch to Rust IO for default fout, ferr
Summary:
The Rust IO handles progress and streampager stuff. Switch to it so we don't
need to changing the `fout`, `ferr` when handling streampager in Python.

The chgserver logic is updated to just set raw fd 0, 1, 2 to update stdio,
since `fileno` is no longer exposed from Rust.

Manually tested the following commands, both without chg and with chg:
- lhg log -r . (no pager)
- lhg log (with streampager)
- lhg log --config pager.pager=less (with less pager)
- lhg commit (spawns pager)
- lhg debugprogress -s 100 --sleep 100 --with-output --pager=off (progress in stderr)
- lhg debugprogress -s 100 --sleep 100 --with-output --pager=on --config pager.interface=fullscreen (progress in streampager)
- lhg debugprogress -s 100 --sleep 100 --with-output --pager=on --config pager.pager='LESS= less' (progress is disabled with external pager)

Reviewed By: sfilipco

Differential Revision: D26612487

fbshipit-source-id: 8b4e36b614a0c080b93e41474f9a8fc33f890083
2021-02-23 22:33:48 -08:00
Genevieve Helsel
f2d6906665 fix dictionary changed size during iteration in run_tests.py
Summary:
We shouldn't delete from a dictionary while iterating over it, instead we should iterate over a copy and then delete from the original.
`.keys()` returns a view of the dict, while wrapping it in `list` makes a deep copy.

Reviewed By: StanislavGlebik

Differential Revision: D26618782

fbshipit-source-id: 234503aab0a0a2151ae0818282651b547f414016
2021-02-23 16:55:07 -08:00
Jun Wu
358466ee0f transaction: record transaction name to metalog
Summary:
For `repo.transaction("tr-name")`, this records `Transaction: tr-name` to
metalog commit description.

It can be helpful to narrow things down for commands with multiple
transactions.

In the future we might want to attach more data to the logging (ex. what the
commit cloud local, remote states at the time of syncing). However I didn't
do it now since metalog is designed to hold repository data, not too much
logging data. With a better logging infra we might want to move `config` out
from metalog, associated with metalog root ids.

Reviewed By: DurhamG

Differential Revision: D25984805

fbshipit-source-id: 59c074272cff555c6ff11dd755f7e3ce9a292eb6
2021-01-29 12:36:08 -08:00
Jan Mazur
d1b291d72a flush stream to always print out interactive prompt
Summary: Suddenly prompt stopped appearing for me. Flush the stream to be sure that it's printed out.

Reviewed By: HarveyHunt

Differential Revision: D25956018

fbshipit-source-id: 83419037fa6ce672e203385b71f1403a738d0c90
2021-01-22 07:46:11 -08:00
Jun Wu
78005ae5a5 py3: fix test-run-tests.py
Summary:
When running `python3 run-tests.py test-run-tests.py`, some bytes were printed
with `b` prefix.  Convert them to `str`.

Reviewed By: DurhamG

Differential Revision: D25642164

fbshipit-source-id: f1103b24ad88d0d024f6be546bf632141f06ebd1
2020-12-18 10:38:19 -08:00
Durham Goode
cfd7ccc828 configs: add Python support for allowed_locations list
Summary:
configs.allowedlocations restricts what configs can be loaded to a
certain set of files. This will enable us to deprecate all old config locations.

This diff adds Python support and a high level test.

Reviewed By: quark-zju

Differential Revision: D25539736

fbshipit-source-id: fa2544379b65672227e0d9cf08dad7016d6bbac8
2020-12-17 06:37:54 -08:00
John Reese
d13e0b137f apply pyfmt with usort to opted-in sources
Reviewed By: zertosh

Differential Revision: D24880203

fbshipit-source-id: 2034cdfc2712209e86d3d05c119c58f979b05c52
2020-11-10 21:25:54 -08:00
Jun Wu
9bf6b674a6 config: use Rust graph render as default
Summary: Change the legacy Python graph render to Rust renderer.

Reviewed By: DurhamG

Differential Revision: D24317802

fbshipit-source-id: 4c3dc3a6dd02b7ebe79596a8e77f4b6b139d2e20
2020-10-19 17:07:30 -07:00
Lukas Piatkowski
715351d576 mononoke/integration tests: fix test-clienttelemetry.t by disabling features
Summary:
The logic inside `eden/scm/tests/features.py` script enables certain
features of HG on tests based on the name of the test. Mononoke's integration
tests suit reuses eden/scm's tests suit and as a consequence it triggers the
same `features.py` logic. It was fine until D24201934 (f5988c415c) introduced a feature for
test that is named in the same way as one of the Mononoke tests - the
`test-clienttelemetry.t`.

In order to fix this problem Mononoke will pass a `--nofeatures` flag to the
`eden/scm/run-tests.py` invocations that will turn off the usage of
`features.py`.

Reviewed By: farnz

Differential Revision: D24276294

fbshipit-source-id: eb28ed55a05de3b012e37407603c2370adaaad16
2020-10-13 05:28:27 -07:00
Jun Wu
8dc618b1cd runtests: set tracing level before running tests
Summary:
With the new tracing-core (0.1.10 ->  0.1.16), it's no longer effective
to set EDENSCM_TRACE_LEVEL to more verbose within the test.
Let's set it in run-tests.py which spawns the test process instead.

Reviewed By: kulshrax

Differential Revision: D24004327

fbshipit-source-id: db2cadc7334eb59b25a1e0517e3d1a513e31e0fe
2020-09-29 21:19:20 -07:00
Durham Goode
c80cdf1f49 treemanifest: enable treemanifest.useruststore=True for most tests
Summary:
The remaining test failures are mostly around bundle support, which
I'll fix in a later diff.

Reviewed By: quark-zju

Differential Revision: D23664037

fbshipit-source-id: 2bdde3cb4fcded6e0cf3afdc23269662544821df
2020-09-24 09:46:59 -07:00
Durham Goode
2f5130c882 py3: fix extdiff
Summary:
extdiff uses shutil.rmtree which calls os.rmdir with new python 3
options. Since we pathc os.rmdir, we need to support those options.

Reviewed By: quark-zju

Differential Revision: D23350968

fbshipit-source-id: 081d179dcd67b51ffdeb6b85899adf4e574a8d0f
2020-08-27 19:15:22 -07:00
Mark Thomas
44b7724014 run-tests: add internal:none editor
Summary: Rather than using a Python program, simulate having no editor during tests using `internal:none`.

Reviewed By: quark-zju, ikostia

Differential Revision: D23152446

fbshipit-source-id: 5560f58885ee5959c62f0ac8bcf0483b9c3072f6
2020-08-19 00:32:19 -07:00
Lukas Piatkowski
e78c6d58c3 mononoke/integration tests: use C locale by default (#41)
Summary:
Pull Request resolved: https://github.com/facebookexperimental/eden/pull/41

As of D22098359 (7f1588131b) the default locale used by integration tests is en_US.UTF-8, but as the comment in code mentiones:
```
The en_US.UTF-8 locale doesn't behave the same on all systems and trying to run
commands like "sed" or "tr" on non-utf8 data will result in "Illegal byte
sequence" error.
That is why we are forcing the "C" locale.
```

Additionally I've changed the test-walker-throttle.t test to use "/bin/date" directly. Previously it was using "/usr/bin/date", but the "/bin/date" is a more standard path as it works on MacOS.

Reviewed By: krallin

Differential Revision: D22865007

fbshipit-source-id: afd1346e1753df84bcfc4cf88651813c06933f79
2020-07-31 09:02:33 -07:00
Jun Wu
7c87f1259a tests: stop enabling zstore-commit-data
Summary:
The zstore-commit-data code paths are in Python. We want to move them to behind
the Rust HgCommits abstractions. So stop making Python interact with the
low-level details.

Reviewed By: DurhamG

Differential Revision: D22638457

fbshipit-source-id: 435db8425a29ce4eae24a6202ad928f85a5f5ee2
2020-07-30 20:32:33 -07:00
Durham Goode
065db9681c py3: fix test-merge-tools.t
Summary: It now passes

Reviewed By: quark-zju

Differential Revision: D22652124

fbshipit-source-id: 145ef33507ce1cf774a22841c1809a068720a80b
2020-07-22 19:00:41 -07:00
Jun Wu
0562c1220f tests: enable template-new-builtin
Summary: This makes tests depend less on revision numbers.

Reviewed By: DurhamG

Differential Revision: D22468669

fbshipit-source-id: 74a06930faa3e6ee9d246ecc718c2a3740f57a54
2020-07-20 17:27:53 -07:00
Jun Wu
473b07c328 tests: add a way to fix revision number usages automatically in tests
Summary:
Some tests use too many revision numbers (ex. test-rebase-scenario-global.t).
It's time consuming to fix it manually. Write a script to help with that.

This will be used by the next diff.

Reviewed By: DurhamG

Differential Revision: D22174956

fbshipit-source-id: a873ad326ecbd9cdfa2df58839b0ef21626e1506
2020-07-02 13:22:30 -07:00
Jun Wu
b2ce9d0ef8 run-tests: do not wait for the progress thread
Summary:
Sometimes `Ctrl+C` the test runner does not fully stop it. From gdb it seems
the test runner is waiting for a thread which might have deadlocked. The
progress thread does not have anything critical that need to sync back to
the main program. Avoid waiting for it to make Ctrl+C work better.

Reviewed By: kulshrax

Differential Revision: D22290453

fbshipit-source-id: bdc5260cbd339cc392728834330609343c0048d3
2020-06-29 18:45:41 -07:00
Durham Goode
d02d5cdbfe py3: fix test-fsmonitor*
Summary: These now pass

Reviewed By: quark-zju

Differential Revision: D22127383

fbshipit-source-id: bcaad400d9f849251e396b68ad1b4d04c8831314
2020-06-19 13:40:18 -07:00
Durham Goode
7f1588131b py3: set LANG="en_US.UTF-8" for most tests
Summary:
We support unicode file paths, and in python 3 those get passed to
python libraries as unicode strings. The tests set LANG=C which mean the python
library tries to convert the path to ascii, but fails for any non-ascii
characters. Let's switch to LANG="en_US.UTF-8" to match our production
behavior and make tests about unicode paths work.

Reviewed By: xavierd

Differential Revision: D22098359

fbshipit-source-id: c3057edc66e6e32f7b8b49374e622d02bd05711f
2020-06-19 13:40:17 -07:00
Jun Wu
6584ad18f6 run-tests: add a way to record $TESTTMP changes in source control
Summary:
Add a `--record` flag, which uses `git` to track changes in `$TESTTMP`.
I use it to track changes with C revlog vs the Rust revlog.

Reviewed By: farnz

Differential Revision: D22007501

fbshipit-source-id: a8027aa4b2b3b97c3cf5f642434451826fcbded9
2020-06-15 14:41:52 -07:00
Jun Wu
5344951764 tests: turn on mutation, disable obsstore for tests
Summary:
Incompatible tests are blacklisted.

The affects non-tests environment: `proxy-obsstore` is turned on.
That is in theory not very different from having an empty obsstore.
If it becomes an issue we can easily turn it off.

Reviewed By: sfilipco

Differential Revision: D21899139

fbshipit-source-id: e4a87ecced0542e7852b48b1a807775e523b3cc9
2020-06-10 19:30:01 -07:00
Jun Wu
19326b3489 run-tests: make output format friendly for adhoc scripts
Summary:
I found myself friendly editing the output of run-tests.py:

  Failed test-failure.t: output changed
  Failed test-failure-unicode.t: output changed

to extract file names:

  test-failure-unicode.t
  test-failure.t

Then use the file names as parameters to other commands, like `run-tests.py`
again, or `hg revert`, or `hg shelve`.

Change the output format to print the filenames directly to make it easier to
use.

Reviewed By: sfilipco

Differential Revision: D21913609

fbshipit-source-id: 4b1d2265f384ad9afbe478b7ff0d6e543eff00df
2020-06-10 19:29:59 -07:00
Durham Goode
9473b487b5 tests: enable treemanifest for ~100 more tests
Summary:
Enables treemanifest for about 100 more tests. To make them pass I had
to expose the gettreepack capability from peers, which just works, and enable
treeonly and sendtrees by default in the tests, which I probably should've done
before anyway.

Reviewed By: quark-zju

Differential Revision: D21894955

fbshipit-source-id: 7a6a4d453824fb8c81a797a5487bf2ecc2b67761
2020-06-10 19:29:48 -07:00