Skip to content

Commit

Permalink
mononoke/integration: create a Makefile to run tests as part of getde…
Browse files Browse the repository at this point in the history
…ps.py build (#67)

Summary:
Pull Request resolved: facebook/sapling#67

With this change it will be possible to build dependencies of and run integration tests using getdeps.py.

This is the first goal of Q4 as per https://fb.quip.com/v8YzAYNSYgot: "Get Open Source version of integration tests running on Legocastle".

Before this diff:
The OSS integration tests run now on GitHub by:
- Building some test dependencies with getdeps.py
- Building some test dependencies with homebrew/apt-get
- Running tests via python script

The OSS integration tests were not running on Sandcastle.

After this diff:
The OSS integration tests run on Github by:
- Building and executing tests via getdeps.py (execution of tests happens by getdeps.py calling Make calling python script)

The OSS integration tests run on Sandcastle using the same getdeps.py setup as Github.

Reviewed By: krallin

Differential Revision: D24253268

fbshipit-source-id: cae249b72d076222673b8bbe4ec21866dcdbb253
lukaspiatkowski authored and facebook-github-bot committed Oct 16, 2020
1 parent b26907e commit 3f6324d
Showing 4 changed files with 28 additions and 6 deletions.
24 changes: 18 additions & 6 deletions build/fbcode_builder/getdeps/builder.py
Original file line number Diff line number Diff line change
@@ -145,12 +145,17 @@ def __init__(
inst_dir,
build_args,
install_args,
test_args,
):
super(MakeBuilder, self).__init__(
build_opts, ctx, manifest, src_dir, build_dir, inst_dir
)
self.build_args = build_args or []
self.install_args = install_args or []
self.test_args = test_args

def _get_prefix(self):
return ["PREFIX=" + self.inst_dir, "prefix=" + self.inst_dir]

def _build(self, install_dirs, reconfigure):
env = self._compute_env(install_dirs)
@@ -161,17 +166,24 @@ def _build(self, install_dirs, reconfigure):
cmd = (
["make", "-j%s" % self.build_opts.num_jobs]
+ self.build_args
+ ["PREFIX=" + self.inst_dir, "prefix=" + self.inst_dir]
+ self._get_prefix()
)
self._run_cmd(cmd, env=env)

install_cmd = (
["make"]
+ self.install_args
+ ["PREFIX=" + self.inst_dir, "prefix=" + self.inst_dir]
)
install_cmd = ["make"] + self.install_args + self._get_prefix()
self._run_cmd(install_cmd, env=env)

def run_tests(
self, install_dirs, schedule_type, owner, test_filter, retry, no_testpilot
):
if not self.test_args:
return

env = self._compute_env(install_dirs)

cmd = ["make"] + self.test_args + self._get_prefix()
self._run_cmd(cmd, env=env)


class AutoconfBuilder(BuilderBase):
def __init__(self, build_opts, ctx, manifest, src_dir, build_dir, inst_dir, args):
3 changes: 3 additions & 0 deletions build/fbcode_builder/getdeps/manifest.py
Original file line number Diff line number Diff line change
@@ -88,6 +88,7 @@
"b2.args": {"optional_section": True},
"make.build_args": {"optional_section": True},
"make.install_args": {"optional_section": True},
"make.test_args": {"optional_section": True},
"header-only": {"optional_section": True, "fields": {"includedir": REQUIRED}},
"shipit.pathmap": {"optional_section": True},
"shipit.strip": {"optional_section": True},
@@ -437,6 +438,7 @@ def create_builder( # noqa:C901
if builder == "make":
build_args = self.get_section_as_args("make.build_args", ctx)
install_args = self.get_section_as_args("make.install_args", ctx)
test_args = self.get_section_as_args("make.test_args", ctx)
return MakeBuilder(
build_options,
ctx,
@@ -446,6 +448,7 @@ def create_builder( # noqa:C901
inst_dir,
build_args,
install_args,
test_args,
)

if builder == "autoconf":
1 change: 1 addition & 0 deletions build/fbcode_builder/manifests/mononoke
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ tools/rust/ossconfigs = .
^fbcode/eden/mononoke/Cargo\.toml$
^fbcode/eden/mononoke/(?!public_autocargo).+/Cargo\.toml$
^fbcode/configerator/structs/scm/mononoke/(?!public_autocargo).+/Cargo\.toml$
^.*/facebook/.*$

[dependencies]
fbthrift-source
6 changes: 6 additions & 0 deletions build/fbcode_builder/manifests/mononoke_integration
Original file line number Diff line number Diff line change
@@ -18,14 +18,20 @@ build-getdeps
[make.install_args]
install-getdeps

[make.test_args]
test-getdeps

[shipit.pathmap]
fbcode/eden/mononoke/tests/integration = eden/mononoke/tests/integration

[shipit.strip]
^.*/facebook/.*$

[dependencies]
eden_scm
eden_scm_lib_edenapi_tools
jq
mononoke
nmap
python-click
python-dulwich

0 comments on commit 3f6324d

Please sign in to comment.