Commit Graph

73525 Commits

Author SHA1 Message Date
Jun Wu
3a49ee9296 testing: expose the 'f' utility
Summary:
The 'f' utility is used in a couple of tests.
Provide it in hg test environment.

Reviewed By: DurhamG

Differential Revision: D34835699

fbshipit-source-id: 8de65f653fccf3717ab5c0d9a45dee6936bb645d
2022-04-22 19:21:32 -07:00
Jun Wu
8df6b9120d tests: pyfmt the 'f' utility
Summary: pyfmt it so changes can be formatted too.

Reviewed By: DurhamG

Differential Revision: D34835691

fbshipit-source-id: 97e31c5e0b514ec6651cb8e670473535db2a6802
2022-04-22 19:21:32 -07:00
Jun Wu
f6a556ee7b test-mutation-infinitepush: disable with debugruntest
Summary:
For some reason, the `hg up tip` triggers a ssh server and hangs
if run by debugruntest. Let's skip it with debugruntest for now.

Reviewed By: DurhamG

Differential Revision: D34835690

fbshipit-source-id: 18b3c2a875f825022a0f4c1d3d36bc947a196721
2022-04-22 19:21:32 -07:00
Jun Wu
48d37319c6 set HGEXECUTABLEPATH in tests
Summary:
This is used by hg to decide the path to the "hg" binary. Without this, `hg`
will just use `argv[0]` for its binary path, which is okay if `hg` installed
but problematic when running tests where the hg binary is `hg.sh` that has
extra logic before `exec`-ing the `hg_rust` binary.

In theory we could also use `HG_REAL_BIN` but that's a telemetry wrapper
concept not existed in stock hg.

This fixes the `HgPrefetch.test` because D34835693 (f42faf1c64) made it run `util.hgcmd()`
directly - without `HGEXECUTABLEPATH`, it runs the `hg_rust` without
`PYTHONPATH` set and crash.

Reviewed By: chadaustin

Differential Revision: D35860447

fbshipit-source-id: 9abbd64327c50ef351ff05f99bbf1da3f8740332
2022-04-22 19:19:56 -07:00
Jun Wu
7bd47bf1e0 test-amend-userstack: avoid "\*" in glob patterns
Summary: This makes it pass with debugruntest.

Reviewed By: DurhamG

Differential Revision: D34835686

fbshipit-source-id: 4f0c087fdfe9e3464412ecf5be5556b40f67da8b
2022-04-22 19:18:56 -07:00
Jun Wu
88b76e2263 testing: add tee to shell builtin
Summary: `tee` is used by some tests. Implement it.

Reviewed By: DurhamG

Differential Revision: D34790217

fbshipit-source-id: 7f62bde41da5520c158889ac09b659f7e7b47ba5
2022-04-22 19:18:56 -07:00
Jun Wu
25bcb70342 testing: make autofix preserve glob lines
Summary:
One of the problem of autofix is it rewrites "(glob)" lines with non-glob
version. Let's try to make it smarter to preserve the "(glob)" lines.

Reviewed By: DurhamG

Differential Revision: D34790206

fbshipit-source-id: 0bb14f8569a55393165c8fe579f09d43aa98f0bc
2022-04-22 19:18:56 -07:00
Jun Wu
fc8d7c56c0 test-paths: with => With
Summary:
"with foo:" is valid Python code. Use "With" to make it a comment.
This makes the test pass with debugruntest.

Reviewed By: DurhamG

Differential Revision: D34790214

fbshipit-source-id: cab47466af306731d23476c6562eaf743d990781
2022-04-22 19:18:56 -07:00
Jun Wu
d749ea574b test-committer: drop unused 2>&1
Summary: This makes it run under debugruntest.

Reviewed By: DurhamG

Differential Revision: D34790203

fbshipit-source-id: 034995f0c36bf0ef014d83a2d215819b8792752c
2022-04-22 19:18:56 -07:00
Jun Wu
4a9ca94170 testing: add sh to shell builtin
Summary:
`sh foobar.sh` is commonly used in tests as HGEDITOR or something. Implement
it.

Reviewed By: DurhamG

Differential Revision: D34790210

fbshipit-source-id: 5a16e6ddde7c9943330aa7f2ab894409977e5bb9
2022-04-22 19:18:56 -07:00
Jun Wu
33c92ec637 testing: add find to shell builtin
Summary: `find` seems commonly used. Implement a subset used in tests.

