diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-09-12 17:59:20 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-09-15 14:42:47 +0200 |
commit | f821e6b70c59037384ac6afb3a44517fe46953e6 (patch) | |
tree | 58334f832d4265afe8552c4cf542dcd41a7e75f6 /test | |
parent | 7f5e729b76865bbf01d1405b08f3292cee4e0e20 (diff) | |
download | justbuild-f821e6b70c59037384ac6afb3a44517fe46953e6.tar.gz |
just serve: add remote execution endpoint and --fetch-absent option
The serve service will communicate with this endpoint when needed,
as well as ensure artifacts it provides are synced with the remote
execution CAS, if requested by the client.
If just-mr is given the --fetch-absent option, it Always produce
present roots irrespective of the 'absent' pragma. For Git repositories
marked with the 'absent' pragma, first try to fetch any commit
trees provided by the serve endpoint from the execution endpoint
CAS, before reverting to a network fetch.
Co-authored-by: Klaus Aehlig <klaus.aehlig@huawei.com>
Co-authored-by: Alberto Sartori <alberto.sartori@huawei.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/buildtool/serve_api/target_level_cache_client.test.cpp | 12 | ||||
-rw-r--r-- | test/end-to-end/just-mr/absent-roots.sh | 1 | ||||
-rwxr-xr-x | test/utils/serve_service/test_runner.py | 4 |
3 files changed, 10 insertions, 7 deletions
diff --git a/test/buildtool/serve_api/target_level_cache_client.test.cpp b/test/buildtool/serve_api/target_level_cache_client.test.cpp index 00c3e493..972d57eb 100644 --- a/test/buildtool/serve_api/target_level_cache_client.test.cpp +++ b/test/buildtool/serve_api/target_level_cache_client.test.cpp @@ -35,34 +35,34 @@ TEST_CASE("Serve service client: tree-of-commit request", "[serve_api]") { ServeTargetLevelCacheClient tlc_client(info->host, info->port); SECTION("Commit in bare checkout") { - auto root_id = tlc_client.ServeCommitTree(kRootCommit, "."); + auto root_id = tlc_client.ServeCommitTree(kRootCommit, ".", false); REQUIRE(root_id); CHECK(root_id.value() == kRootId); - auto baz_id = tlc_client.ServeCommitTree(kRootCommit, "baz"); + auto baz_id = tlc_client.ServeCommitTree(kRootCommit, "baz", false); REQUIRE(baz_id); CHECK(baz_id.value() == kBazId); } SECTION("Commit in non-bare checkout") { - auto root_id = tlc_client.ServeCommitTree(kRootSymCommit, "."); + auto root_id = tlc_client.ServeCommitTree(kRootSymCommit, ".", false); REQUIRE(root_id); CHECK(root_id.value() == kRootSymId); - auto baz_id = tlc_client.ServeCommitTree(kRootSymCommit, "baz"); + auto baz_id = tlc_client.ServeCommitTree(kRootSymCommit, "baz", false); REQUIRE(baz_id); CHECK(baz_id.value() == kBazSymId); } SECTION("Subdir not found") { auto root_id = - tlc_client.ServeCommitTree(kRootCommit, "does_not_exist"); + tlc_client.ServeCommitTree(kRootCommit, "does_not_exist", false); CHECK_FALSE(root_id); } SECTION("Commit not known") { auto root_id = tlc_client.ServeCommitTree( - "0123456789abcdef0123456789abcdef01234567", "."); + "0123456789abcdef0123456789abcdef01234567", ".", false); CHECK_FALSE(root_id); } } diff --git a/test/end-to-end/just-mr/absent-roots.sh b/test/end-to-end/just-mr/absent-roots.sh index ff3b738f..7f3154a6 100644 --- a/test/end-to-end/just-mr/absent-roots.sh +++ b/test/end-to-end/just-mr/absent-roots.sh @@ -67,6 +67,7 @@ cat repos.json cat > .just-servec <<EOF { "repositories": ["${REPO_ROOT}"] , "remote service": {"info file": "${INFOFILE}", "pid file": "${PIDFILE}"} +, "local build root": "${LBR}" } EOF echo "Serve service configuration:" diff --git a/test/utils/serve_service/test_runner.py b/test/utils/serve_service/test_runner.py index 08681646..b043b363 100755 --- a/test/utils/serve_service/test_runner.py +++ b/test/utils/serve_service/test_runner.py @@ -62,6 +62,7 @@ if os.path.exists(TEST_SERVE_REPO_2): SERVE_REPOSITORIES = ";".join([TEST_SERVE_REPO_1, TEST_SERVE_REPO_2]) REMOTE_SERVE_INFO = os.path.join(REMOTE_DIR, "info_serve.json") +SERVE_LBR = os.path.join(REMOTE_DIR, "serve-build-root") if os.path.exists(REMOTE_SERVE_INFO): print(f"Warning: removing unexpected info file {REMOTE_SERVE_INFO}") @@ -79,7 +80,8 @@ with open(SERVE_CONFIG_FILE, "w") as f: }, "remote service": { "info file": REMOTE_SERVE_INFO - } + }, + "local build root": SERVE_LBR })) serve_cmd = ["./bin/just", "serve", SERVE_CONFIG_FILE] |