From dc8354a74dbec2a6dbde23e4b245676a1a842880 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Fri, 15 Mar 2024 17:05:21 +0100 Subject: Test "serve-query-target-cache-value": adaopt to standalone This test tries to demonstrate that even if the remote-execution has forgotten the action, the target-level cache of just serve will allow a successful build without repeating the action. It does it by cleaning the local build root of the remote-execution service. If, however, serve and execute are the same process, they also use the same local build root, so the target-level cache entry needs to be kept alive separately. --- .../serve_query_target_cache_value.sh | 27 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/end-to-end/serve-service/serve_query_target_cache_value.sh b/test/end-to-end/serve-service/serve_query_target_cache_value.sh index 9a09ec47..54e68d51 100644 --- a/test/end-to-end/serve-service/serve_query_target_cache_value.sh +++ b/test/end-to-end/serve-service/serve_query_target_cache_value.sh @@ -25,6 +25,8 @@ env readonly JUST="${PWD}/bin/tool-under-test" readonly JUST_MR="${PWD}/bin/mr-tool-under-test" readonly LBR="${TEST_TMPDIR}/local-build-root" +readonly LBR_UNRELATED_A="${TEST_TMPDIR}/local-build-root-unrelated-A" +readonly LBR_UNRELATED_B="${TEST_TMPDIR}/local-build-root-unrelated-B" readonly TOOLS_DIR="${TEST_TMPDIR}/tools" readonly OUT="${TEST_TMPDIR}/out" @@ -93,16 +95,15 @@ cat "${CONF}" echo "${JUST}" build \ - --local-build-root "${SERVE_LBR}" \ + --local-build-root "${LBR_UNRELATED_A}" \ -C "${CONF}" \ + --remote-serve-address "${SERVE}" \ -r "${REMOTE_EXECUTION_ADDRESS}" \ ${COMPAT} \ ${REMOTE_PROPERTIES} \ ${DISPATCH} \ -D '{"ENV": {"TOOLS": "'${TOOLS_DIR}'"}}' 2>&1 -ls -R "${SERVE_LBR}" - # Demonstrate that from now on, we don't build anything any more rm -rf "${TOOLS_DIR}" @@ -127,7 +128,25 @@ echo "failed as expected" # Demonstrate we cannot build with a clean remote CAS "${JUST}" gc --local-build-root ${REMOTE_LBR} 2>&1 +if [ -n "${STANDALONE_SERVE:-}" ] +then + # if serve and remote-execution are the same process + # they also use the same local build root; in this case, + # we need to keep the target-level cache of the serve + # process alive + echo "Building with serve again, to keep tc cache alive" + "${JUST}" build \ + --local-build-root "${LBR_UNRELATED_B}" \ + -C "${CONF}" \ + --remote-serve-address "${SERVE}" \ + -r "${REMOTE_EXECUTION_ADDRESS}" \ + ${COMPAT} \ + ${REMOTE_PROPERTIES} \ + ${DISPATCH} \ + -D '{"ENV": {"TOOLS": "'${TOOLS_DIR}'"}}' 2>&1 +fi "${JUST}" gc --local-build-root ${REMOTE_LBR} 2>&1 +echo "${JUST}" build \ --local-build-root "${LBR}" \ @@ -136,7 +155,7 @@ echo "failed as expected" ${COMPAT} \ ${REMOTE_PROPERTIES} \ ${DISPATCH} \ - -D '{"ENV": {"TOOLS": "'${TOOLS_DIR}'"}}' 2>&1 && echo "this should fail" && exit 1q + -D '{"ENV": {"TOOLS": "'${TOOLS_DIR}'"}}' 2>&1 && echo "this should fail" && exit 1 echo "failed as expected" # Demonstrate that we can build if serve endpoint provides the target cache value -- cgit v1.2.3