Reviewed By: DurhamG

Differential Revision: D34790204

fbshipit-source-id: cc3dda137d981ab1969b833bd45ce7d4ed2f7a58
2022-04-22 19:18:56 -07:00
Jun Wu
71ea6ed7fd testing: add sort to shell builtin
Summary: `sort` seems commonly used too. Implement it.

Reviewed By: DurhamG

Differential Revision: D34790205

fbshipit-source-id: 21c5d009348bec14ea2ee0821ba83c1749bd7afc
2022-04-22 19:18:56 -07:00
Jun Wu
ad8f9bb3cd debugruntest: support stdlib doctest
Summary:
Python stdlib doctest is conceptually similar to what debugruntest
does - run code, check output. By adopting it in debugruntest,
we get the handy autofix feature for free, which is very handy
for files like `testing/t/transform.py`.

The Python doctest requires a Python module as the "starting point".
`doctest:<module name>` is added as a special syntax to indicate
this is a doctest.

A special case is added for edenscm/ source code. Python files will
automatically turn into doctest for convenience.

Reviewed By: DurhamG

Differential Revision: D34725126

fbshipit-source-id: 91b78505708ad930f7688cc3e51e53a94d9030e9
2022-04-22 19:18:56 -07:00
Jun Wu
f9383a79a1 test-amend-to: avoid 'echo -e'
Summary:
'echo -e' is only used in this test. Avoiding it makes it pass with the new
test runner.

Reviewed By: DurhamG

Differential Revision: D34790211

fbshipit-source-id: 065853ea953a41294fe631cd0e1d77f64f2c9f05
2022-04-22 19:18:56 -07:00
Jun Wu
48d1fc75ec codemod: replace $TESTDIR/seq.py with seq
Summary:
From https://www.mercurial-scm.org/repo/hg/rev/f554f89a2038 it seems
the `seq.py` is for OS X <= 10.10 compatibility. We don't care about
such old systems so let's just use the standard seq. This also improves
test performance and compatibility with the new Python .t runner.

Reviewed By: DurhamG

Differential Revision: D34790216

fbshipit-source-id: 38dcc8d671773725784c9f774c0a6f8fc2239b46
2022-04-22 19:18:56 -07:00
Jun Wu
e966676ab1 tests: mark test-progressfile* as incompatible with new .t runner
Summary:
`syncrender()` hangs forever with the new test runner.
I haven't figured out why. Let's just mark them as incompatible for now.

Reviewed By: DurhamG

Differential Revision: D34790209

fbshipit-source-id: 306b8da8512d8f86e98b21546774b118a2240632
2022-04-22 19:18:56 -07:00
Jun Wu
ab9029c6bc hghave: add debugruntest feature
Summary:
This allows tests to have parts that are incompatible with one of the
test runners.

Reviewed By: DurhamG

Differential Revision: D34725125

fbshipit-source-id: c2639e059011276a160c1c141ae1c3dccc65bd8e
2022-04-22 19:18:56 -07:00
Xavier Deguillard
c427d4618a inodes: remove check for EDEN_HAVE_HIVE_LOGGER
Summary:
When this is not defined, the IHiveLogger passed to the constructor will be
initialized with the NullHiveLogger, thus we can use it to initialize the
FsEventLogger.

Reviewed By: genevievehelsel

Differential Revision: D35855147

fbshipit-source-id: 8a58934327ec866c94c6aa0dbe114dd86af382f4
2022-04-22 18:46:09 -07:00
Xavier Deguillard
1091be0a63 integration: add the streaming get_thrift_client
Summary:
This will be used to validate the behavior of the streamChangesSince API in
integration tests.

Reviewed By: chadaustin

Differential Revision: D35817806

fbshipit-source-id: 42ee1936c0d7ee4f1574642fa11870b7fa7bdb6c
2022-04-22 18:22:42 -07:00
Xavier Deguillard
d4c8c764ac integration: rename get_thrift_client to get_thrift_client_legacy
Summary:
This makes it consistent with the naming in the CLI, and will allow introducing
a get_thrift_client for streaming APIs.

Reviewed By: genevievehelsel

Differential Revision: D35767106

