sapling/eden/integration/hg/non_eden_operation_test.py
Alex Hornby 96bef26081 add github actions for EdenFS on linux and fix Eden SCM Mac build (#106)
Summary:
Pull Request resolved: https://github.com/facebookexperimental/eden/pull/106

Pull Request resolved: https://github.com/facebookexperimental/eden/pull/107

Summary

* Add EdenFS builds on external CI now EdenSCM is good

* Mac builds on github actions by using brew for system dependencies

To make this work had to fix some path ordering issues with install directories for Linux and Mac, and generalise the homebrew path fixups we were doing for bison to all the used homebrew packages.

Previously Installed packages were being added after system paths, so our own installed thing might be ignored. On github these meant system python 3.9 was being used for hg tests rather than our specified 3.8 (this showed we have some test fails on python 3.9 with "SystemError: deallocated bytearray object has exported buffers", that are beyond the scope of this diff to fix)

Also needed to include the getdeps generated python into the generated edenscmdeps3.zip archive setup.py produces otherwise EdenFS tests failed to import thrift.Thrift

Eden tests are hanging when run externally about half way through, so disable them on github actions for now as this PR is already fairly large. They work when run locally on an internal devserver, so probably some bit of environment necessary is not defined in the test runner

Reviewed By: chadaustin

Differential Revision: D34116505

fbshipit-source-id: d0d628db5daabc28d0bd8997cd5c1bc885ed1e73
2022-02-14 11:56:53 -08:00

56 lines
2.0 KiB
Python

#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
import os
from eden.integration.hg.lib.hg_extension_test_base import EdenHgTestCase, hg_test
from eden.integration.lib import hgrepo
@hg_test
# pyre-ignore[13]: T62487924
class NonEdenOperationTest(EdenHgTestCase):
def populate_backing_repo(self, repo: hgrepo.HgRepository) -> None:
repo.write_file("hello.txt", "hola")
def test_hg_clone_non_eden_repo_within_eden_repo(self):
"""Regression test to ensure that running `hg` commands from an
Eden-backed Hg repo on a non-Eden-backed Hg repo work as expected."""
non_eden_hg_repo = os.path.join(self.tmp_dir, "non-eden-hg-repo")
os.mkdir(non_eden_hg_repo)
# Create the non-Eden Hg repo.
self.hg("init", cwd=non_eden_hg_repo)
first_file = os.path.join(non_eden_hg_repo, "first.txt")
with open(first_file, "w") as f:
f.write("First file in non-Eden-backed Hg repo.\n")
self.hg(
"commit",
"--config",
"ui.username=Kevin Flynn <lightcyclist@example.com>",
"--config=remotefilelog.reponame=dummy",
"-Am",
"first commit",
cwd=non_eden_hg_repo,
)
# Run `hg clone` from the Eden repo.
clone_of_non_eden_hg_repo = os.path.join(self.tmp_dir, "clone-target")
self.hg(
"clone",
"--config=remotefilelog.reponame=dummy",
f"--config=remotefilelog.cachepath={os.path.join(self.tmp_dir, 'hgcache')}",
"--pull",
non_eden_hg_repo,
clone_of_non_eden_hg_repo,
cwd=self.repo.path,
)
dest_first_file = os.path.join(clone_of_non_eden_hg_repo, "first.txt")
with open(dest_first_file, "r") as f:
contents = f.read()
self.assertEqual("First file in non-Eden-backed Hg repo.\n", contents)