Commit Graph

40 Commits

Author SHA1 Message Date
Xavier Deguillard
dd29533b60 test: verify that EdenFS can be started in the fsck tests
Summary:
If for some reason EdenFS cannot be started, we shouldn't attempt to run the
fsck tests as these would always fail.

Reviewed By: genevievehelsel

Differential Revision: D29918436

fbshipit-source-id: 6e4a01a747157427e5c1028084e32cef8066c96a
2021-07-26 20:07:19 -07:00
Zhengchao Liu
2e86cf8b6b fix fsck snapshot integration tests
Summary:
This test is broken due to Rust panic from hg (likely there was some change in hg and the original snapshot was from 2018). It's hard to know exactly what's causing this issue because 1) it's not from eden 2) this has been broken for a while so it's tricky to bisect.
To bring back the coverage and run on a modern repo, this diff:
 * generates a new snapshot (`buck run //eden/integration/snapshot:gen_snapshot -- basic`).
 * adds a step to translate hgrc because the path at snapshot generation time is in it.
 * migrates this test to the new snapshot

Reviewed By: kmancini

Differential Revision: D29670241

fbshipit-source-id: 1c5dccc673d516334de83582b32e2e3c9dc308f1
2021-07-14 16:20:04 -07:00
Thomas Orozco
0c76bd226b eden: use filegroup to find snapshots
Summary:
This is trying to access the repo directly. That works on Buck v1
because it runs from the fbcode directory. It doesn't work in Buck v2
because it runs from fbsource.

Reviewed By: xavierd

Differential Revision: D29033508

fbshipit-source-id: 504af8c205e36d98e875d13d73d15857f3a0b6a1
2021-06-15 02:47:40 -07:00
Genevieve Helsel
55da8ffcbc run linter in eden/integration
Summary: just running the linter!

Reviewed By: chadaustin

Differential Revision: D26000269

fbshipit-source-id: 184eb962fa7b88eb9b8b6bd22ae76477cbb6a06c
2021-01-25 16:13:54 -08:00
generatedunixname89002005307016
1e1a7fa10d suppress errors in eden - batch 1
Differential Revision: D25562362

fbshipit-source-id: ec62c64396f61335f6cfe8f355ba977bfd1da031
2020-12-15 15:22:22 -08:00
generatedunixname89002005307016
6527db2809 suppress errors in eden - batch 1
Reviewed By: pradeep90

Differential Revision: D22628389

fbshipit-source-id: c109334243a92269a7fb9a9b0515565ac22ecfac
2020-07-20 13:29:51 -07:00
Shannon Zhu
0b93429dc1 Convert type check targets in eden to use configuration
Summary:
D21316793 is blocked from landing because there are a few targets in eden that are running pyre via buck targets integration.

We can't do custom version overrides for projects that are using a mix of local configurations and buck integration, because buck doesn't provide an interface for setting the equivalent pyre version override.

We're moving away from buck targets integration for pyre across the board, and I've run a codemod over the project to clean up all of the buck typing integration (including some residual mypy) as well as updated type ignores / fixmes accordingly.

Let me know if you have any concerns; upon skimming it looks like most changes are either converting `type: ignore`s into fixmes, or removing `type: ignores`.

Reviewed By: dkgi

Differential Revision: D21343093

fbshipit-source-id: 5ee1436377eb526c0a679fb821c42e07cbca52a5
2020-05-02 21:16:55 -07:00
Shannon Zhu
6ec7546cab Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: grievejia

Differential Revision: D21207287

fbshipit-source-id: ab82cf81690cb847bd130ff3448345f5a0ea19af
2020-04-23 12:09:39 -07:00
Ratnadeep Joshi
6447950e1a Move cli/ directory from eden/ to eden/fs (Without changing namespace)
Summary:
[edenfs] Move cli/ directory from eden/ to eden/fs (Without changing
namespace)

Reviewed By: simpkins

Differential Revision: D20505093

fbshipit-source-id: 1975afac2ca1cd70ca407dde485c97254f4cc1e9
2020-03-25 11:18:30 -07:00
Jia Chen
a731c7518d Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Differential Revision: D19143864

