Skip to content

Commit 42c4c0d

Browse files
ahornbyfacebook-github-bot
authored andcommitted
run .t tests for getdeps sapling cli build
Summary: Connect up the sapling *.t tests so that github CI has visible cli test status. To get them to run: * some needed fbpython on path. I included a shim for that in the test makefile target. * test-rust-hooks: Command not found message, added a glob * test-identity.t: add a glob for the sapling version * test-eolfilename.t: output order was unstable, added sorts to make stable * helpers-testrepo.sh: fix assumption that system hg would be able to read test repo, check if its Sapling first. * added a manifest for the hexdump utility some of the tests required * excluded a few remaining tests (see comments in Makefile for reason) * fixed getdeps support for generating actions steps for test only dependencies NB the tests run as "hg". The expectations would need to be updated if we were to run as "sl" X-link: facebook/sapling#963 X-link: facebookincubator/zstrong#1004 Reviewed By: quark-zju Differential Revision: D63958737 Pulled By: ahornby fbshipit-source-id: 75c0d39258c320100d8d02b31390994bc2f3a3ce
1 parent 0f3fc2d commit 42c4c0d

File tree

4 files changed

+41
-9
lines changed

4 files changed

+41
-9
lines changed

build/fbcode_builder/getdeps.py

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,12 @@ def write_job_for_platform(self, platform, args): # noqa: C901
963963
self.process_project_dir_arguments(args, loader)
964964
manifest = loader.load_manifest(args.project)
965965
manifest_ctx = loader.ctx_gen.get_context(manifest.name)
966+
run_tests = (
967+
args.enable_tests
968+
and manifest.get("github.actions", "run_tests", ctx=manifest_ctx) != "off"
969+
)
970+
if run_tests:
971+
manifest_ctx.set("test", "on")
966972
run_on = self.get_run_on(args)
967973

968974
# Some projects don't do anything "useful" as a leaf project, only
@@ -1075,10 +1081,7 @@ def write_job_for_platform(self, platform, args): # noqa: C901
10751081
free_up_disk = ""
10761082

10771083
allow_sys_arg = ""
1078-
if (
1079-
build_opts.allow_system_packages
1080-
and build_opts.host_type.get_package_manager()
1081-
):
1084+
if run_tests:
10821085
sudo_arg = "sudo "
10831086
allow_sys_arg = " --allow-system-packages"
10841087
if build_opts.host_type.get_package_manager() == "deb":
@@ -1097,6 +1100,19 @@ def write_job_for_platform(self, platform, args): # noqa: C901
10971100
out.write(
10981101
f" run: {sudo_arg}python3 build/fbcode_builder/getdeps.py --allow-system-packages install-system-deps --recursive patchelf\n"
10991102
)
1103+
required_locales = manifest.get(
1104+
"github.actions", "required_locales", ctx=manifest_ctx
1105+
)
1106+
if (
1107+
build_opts.host_type.get_package_manager() == "deb"
1108+
and required_locales
1109+
):
1110+
# ubuntu doesn't include this by default
1111+
out.write(" - name: Install locale-gen\n")
1112+
out.write(f" run: {sudo_arg}apt-get install locales\n")
1113+
for loc in required_locales.split():
1114+
out.write(f" - name: Ensure {loc} locale present\n")
1115+
out.write(f" run: {sudo_arg}locale-gen {loc}\n")
11001116

11011117
projects = loader.manifests_in_dependency_order()
11021118

@@ -1188,11 +1204,7 @@ def write_job_for_platform(self, platform, args): # noqa: C901
11881204
out.write(" name: %s\n" % manifest.name)
11891205
out.write(" path: _artifacts\n")
11901206

1191-
if (
1192-
args.enable_tests
1193-
and manifest.get("github.actions", "run_tests", ctx=manifest_ctx)
1194-
!= "off"
1195-
):
1207+
if run_tests:
11961208
num_jobs_arg = ""
11971209
if args.num_jobs:
11981210
num_jobs_arg = f"--num-jobs {args.num_jobs} "
@@ -1203,6 +1215,7 @@ def write_job_for_platform(self, platform, args): # noqa: C901
12031215
)
12041216
if build_opts.free_up_disk and not build_opts.is_windows():
12051217
out.write(" - name: Show disk space at end\n")
1218+
out.write(" if: always()\n")
12061219
out.write(" run: df -h\n")
12071220

12081221
def setup_project_cmd_parser(self, parser):

build/fbcode_builder/getdeps/manifest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"optional_section": True,
8888
"fields": {
8989
"run_tests": OPTIONAL,
90+
"required_locales": OPTIONAL,
9091
},
9192
},
9293
"crate.pathmap": {"optional_section": True},
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[manifest]
2+
name = hexdump
3+
4+
[rpms]
5+
util-linux
6+
7+
[debs]
8+
bsdmainutils
9+
10+
# only used from system packages currently
11+
[build]
12+
builder = nop

build/fbcode_builder/manifests/sapling

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ fbsource_path = fbcode/eden
44
shipit_project = eden
55
shipit_fbcode_builder = true
66

7+
[github.actions]
8+
required_locales = en_US.UTF-8
9+
710
[git]
811
repo_url = https://github.com/facebook/sapling.git
912

@@ -57,6 +60,9 @@ fb303
5760
fbthrift
5861
rust-shed
5962

63+
[dependencies.test=on]
64+
hexdump
65+
6066
[dependencies.not(os=windows)]
6167
python
6268

0 commit comments

Comments
 (0)