Commit 3f6324de authored by Lukas Piatkowski's avatar Lukas Piatkowski Committed by Facebook GitHub Bot

mononoke/integration: create a Makefile to run tests as part of getdeps.py build (#67)

Summary:
Pull Request resolved: https://github.com/facebookexperimental/eden/pull/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
parent b26907ea
...@@ -145,12 +145,17 @@ class MakeBuilder(BuilderBase): ...@@ -145,12 +145,17 @@ class MakeBuilder(BuilderBase):
inst_dir, inst_dir,
build_args, build_args,
install_args, install_args,
test_args,
): ):
super(MakeBuilder, self).__init__( super(MakeBuilder, self).__init__(
build_opts, ctx, manifest, src_dir, build_dir, inst_dir build_opts, ctx, manifest, src_dir, build_dir, inst_dir
) )
self.build_args = build_args or [] self.build_args = build_args or []
self.install_args = install_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): def _build(self, install_dirs, reconfigure):
env = self._compute_env(install_dirs) env = self._compute_env(install_dirs)
...@@ -161,17 +166,24 @@ class MakeBuilder(BuilderBase): ...@@ -161,17 +166,24 @@ class MakeBuilder(BuilderBase):
cmd = ( cmd = (
["make", "-j%s" % self.build_opts.num_jobs] ["make", "-j%s" % self.build_opts.num_jobs]
+ self.build_args + self.build_args
+ ["PREFIX=" + self.inst_dir, "prefix=" + self.inst_dir] + self._get_prefix()
) )
self._run_cmd(cmd, env=env) self._run_cmd(cmd, env=env)
install_cmd = ( install_cmd = ["make"] + self.install_args + self._get_prefix()
["make"]
+ self.install_args
+ ["PREFIX=" + self.inst_dir, "prefix=" + self.inst_dir]
)
self._run_cmd(install_cmd, env=env) 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): class AutoconfBuilder(BuilderBase):
def __init__(self, build_opts, ctx, manifest, src_dir, build_dir, inst_dir, args): def __init__(self, build_opts, ctx, manifest, src_dir, build_dir, inst_dir, args):
......
...@@ -88,6 +88,7 @@ SCHEMA = { ...@@ -88,6 +88,7 @@ SCHEMA = {
"b2.args": {"optional_section": True}, "b2.args": {"optional_section": True},
"make.build_args": {"optional_section": True}, "make.build_args": {"optional_section": True},
"make.install_args": {"optional_section": True}, "make.install_args": {"optional_section": True},
"make.test_args": {"optional_section": True},
"header-only": {"optional_section": True, "fields": {"includedir": REQUIRED}}, "header-only": {"optional_section": True, "fields": {"includedir": REQUIRED}},
"shipit.pathmap": {"optional_section": True}, "shipit.pathmap": {"optional_section": True},
"shipit.strip": {"optional_section": True}, "shipit.strip": {"optional_section": True},
...@@ -437,6 +438,7 @@ class ManifestParser(object): ...@@ -437,6 +438,7 @@ class ManifestParser(object):
if builder == "make": if builder == "make":
build_args = self.get_section_as_args("make.build_args", ctx) build_args = self.get_section_as_args("make.build_args", ctx)
install_args = self.get_section_as_args("make.install_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( return MakeBuilder(
build_options, build_options,
ctx, ctx,
...@@ -446,6 +448,7 @@ class ManifestParser(object): ...@@ -446,6 +448,7 @@ class ManifestParser(object):
inst_dir, inst_dir,
build_args, build_args,
install_args, install_args,
test_args,
) )
if builder == "autoconf": if builder == "autoconf":
......
...@@ -34,6 +34,7 @@ tools/rust/ossconfigs = . ...@@ -34,6 +34,7 @@ tools/rust/ossconfigs = .
^fbcode/eden/mononoke/Cargo\.toml$ ^fbcode/eden/mononoke/Cargo\.toml$
^fbcode/eden/mononoke/(?!public_autocargo).+/Cargo\.toml$ ^fbcode/eden/mononoke/(?!public_autocargo).+/Cargo\.toml$
^fbcode/configerator/structs/scm/mononoke/(?!public_autocargo).+/Cargo\.toml$ ^fbcode/configerator/structs/scm/mononoke/(?!public_autocargo).+/Cargo\.toml$
^.*/facebook/.*$
[dependencies] [dependencies]
fbthrift-source fbthrift-source
......
...@@ -18,6 +18,9 @@ build-getdeps ...@@ -18,6 +18,9 @@ build-getdeps
[make.install_args] [make.install_args]
install-getdeps install-getdeps
[make.test_args]
test-getdeps
[shipit.pathmap] [shipit.pathmap]
fbcode/eden/mononoke/tests/integration = eden/mononoke/tests/integration fbcode/eden/mononoke/tests/integration = eden/mononoke/tests/integration
...@@ -25,7 +28,10 @@ fbcode/eden/mononoke/tests/integration = eden/mononoke/tests/integration ...@@ -25,7 +28,10 @@ fbcode/eden/mononoke/tests/integration = eden/mononoke/tests/integration
^.*/facebook/.*$ ^.*/facebook/.*$
[dependencies] [dependencies]
eden_scm
eden_scm_lib_edenapi_tools
jq jq
mononoke
nmap nmap
python-click python-click
python-dulwich python-dulwich
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment