Commit Graph

18 Commits

Author SHA1 Message Date
Xavier Deguillard
d7399a765f tests: set tweakdefaults.rebasekeepdate to True
Summary: Rebase tests can be unpredictible otherwise.

Reviewed By: farnz

Differential Revision: D16701186

fbshipit-source-id: 3c7af531c27ada15ace16c616799e0f569e285a2
2019-08-08 10:22:21 -07:00
Durham Goode
e2bfcbcca4 tests: add Mononoke integration test target
Summary:
This adds a new test target that will use Mononoke as the server.
Initially we only support one test, but we can add to this list in the future.

Reviewed By: quark-zju

Differential Revision: D15382714

fbshipit-source-id: ad9b3bd35ffefc01239ff05f9f65829fb7a94555
2019-05-29 01:30:28 -07:00
Durham Goode
cf4b5d651c tests: enable lz4revlog for newserver repos
Summary:
In the next diff we enable Mononoke support for any test using the new
newserver and clone helpers. Mononoke only supports lz4revlog, so we need to
make sure newserver also creates lz4revlog repos.

Reviewed By: quark-zju

Differential Revision: D15382715

fbshipit-source-id: 21da5a3ad14947b87cf09771c723f2109e028da1
2019-05-28 03:17:04 -07:00
Durham Goode
2e5e174b8d tests: set default configuration for newserver and clones
Summary:
When using the new server and client helpers, let's set some default
configuration that is expected in production. This will allow us to
mostly-transparently swap out the server with Mononoke for any test who uses
these helpers.

Reviewed By: quark-zju

Differential Revision: D15381856

fbshipit-source-id: 054fcc2768eba38e704e713aeb1bc8e84faa2be1
2019-05-28 03:17:02 -07:00
Durham Goode
03f1bea99a tests: update test-fb-hgext-remotefilelog-log.t to use treeonly
Summary:
This is a proof of concept test to show how we might convert tests to
use treeonly. A future iteration of this should show how we can insert mononoke
as the backend for the tests.

Reviewed By: quark-zju

Differential Revision: D15382163

fbshipit-source-id: e9c8af871260435f81ef9dbf6f20257b1ff2a35f
2019-05-28 03:17:02 -07:00
Mark Thomas
90b12d41f4 mutation: use tglogm in all tests
Summary:
The `tglogm` test function displays a graph log with mutation information.
Use this common function in all tests.

Differential Revision: D14876688

fbshipit-source-id: 2eb29a45b6267d448d292ac13dbfb0135d6fc8e4
2019-04-11 07:49:20 -07:00
Mark Thomas
511b52863e visibility: support cloud sync
Summary:
Add support for explicit visibility tracking in commit cloud sync.

This means commit cloud reads the visibleheads and syncs these with the commit
cloud heads directly, removing the source of problems where obsmarkers disagree
on different hosts.

Commit cloud requires that the ordering of heads is maintained to get stable
ordering of new commits.  Update the visibleheads tracking to maintain
ordering, rather than using sets.

Finally, the calculation of the replacement node was slightly off.  This was
revealed in the new test case that is being added, so it is also fixed.

Differential Revision: D14876266

fbshipit-source-id: fe5b6bffd196d3bd74e7582e29484969495eac8e
2019-04-11 07:49:20 -07:00
Durham Goode
9a40d36329 pushrebase: add test demonstrating corruption with treeonly
Summary:
There's a corruption that occurs because pushrebase caches a fulltext
instead of a tree. Let's write a test to expose it. The next diff will fix it.

Reviewed By: mitrandir77

Differential Revision: D13154341

fbshipit-source-id: e2ac040c59c677b414b6eddd39d7dc2ebb25f082
2018-11-21 08:33:48 -08:00
Jun Wu
5a3842e136 hgsql: add a test demonstrating issues we saw with treeonly pushrebases
Summary:
This happens if during prepushrebase hook, a hgsql repo sync (db -> local)
is completed by another process. `repo.manifestlog` does not get invalidated
correctly if it's treeonly.