fbshipit-source-id: 0d2d4ed32423b740a67aae670b7f10691e4f4800
2019-12-20 16:14:21 -08:00
Andres Suarez
fbdb46f5cb Tidy up license headers
Reviewed By: chadaustin

Differential Revision: D17872966

fbshipit-source-id: cd60a364a2146f0dadbeca693b1d4a5d7c97ff63
2019-10-11 05:28:23 -07:00
Ken Yong Quan Oung
b80e719c81 Fix type annotation for ExpectedFileSet
Summary:
## Backstory
Pyre was throwing errors in my diff (D17747558) regarding an extraneous fixme. Turns out PyreBot has been adding and removing these fixmes during version updates (see D17135557 and D16183608), so I suspect it's something to do with the Pyre version. Anyways, I figured it'd be easier to do the annotation than to remove the fixme and risk Pyre throwing the same error in a later diff.

## What I did
I added the Key type (Path) and Value type(ExpectedFileBase). mypy then started throwing an error regarding __iter__ returning the wrong type because it wanted an iterator over keys rather than values. Fixed that and added .values() to the for loop.

Reviewed By: genevievehelsel

Differential Revision: D17806135

fbshipit-source-id: c07feee33db78a9bff19ba9856a7047657b8c63e
2019-10-08 11:18:51 -07:00
Adam Simpkins
8ce111ef53 support building the integration tests with CMake
Summary:
Add initial support for building and running some of the integration tests
with CMake.  For now this just runs the tests from basic_test.py, just to
confirm that most of the framework code works in CMake-based builds.

Many of the other tests should also work as well, but a few of them we may
want to disable for CMake-based builds.  e.g., a couple of the tests depend on
hypothesis, and we would need to include hypothesis as a dependency.  Some of
the tests that use systemd might also require a little more work to get
working.

Reviewed By: fanzeyi

Differential Revision: D17659026

fbshipit-source-id: 67420fda9e1021a0cddee2d385fd21e34fb2fd70
2019-10-04 08:56:38 -07:00
Genevieve Helsel
3137b65fb1 pyre-eden typing fix
Summary:
pyre-eden is mad at some diffs (D17531102, D17459971, D17252083, D17694987, D17633671, ...). I tried actually fixing this but couldn't come up with something immediately.

error here: https://our.intern.facebook.com/intern/sandcastle/log/?instance_id=36028797165385523&step_id=36028798422194913&step_index=14&name=Pyre+found+errors.

Reviewed By: wez

Differential Revision: D17703291

fbshipit-source-id: c53cde2226409ea3d7e381056a047da3da7084c6
2019-10-02 18:02:18 -07:00
Adam Simpkins
c6de7c47ee always ensure that the contents of the .eden/ directory are correct
Summary:
Make sure the contents of the special `.eden/` subdirectory are correct each
time we mount a checkout.  Before we would generally only set up the contents
of this directory if it didn't previously exist.

Now the code verifies that the contents of each symlink in this directory are
correct, and recreates the symlink if needed.

This allows EdenFS to automatically repair the contents of this directory even
if the checkout or its `clients` directory has been manually moved.

Reviewed By: wez

Differential Revision: D17279413

fbshipit-source-id: e24e7530f44fff94ebb6f67174aaf78c9b498d6b
2019-09-11 22:02:16 -07:00
generatedunixname89002005289445
13e683608d Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: sinancepel

Differential Revision: D17135557

fbshipit-source-id: 07afef940271a277c75834892733901d070bfa5f
2019-08-30 13:37:34 -07:00
generatedunixname89002005289445
1be6e4d957 Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: grievejia

Differential Revision: D16183608

fbshipit-source-id: 529a893a021c8101e6ad28b8d88d22d4d05aa732
2019-07-10 14:48:04 -07:00
Adam Simpkins
9bfb48c921 update license headers in .py files
Summary:
Update the copyright & license headers in Python files to reflect the
relicensing to GPLv2

Reviewed By: wez

Differential Revision: D15487088

fbshipit-source-id: 9f2138dff41048d2c35f15e09a04ae5a9c9c80dd
2019-06-19 17:02:46 -07:00
Adam Simpkins
90f48a3105 fix a few additional python lint issues
Summary: Fix a few more issues raised by our Python lint checks.