fbshipit-source-id: deb45090875b0366111e16e27abba22858b8f370
2022-04-22 18:22:42 -07:00
Xavier Deguillard
341684d8cc service: use folly::CancellationToken for diff cancellation
Summary:
We were previously using some internal Thrift datastructure to see if the
connection had been closed. Let's instead use a folly::CancelletionToken to
decouple ourself from Thrift in core EdenFS. This also allows use to test more
easily that cancellation works as intended, and to remove the need to override
the async_tm_ Thrift handlers.

Reviewed By: chadaustin

Differential Revision: D35663202

fbshipit-source-id: a9dbbdcd6cfc1694912b9d72dada443f0338a434
2022-04-22 18:22:42 -07:00
Xavier Deguillard
2319160852 store: remove servicerouter dependency from HgBackingStore
Summary:
It appears to be completely unused, and thus we do not need it. We still depend
on servicerouter via the backinstore crate (due to memcache), so this change
alone doesn't provide any benefits.

Reviewed By: fanzeyi

Differential Revision: D35853731

fbshipit-source-id: 2d815a75430a5742dc647855370b0f594b34f05a
2022-04-22 16:15:15 -07:00
Zeyi (Rice) Fan
0c2400bdd2 cli_rs: let eden status report health info
Summary:
The Rust edenfsctl status didn't know to report about EdenFS server status. This diff fixes that.

This way our user should be able to tell EdenFS is not doing anything but busy starting in the background.

Reviewed By: xavierd

Differential Revision: D35797156

fbshipit-source-id: 4f10073e382b8d9c4deb09690e16530e57ee70fd
2022-04-22 15:21:15 -07:00
Michael Cuevas
91b6afcfd1 Back out "eden/{integration, fs, facebook}: switch to platform010"
Reviewed By: chadaustin

Differential Revision: D35850816

fbshipit-source-id: 282c06fbf7cc249030ae0173779722175c662133
2022-04-22 14:52:01 -07:00
Carolyn Busch
7e3c3f35ac clone: override --config options
Summary: Currently configs passed in by --config get overwritten in the repo init dynamic config generation, though they should take top precedence. Add option to repo init to override configs after dynamic config generation. Move --config flag parsing logic from dispatch to ConfigSet, so it can be reused by the clone command.

Differential Revision: D35796863

fbshipit-source-id: 994fa5eaba8442504605f069b17b984fe92b6c54
2022-04-22 13:08:33 -07:00
Carolyn Busch
6676d5edbb clidispatch: add command template with global opts
Summary: The clone command needs the configfile and config options from the global command options in order for the configs to not be overwritten by dynamicconfig generation. Add a command template that makes the global options available and use them in the clone command.

Differential Revision: D35796075

fbshipit-source-id: 57ee261dfd37db3bc0d07c3e6f91694bd76ca3c7
2022-04-22 13:08:33 -07:00
Jun Wu
652f10e1ab test-doctest: limit testing tests to linux
Summary:
They are having issues on MacOS and Windows (test-doctest.t was blocklisted on
Windows).

Reviewed By: DurhamG

Differential Revision: D35851397

fbshipit-source-id: 4bbef1a581e9b1958b7dc32d7949630a3afb3571
2022-04-22 10:50:43 -07:00
Xavier Deguillard
dd8532a175 integration: increase pexpect_spawn timeout
Summary:
The restart tests have started failing recently due to various timeouts. The
root cause is well understood to be caused by an increase in the dependency
graph of EdenFS. Let's increase the timeout while we figure out a way to
decrease the dependencies.

Reviewed By: genevievehelsel

Differential Revision: D35829901

fbshipit-source-id: d7e03ea68308b9eb36e3584d3c073b41378a78de
2022-04-22 10:46:34 -07:00
Yan Soares Couto
72ea20ab37 Abstract DM id from ChangesetPathHistoryContext
Summary:
**Context:** I want to allow config changes to decide between DMv1 and v2, so I need to make usages more generic.

This diff makes it so `ChangesetPathHistoryContext` doesn't actually store any deleted manifest ids, and instead work with futures that resolve directly to the linknodes.

This makes it easier for us to use this class with DMv2, without need wrapper types around ids.

This also makes things slightly faster on repeated calls, as it caches the whole linknode, not just the id to then load the linknode from.

Reviewed By: mitrandir77

Differential Revision: D35779796

fbshipit-source-id: def93a62974cdfe02fd5e40c1c29ec49274c91ce
2022-04-22 08:36:07 -07:00
Simon Farnsworth
df060bde58 Prevent history cycles in mutable renames
Summary:
Making blame work in the presence of history cycles is non-trivial to get right, and my efforts have led to repeated infinite loops in SCS.

Simply banning cyclic history removes the problem - for now, use an approximation to get it right quickly, and make the problem go away.

Note that the test tests for cases that could be made to work - I hope that this is sufficient that code review will catch badly thought through efforts to make the check precise.

Reviewed By: yancouto

Differential Revision: D35810936

fbshipit-source-id: 19f5f3221d36e6c4270748495dd7de6d45e61ff8
2022-04-22 06:33:27 -07:00
CodemodService Bot
72d9754f6c Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: krallin

Differential Revision: D35839834

fbshipit-source-id: 82de4f272b87aabf1a325bf833024fa03e068f26
2022-04-22 04:23:28 -07:00
Jan Mazur
4ddee98a7c specify git commit or branch that will be merged into repo explicitly
Summary: This now merges given commit, but moves bookmark in the destination repo almost arbitrarily. The bookmark move is used primarily so other tools of ours like tailers (and phabricator) process commits slowly ini batches.

Reviewed By: mitrandir77

Differential Revision: D35600879

fbshipit-source-id: a618006ebf14df413449acf0e8f5aabb11ade3ee
2022-04-22 01:35:36 -07:00
Pyre Bot Jr
3ce6503853 suppress errors in eden
Differential Revision: D35832325

fbshipit-source-id: 4d21bb784deec80880bbc304daa5bd120548a58f
2022-04-21 22:18:44 -07:00
Durham Goode
e0080a1169 testlib: add basic working copy checkout support
Summary: Allows wc.checkout(...)

Differential Revision: D35686069

fbshipit-source-id: 9e28a89d8b5ffd0371a988c171718090e57a1ab6
2022-04-21 19:06:14 -07:00
Durham Goode
6094d6ddd1 testlib: add basic status support
Summary: Adds functions for getting the working copy status and commit status.

Differential Revision: D35685522

fbshipit-source-id: a4527b7e3254e0c755b0c2d62c1d2f9c6596ea88
2022-04-21 19:06:14 -07:00
Durham Goode
51a527b7b3 testlib: adds drawdag support
Summary: Adds a drawdag function for easily creating a repository.

Differential Revision: D35683763

fbshipit-source-id: 23d9faa28b4519b13bca07a029169043bc84eece
2022-04-21 19:06:14 -07:00
Durham Goode
d3df270dff testlib: add basic bookmark read functionality
Summary: Adds simple functions for reading the bookmark state from a repository.

Differential Revision: D35683767

fbshipit-source-id: c95ea25002e9ed95c35cb4ee8b57898198ae8d3f
2022-04-21 19:06:14 -07:00
Durham Goode
075ee791f5 testlib: add basic commit functionality
Summary:
Adds the ability for the working copy to make a commit, and a basic
Commit abstraction for accesing commit data.

Differential Revision: D35683765

fbshipit-source-id: f2ae6ebe8f03c98f40869a537fe2f191d4394b55
2022-04-21 19:06:14 -07:00
Durham Goode
98472dbb33 testlib: add basic working copy manipulation functions
Summary: Adds basic helpers for adding and removing files from the working copy.

Differential Revision: D35683768

fbshipit-source-id: 3fd4746222f53729eefd19a5d9833ae7ee4773d4
2022-04-21 19:06:14 -07:00
Durham Goode
07fc735743 testlib: set production configs during setup
Summary:
One of the goals of the new test framework is to run tests with mostly
production configuration. Let's add the appropriate configs to the global hgrc
during test setup.

In the medium term we should get rid of this hard coded list and use
dynamicconfig to generate configs for the tests. But for now let's go with the
hard coded list.

The configs were mostly copied from library.sh a tinit.sh.

Differential Revision: D35683766

fbshipit-source-id: d802066bc801165f361c3418d51ae0e9181629c2
2022-04-21 19:06:14 -07:00
Durham Goode
50aaa1a686 testlib: add initial base for new test framework
Summary:
This introduces the initial base, repo, and working copy classes for
the new Python OO test library. Future diffs will fill in functionality here.