The issue was partially detected by a C program modified from fanotify (2)
manpage example monitoring `00manifesttree.i` changes:

  [00:32:35.780] pid 7734 opens 00manifesttree.i (size 1000264)                       # First open.
  [00:32:35.930] pid 7734 reads closes (no write) 00manifesttree.i (size 1000264)
  [00:32:38.685] pid 9175 opens 00manifesttree.i (size 1000264)
  [00:32:38.885] pid 9175 reads 00manifesttree.i (size 1000264)
  [00:32:38.886] pid 9175 closes (no write) 00manifesttree.i (size 1000264)
  [00:32:39.235] pid 9175 opens 00manifesttree.i (size 1000264)
  [00:32:39.235] pid 9175 closes (no write) 00manifesttree.i (size 1000264)
  [00:32:39.236] pid 9175 opens 00manifesttree.i (size 1000264)
  [00:32:39.236] pid 9175 modifies closes 00manifesttree.i (size 1000328)             # Appended by another process.
  [00:32:41.169] pid 10759 opens 00manifesttree.i (size 1000328)
  [00:32:41.355] pid 10759 reads 00manifesttree.i (size 1000328)
  [00:32:41.355] pid 10759 closes (no write) 00manifesttree.i (size 1000328)
  [00:32:41.537] pid 10759 opens closes (no write) 00manifesttree.i (size 1000328)
  [00:32:41.537] pid 10759 opens 00manifesttree.i (size 1000392)
  [00:32:41.537] pid 10759 modifies closes 00manifesttree.i (size 1000392)            # Appended by another process.
  [00:32:44.930] pid 7734 opens closes (no write) 00manifesttree.i (size 1000392)     # Main process picked up changes.
  [00:32:44.930] pid 7734 opens 00manifesttree.i (size 1000392)
  [00:32:44.930] pid 7734 reads 00manifesttree.i (size 1000392)
  [00:32:44.930] pid 7734 modifies closes 00manifesttree.i (size 1000456)             # Main process wrote data.
  [00:32:45.275] pid 7734 opens 00manifesttree.i (size 1000456)
  [00:32:45.459] pid 7734 reads 00manifesttree.i (size 1000456)
  [00:32:45.459] pid 7734 closes (no write) 00manifesttree.i (size 1000456)
  [00:32:45.550] pid 7734 opens closes (no write) 00manifesttree.i (size 1000456)
  [00:32:45.550] pid 7734 opens 00manifesttree.i (size 1000264)
  [00:32:45.550] pid 7734 closes 00manifesttree.i (size 1000264)                      # Main process truncated to the wrong position.

Pid 7734 had "IntegrityError: 1062 (23000): Duplicate entry" error. The
fanotify log showed it truncated the revlog to a wrong location, indicating
an outdated revlog was kept in memory.

The C program was sent as D10418991.

Reviewed By: DurhamG

Differential Revision: D10417797

fbshipit-source-id: 7ccc0a976d05efbca5b3ed6fb5ff7886766d06d2
2018-10-17 20:07:47 -07:00
Durham Goode
85a676e406 treemanifest: add test for pushing treeonly commits to a treeonly repo via pushrebase
Summary:
This flow has a bug, so let's introduce a test to expose the break. The
next diff will fix the bug.

Reviewed By: quark-zju, singhsrb

Differential Revision: D10156424

fbshipit-source-id: 51d1d8da6728ee930dc1440cd3e685d7c5b5df2a
2018-10-03 08:52:18 -07:00
Jun Wu
8c33c0736a pushrebase: handle tree commits correctly for merges and renames
Summary:
In pushrebase code path, `_getmanifest` needs to be used to obtain the manifest
correctly for pushes from treeonly repos. The merge commit code path missed this
change. Fix it.

Besides, the rename checking code patch can also hit flat manifest errors via
repo.commitctx -> ... -> fctx._copied -> ctx.filenode -> ctx._fileinfo. Patch
that path too.

Reviewed By: phillco

Differential Revision: D9977904