Reviewed By: wez

Differential Revision: D15776717

fbshipit-source-id: 621960579c4567c4fb9395ae14cd7a8666726c1c
2019-06-12 14:00:57 -07:00
Adam Simpkins
53a6513e14 clean up arguments to the EdenFS class in the integration tests
Summary:
Clean up the `EdenFS` class construction.

Previously it accepted the `eden_dir`, `etc_eden_dir`, and `home_dir`
arguments as separate parameters.  If `etc_eden_dir` or `home_dir` were not
specified it would not pass these arguments to `edenfs`, allowing the default
values to be used.  This is undesirable for most tests.

Now it accepts a `base_dir` argument.  Explicit values for the `eden_dir`,
`etc_eden_dir`, and `home_dir` parameters can still be specified (this is used
for the snapshot tests), but if they aren't specified, default locations
inside the `base_dir` will be used instead.

This also cleans up some of the code to use `pathlib.Path` values instead of
plain `str` objects in more places.

Reviewed By: strager

Differential Revision: D15756358

fbshipit-source-id: 3e87ddc98d15fcb7f60c6c3116d4fcc8e49432ea
2019-06-11 18:27:21 -07:00
Sinan Cepel
4547deafca Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: dkgi

Differential Revision: D15283973

fbshipit-source-id: b1451da50dbbee0f71260d50caece21799f008f2
2019-05-09 18:17:36 -07:00
generatedunixname89002005289445
1678b9273e Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: shannonzhu

Differential Revision: D14305975

fbshipit-source-id: 7b54441dc846165fb12bfbe5339e4c917da463ec
2019-03-04 13:03:03 -08:00
Mark Thomas
9218f35f45 rename and relocate eden and edenfs
Summary:
The Eden CLI tool is really a control program for `edenfs`.  Rename it to
`edenfsctl` to free up the `eden` name for future use.

The Eden daemon shouldn't really be on the user's path, and instead belongs in
`libexec`.

For transition compatibility, `eden` is symlinked to `edenfsctl`.

Reviewed By: simpkins

Differential Revision: D13888875

fbshipit-source-id: 435cc63e92b85b1f28b8691e4846fbcb05bc450e
2019-02-21 15:00:47 -08:00
Shannon Zhu
37784ab043 Update pyre version for eden
Summary: using upgrade script to clear out all remaining version-set configs

Reviewed By: dark

Differential Revision: D13832474

fbshipit-source-id: 52c280cbd79b1410821ed829465b1c0907b50a86
2019-01-28 13:36:41 -08:00
Sinan Cepel
8d30ff0d6a upgrade fbcode/eden version
Reviewed By: simpkins, dark

Differential Revision: D13617216

fbshipit-source-id: 01066612dfc68cee9283b587fc08f25530857690
2019-01-10 16:13:47 -08:00
Adam Simpkins
9e21449bee move creation of the .hg directory into the Eden CLI
Summary:
Update the `eden clone` command to automatically create the `.hg` directory
when creating a checkout for a Mercurial repository.

Previously this logic was performed by a separate post-clone hook that was
invoked by `eden clone`.  Having this logic in a separate script made the code
slightly more complicated, and meant that configuring Eden was also more
complicated, as the hook also needed to be installed and configured.  Moving
the logic into the Eden CLI will make it easier to re-use this code in
`eden doctor` if the `.hg` directory needs to be repaired.

Reviewed By: wez

Differential Revision: D13447272

fbshipit-source-id: 11c4f8e389aead151dd235eff95c860a326967af
2018-12-19 15:34:01 -08:00
Marco Leogrande
bdccac3ea2 Upgrade pyre version for eden
Reviewed By: shannonzhu

Differential Revision: D13502225

fbshipit-source-id: d21fb9da209e4f376a7fbe4f618954ef43d08fea
2018-12-18 11:15:40 -08:00
Adam Simpkins
a1b00e46d8 fsck: fix orphan inodes by extracting them to a lost+found directory
Summary:
Update fsck to extract data for orphan inodes to a lost+found directory in the
fsck log directory, and remove them from the overlay.  This will allow users
to recover the orphan file data if they want, and remove it otherwise.

