Skip to content

Commit fd152b4

Browse files
mononoke/integration: create a Makefile to run tests as part of getdeps.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
1 parent 3ae709a commit fd152b4

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

build/fbcode_builder/getdeps/builder.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,17 @@ def __init__(
145145
inst_dir,
146146
build_args,
147147
install_args,
148+
test_args,
148149
):
149150
super(MakeBuilder, self).__init__(
150151
build_opts, ctx, manifest, src_dir, build_dir, inst_dir
151152
)
152153
self.build_args = build_args or []
153154
self.install_args = install_args or []
155+
self.test_args = test_args
156+
157+
def _get_prefix(self):
158+
return ["PREFIX=" + self.inst_dir, "prefix=" + self.inst_dir]
154159

155160
def _build(self, install_dirs, reconfigure):
156161
env = self._compute_env(install_dirs)
@@ -161,17 +166,24 @@ def _build(self, install_dirs, reconfigure):
161166
cmd = (
162167
["make", "-j%s" % self.build_opts.num_jobs]
163168
+ self.build_args
164-
+ ["PREFIX=" + self.inst_dir, "prefix=" + self.inst_dir]
169+
+ self._get_prefix()
165170
)
166171
self._run_cmd(cmd, env=env)
167172

168-
install_cmd = (
169-
["make"]
170-
+ self.install_args
171-
+ ["PREFIX=" + self.inst_dir, "prefix=" + self.inst_dir]
172-
)
173+
install_cmd = ["make"] + self.install_args + self._get_prefix()
173174
self._run_cmd(install_cmd, env=env)
174175

176+
def run_tests(
177+
self, install_dirs, schedule_type, owner, test_filter, retry, no_testpilot
178+
):
179+
if not self.test_args:
180+
return
181+
182+
env = self._compute_env(install_dirs)
183+
184+
cmd = ["make"] + self.test_args + self._get_prefix()
185+
self._run_cmd(cmd, env=env)
186+
175187

176188
class AutoconfBuilder(BuilderBase):
177189
def __init__(self, build_opts, ctx, manifest, src_dir, build_dir, inst_dir, args):

build/fbcode_builder/getdeps/manifest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"b2.args": {"optional_section": True},
8989
"make.build_args": {"optional_section": True},
9090
"make.install_args": {"optional_section": True},
91+
"make.test_args": {"optional_section": True},
9192
"header-only": {"optional_section": True, "fields": {"includedir": REQUIRED}},
9293
"shipit.pathmap": {"optional_section": True},
9394
"shipit.strip": {"optional_section": True},
@@ -437,6 +438,7 @@ def create_builder( # noqa:C901
437438
if builder == "make":
438439
build_args = self.get_section_as_args("make.build_args", ctx)
439440
install_args = self.get_section_as_args("make.install_args", ctx)
441+
test_args = self.get_section_as_args("make.test_args", ctx)
440442
return MakeBuilder(
441443
build_options,
442444
ctx,
@@ -446,6 +448,7 @@ def create_builder( # noqa:C901
446448
inst_dir,
447449
build_args,
448450
install_args,
451+
test_args,
449452
)
450453

451454
if builder == "autoconf":

build/fbcode_builder/manifests/mononoke

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ tools/rust/ossconfigs = .
3434
^fbcode/eden/mononoke/Cargo\.toml$
3535
^fbcode/eden/mononoke/(?!public_autocargo).+/Cargo\.toml$
3636
^fbcode/configerator/structs/scm/mononoke/(?!public_autocargo).+/Cargo\.toml$
37+
^.*/facebook/.*$
3738

3839
[dependencies]
3940
fbthrift-source

build/fbcode_builder/manifests/mononoke_integration

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,20 @@ build-getdeps
1818
[make.install_args]
1919
install-getdeps
2020

21+
[make.test_args]
22+
test-getdeps
23+
2124
[shipit.pathmap]
2225
fbcode/eden/mononoke/tests/integration = eden/mononoke/tests/integration
2326

2427
[shipit.strip]
2528
^.*/facebook/.*$
2629

2730
[dependencies]
31+
eden_scm
32+
eden_scm_lib_edenapi_tools
2833
jq
34+
mononoke
2935
nmap
3036
python-click
3137
python-dulwich

0 commit comments

Comments
 (0)