Differential Revision: D35683764

fbshipit-source-id: 15b33ee9eacf58810b76682d51e2e3446026f5e0
2022-04-21 19:06:14 -07:00
Zeyi (Rice) Fan
8e952af34e cli: do not suggest cd trick after restart on Windows
Summary: This trick doesn't matter on Windows, so let's not suggest it on Windows.

Reviewed By: chadaustin

Differential Revision: D35820427

fbshipit-source-id: 44c1d0373d20d921fa55a8edf7e3d9565682a609
2022-04-21 18:45:10 -07:00
Jun Wu
b8afda54e1 conch-parser: include Python binding in autocargo
Summary:
This makes the conch-parser Python extension included in the generated
Cargo.toml workspace members. It might fix the following `setup.py`
build error:

  building 'conch_parser' library extension
  error: current package believes it's in a workspace when it's not:
  current:   /temp/fbcode_builder_getdeps/shipit/eden_scm/eden/scm/edenscmnative/conch_parser/Cargo.toml
  workspace: /temp/fbcode_builder_getdeps/shipit/eden_scm/eden/scm/Cargo.toml
  this may be fixable by adding `edenscmnative/conch_parser` to the `workspace.members` array of the manifest located at: /data/sandcastle/temp/fbcode_builder_getdeps/shipit/eden_scm/eden/scm/Cargo.toml
  Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest.

Differential Revision: D35759558

fbshipit-source-id: 2d07285d81092cca10c0fc127c935b5d370f2891
2022-04-21 17:36:57 -07:00
Jun Wu
c3d5d9f00f conch_parser: restore building the Python extension
Summary:
On macOS the exported symbol has a leading underscore. Change buck config to
fix the build.

See the Python stdlib `_sqlite3` for example:

  $ nm -gU /opt/homebrew/Cellar/python38/3.8.3_1/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload/_sqlite3.cpython-38-darwin.so
  0000000000005132 T _PyInit__sqlite3
  ...

Reviewed By: DurhamG

Differential Revision: D35829957

fbshipit-source-id: 23259b982313baae01db0dc6ad4cbe79747e9766
2022-04-21 17:36:57 -07:00
Carolyn Busch
8ce9b9ce17 clone: implement native clone
Summary: Implement rust clone method which intializes the repo and pulls.

Differential Revision: D35486624

fbshipit-source-id: 8ad207cafab118a8fcbe7e8149221fbba072680e
2022-04-21 16:39:31 -07:00
Carolyn Busch
6c6e8c0124 clone: add conditionals for python or rust clone
Summary: To decide whether to use python or rust clone, first check if flag options are supported by rust clone. Then check if the repo to be clone has serverside segmented changelog support which is required by rust clone.

Differential Revision: D35507009

fbshipit-source-id: 739dc97e7d1812ccc547f8be3c2e98d22960c3fd
2022-04-21 16:39:31 -07:00
Carolyn Busch
353a55b11a repo: add hgrc option to init
Summary: Add optional content for hgrc file to write out the config file includes and configs like path.

Differential Revision: D35786090

fbshipit-source-id: 5b6fda59864bdd3ce149b490930ccb1e07ddd933
2022-04-21 16:39:31 -07:00
Carolyn Busch
81a1c8cd52 repo: add methods for adding requirements
Summary: Add methods to repo to add requirements. We might not want to add these methods, since only clone needs to add reqs for remotefilelog and segmented changelog and we don't want to encourage adding any other requirements outside of repo initialization.

Reviewed By: sggutier

Differential Revision: D35486626

fbshipit-source-id: 55ad6bd3f9e9005cd6280c2443013a1cc615dcec
2022-04-21 16:39:31 -07:00
Carolyn Busch
f9852d6708 clone: initialize metalog tracked in repo init
Summary: Add a method to initialize tracked files in metalog for repo init.

Differential Revision: D35486627

fbshipit-source-id: c29dac5742923c6ede6ee9c9eaeaa34c49f23793
2022-04-21 16:39:31 -07:00
Carolyn Busch
d656f9c50c repo: return a repo from init
Summary: Create and return a repo object in the Repo::init method so additional loading of the repo is not required to use the repo after calling init.

Differential Revision: D35486628

fbshipit-source-id: 4521742b56925882725ae93524c835b81a910220
2022-04-21 16:39:31 -07:00