fbshipit-source-id: 8c51aa9cc6bd85b0147d88c61a5af074e36cdb61
2018-09-21 10:26:40 -07:00
Jun Wu
1dc9519dda registrar: add a namespace predicate
Summary:
Previously, there is no easy API to add a namespace with desired order. There
is `extensions.afterloaded`, but that only works for `ui/extsetup`, not for
`reposetup`.

This diff add a namespace predicate so registering a namespace is similar to
registering a revset. It also provides an optional `after` parameter to define
the desired order, like:

  from mercurial import registrar, namespaces

  namespacepredicate = registrar.namespacepredicate()

  namespacepredicate("svn", after=["remotenames"])
  def svn(repo):
      return namespaces.namespace("svn", ...)

Existing namespaces will be migrated by upcoming changes.

This is useful for things wanting to resolve custom names, like globalrevs and
commit cloud.

Reviewed By: singhsrb

Differential Revision: D9775703

fbshipit-source-id: f15827b042d605b9cebc1ee1af6479903f47ee9c
2018-09-11 19:51:56 -07:00
Jun Wu
35b4a2b556 test-dirstate-rebuild: demonstrate dirstate rebuild problems
Summary:
With treedirstate and treestate, dirstate becomes harder to recover. The test
demonstrates related problems.

Reviewed By: DurhamG

Differential Revision: D9375195

fbshipit-source-id: a42ea84e810fe6cd9db8412c2a75fffbebdb6dc7
2018-08-17 11:38:26 -07:00
Phil Cohen
917604f2f5 tests: fold tglog into tinit; standardize
Summary:
Like D9323267, hg tests commonly reinvent common aliases to render the DAG, and they often differ very slightly. This makes adding a test require more boilerplate, and reading a test in a foreign new area slightly more overhead.

Let's standardize these to reduce the copypasta.

It's necessary to define this as a shell function instead of an hgrc alias to prevent tests that list aliases from printing it. Plus that enforces a nice separation of test/stdlib logic.

Bookmarks and branches are easy enough to add since they're empty if not used. A good number added `{phase}` -- I renamed this to `tglogp`.

Reviewed By: quark-zju

Differential Revision: D9347072

fbshipit-source-id: 6aac7de3e65d2295a7ebecd2ab30901709af3ff1
2018-08-16 10:53:43 -07:00
Phil Cohen
c6317e40fa tests: add {node|short} to showgraph()
Summary:
I hit a bug where commit hashes were useful, but it only showed up in the `hg rebase` output late in a test.

I think adding hashes to log output is generally a best practice in tests, since it prevents accidental regressions.

Reviewed By: quark-zju

Differential Revision: D9323265

fbshipit-source-id: a76a01ddd416c68fe8a1c440584b21e5d88dc82a
2018-08-14 23:20:24 -07:00
Phil Cohen
d56ff5d1de tests: move showgraph() to tinit.sh
Summary:
It's duplicate in all the fbamend tests, and I want to make a change to it. Rather than duplicate it, let's fold it into `tinit`.

In the future, I'll unify this with tglog, printdag, etc.

Reviewed By: quark-zju

Differential Revision: D9323267

fbshipit-source-id: c1db0f2f22ffadbcb8ad3c0bde329798db06f089
2018-08-14 23:20:23 -07:00
Jun Wu
320fc31e4c tinit: add drawdag and setconfig functions
Summary: They help making tests easier to write.

Reviewed By: phillco

Differential Revision: D7121645

fbshipit-source-id: 9c7181d45c4e28155eb68f355cf1c4cfc077d191
2018-04-13 21:51:20 -07:00
Jun Wu
c6742cd74c run-tests: source tinit.sh for all .t tests
Summary:
`.t` tests have some highly repeatitive logics, like creating a repo, etc.
This patch adds a common shell file that defines frequently used functions.

For now, `newrepo` and `enable` are added. The latter can be used to
enable a feature (ex. obsstore), or an extension.

`test-fb-hgext-fbamend-next.t` and `test-fb-hgext-absorb.t` are migrated
to use the new shell functions.

Reviewed By: phillco

Differential Revision: D7121485

fbshipit-source-id: 167fcc20e4e30864199b6c5af0958b80bfb68817
2018-04-13 21:51:20 -07:00