Reviewed By: chadaustin

Differential Revision: D12955094

fbshipit-source-id: 9783452fce4060b9c5c48b3d48dd1f70294211c6
2018-11-27 14:35:01 -08:00
Adam Simpkins
ee47b3a85e add more files to the basic snapshot
Summary:
Add several more files to the basic snapshot, so we can test more cases
in the fsck tests:
- Materialized, new, and unmodified symlinks
- A deeper directory tree of directory inodes that are not materialized (still
  have a source control tree hash) but have children inodes allocated and are
  therefore present in the overlay.
- A socket in a slightly deeper directory so we can test behavior of sockets
  inside directories that have been corrupted..

As before I have replaced the older basic snapshot instead of adding a new
one, since the Eden data storage formats have not changed since the last
snapshot was created.

Reviewed By: chadaustin

Differential Revision: D13164658

fbshipit-source-id: d117c9cc336709044de212637c03140dfadd9a96
2018-11-26 12:28:52 -08:00
Adam Simpkins
4d8755e1a0 add some new subdirectories to the basic snapshot
Summary:
This updates the basic snapshot code to include a couple slightly deeper
directories.  I plan to use this in the fsck tests to verify handling of
orphan directories that contain subdirectories.

Normally it would be preferable to keep the old `basic-20181030` snapshot, and
simply add this new snapshot without than replacing the old one.  However, I
don't think we have made any meaningful changes to our on-disk storage formats
since the previous snapshot was generated, so it seems okay to just delete the
old snapshot.

Reviewed By: strager

Differential Revision: D13151861

fbshipit-source-id: e6b7583beecb5d9cc55271ad2dea8d36980542d1
2018-11-26 12:28:52 -08:00
Adam Simpkins
0c8834e1fb add an ExpectedFileSet class to the snapshot verification code
Summary:
Add a helper class for maintaining the list of expected files.

I plan to use this for the fsck tests, so I can more easily modify the
snapshot's expected contents based on how we expect fsck to repair various
types of overlay corruption.  This also helps slightly simplify the code that
constructs the expected file list.

Reviewed By: chadaustin

Differential Revision: D13095918

fbshipit-source-id: 57686e82d1bf7f23a92eda0ed4d66623a3f58840
2018-11-26 12:28:52 -08:00
Adam Simpkins
6ddb0224ec fix the remaining type errors in eden python code
Summary: Fix the remaining set of errors reported by pyre and mypy.

Reviewed By: strager

Differential Revision: D13086855

fbshipit-source-id: 4c2b21352f94ef225a5555aef0f6b95b92e56f6d
2018-11-19 18:30:31 -08:00
Matt Glazar
cd9dd1f275 Move fuzzer config out of integration directory
Summary:
I want to use Hypothesis to fuzz some CLI code. Move EdenFS' Hypothesis configuration out of eden.integration.lib.testcase and into a place where both CLI tests and integration tests can use it.

This diff should not change behavior.

Reviewed By: wez

Differential Revision: D12813285

fbshipit-source-id: 3a1badd1e18b0e070295ea03dcb24be166cd42c1
2018-11-15 20:48:15 -08:00
Adam Simpkins
b5690cbec0 have the snapshot code also fix up stored UIDs and GIDs
Summary:
When unpacking a snapshot, rewrite Eden's inode metadata table to change the
UID and GID values to the current user.

This is needed so that the current user can access files inside the mounted
checkout correctly.

Reviewed By: wez

Differential Revision: D12966640

fbshipit-source-id: eec4aba690117bf7b8f944221b31b7c7cc66fc0c
2018-11-07 19:19:52 -08:00
Adam Simpkins
7c90dd8962 add a script for unpacking snapshot files
Summary:
Add a script for unpacking saved snapshot files.

This unpacks the tarball and then fixes up absolute paths inside the snapshot
so it will work at the unpacked location.  It also emits a small helper script
to make it easier to invoke eden for the snapshot.

Reviewed By: wez

Differential Revision: D12927842

fbshipit-source-id: f46c07a79894877842f2a78aa0924fd66e4c8969
2018-11-07 17:02:44 -08:00
Wez Furlong
3bee7ea2cc fixup root cause of ESTALE
Summary:
Thanks to some bpf tracing by strager, we traced the ESTALE response to
`d_splice_alias` and noted this comment above the implementation in the kernel:

> If a non-IS_ROOT directory is found, the filesystem is corrupt, and
> we should error out: directories can't have multiple aliases.

Well, our magic `.eden` directory is a directory with aliases and we were
seeing the error trigger on that dir.  So, this diff replaces hardlinking
directories into each tree with a hardlink to a symlink in each tree!

At mount time we create `.eden/this-dir` as a symlink to `/abs/path/to/mount/.eden`
so that `readlink("/abs/path/to/mount/sub/dir/.eden/socket")` still
resolves as it did prior to this diff.

Reviewed By: strager

Differential Revision: D12954819

fbshipit-source-id: 7f3b1b53f2bd5b9c51e64055fc34110657a19110
2018-11-07 15:20:58 -08:00
Adam Simpkins
49a7c05d61 add code to test saved snapshots
Summary:
Update the snapshot framework code to add tests that mount saved snapshots
with the current edenfs build and verifies that they behave as expected.

This also changes the snapshot generation code a fair amount as well, in
order to be able to verify the snapshot data:
- We now more cleanly split out data that should be saved when the snapshot is
  first generated (such as the `.eden` state directory) and data that should
  be re-generated each time the snapshot is unpacked (such as the `/etc/eden`
  config directory and the system configuration for `hg`).
- The code is now capable of rewriting absolute paths in the Eden state files
  so it is usable in a new location after it has been unpacked.

This also updates the "basic" snapshot type to create a wider variety of types
of files and file changes, and to be able to verify the contents of a resumed
snapshot.

Reviewed By: strager

Differential Revision: D9955411

fbshipit-source-id: 76012c01016cf4d89dc611c5596a05f5e7f013ed
2018-10-31 12:10:27 -07:00
Matt Glazar
9b0acaca4a Create test utilities for systemd service management
Summary:
In order to test 'eden start', etc. when edenfs is managed by systemd, we need to install the systemd service and let the Eden CLI start and stop the service. To avoid interfering with the user's running edenfs systemd service, and to avoid interference between unrelated tests, tests need to create a new instance of systemd.

Create a utility for tests to create a temporary systemd instance. It should work regardless of whether the host uses systemd to manage its services. (systemd's tooling must still be installed in order to use the utility, though.)

This utility is currently unused, but will be used in future diffs as 'eden start', etc. grows systemd support.

Reviewed By: simpkins

Differential Revision: D10286940

fbshipit-source-id: 4fbaa695bf36ac4ae44b5c12b6255514bd7143b3
2018-10-30 18:41:01 -07:00
Adam Simpkins
750b358571 update gen_snapshot to use xz compression by default
Summary: This seems to yield about 18% space savings compared to bzip2.

Reviewed By: strager

Differential Revision: D10351855

fbshipit-source-id: 58b969a8df4a9eb075526d5cc919c99ff6e8f4f3
2018-10-11 19:03:35 -07:00
Adam Simpkins
ab319c0b25 add a tool for generating snapshots of Eden data
Summary:
This begins adding a framework for generating snapshots of Eden state for use
in tests.  I plan to add a few kinds of tests based on these snapshots:

- Tests that ensure Eden can successfully load snapshots created by older
  versions of the code.

- Tests that corrupt the snapshot data in various ways and then confirm that
  it can be repaired by `eden fsck` and/or still loaded successfully by
  `edenfs` even if it was not repaired with `fsck` first.

This code still needs some additional functionality, but I figured it was
worth checking in what I have so far.  The main functionality that remains to
be added is unpacking the snapshots and updating absolute paths inside the
config files so that they work in the new path where they were unpacked.

Reviewed By: strager

Differential Revision: D9690267

fbshipit-source-id: a2660e49b84d7833e6778108d9abe081ab7e2cbd
2018-09-19 15:07:33 -07:00