diff --git a/containers/agent-debian-testing-buildkite/Dockerfile b/containers/agent-debian-testing-buildkite/Dockerfile index b0b2053..6c025f8 100644 --- a/containers/agent-debian-testing-buildkite/Dockerfile +++ b/containers/agent-debian-testing-buildkite/Dockerfile @@ -40,7 +40,8 @@ RUN groupadd -g ${gid} ${group} ;\ RUN chown -R ${user}:${user} /home/${user} WORKDIR /home/${user} -ENV CCACHE_PATH=/mnt/disks/ssd0/ccache +ENV CCACHE_DIR=/mnt/disks/ssd0/ccache +ENV CCACHE_MAXSIZE=20G # configure locale RUN sed --in-place '/en_US.UTF-8/s/^#//' /etc/locale.gen ;\ diff --git a/containers/agent-debian-testing-buildkite/start_agent.sh b/containers/agent-debian-testing-buildkite/start_agent.sh index 4c6181b..4be51f5 100755 --- a/containers/agent-debian-testing-buildkite/start_agent.sh +++ b/containers/agent-debian-testing-buildkite/start_agent.sh @@ -22,8 +22,8 @@ mkdir -p "${AGENT_ROOT}" chown -R ${USER}:${USER} "${AGENT_ROOT}" # prepare folder for ccache -mkdir -p "${CCACHE_PATH}" -chown -R ${USER}:${USER} "${CCACHE_PATH}" +mkdir -p "${CCACHE_DIR}" +chown -R ${USER}:${USER} "${CCACHE_DIR}" # TODO(kuhnel): wipe the disk(s) on startup diff --git a/containers/agent-debian-testing-ssd/Dockerfile b/containers/agent-debian-testing-ssd/Dockerfile index 82c3dfc..cc87a1a 100644 --- a/containers/agent-debian-testing-ssd/Dockerfile +++ b/containers/agent-debian-testing-ssd/Dockerfile @@ -46,7 +46,8 @@ RUN groupadd -g ${gid} ${group} ;\ RUN chown -R ${user}:${user} /home/${user} WORKDIR /home/${user} -ENV CCACHE_PATH=/mnt/disks/ssd0/ccache +ENV CCACHE_DIR=/mnt/disks/ssd0/ccache +ENV CCACHE_MAXSIZE=20G # configure locale RUN sed --in-place '/en_US.UTF-8/s/^#//' /etc/locale.gen ;\ diff --git a/containers/agent-debian-testing-ssd/start_agent.sh b/containers/agent-debian-testing-ssd/start_agent.sh index d8c00d2..2a83809 100755 --- a/containers/agent-debian-testing-ssd/start_agent.sh +++ b/containers/agent-debian-testing-ssd/start_agent.sh @@ -26,8 +26,8 @@ mkdir -p "${AGENT_ROOT}" chown -R jenkins:jenkins "${AGENT_ROOT}" # prepare folder for ccache -mkdir -p "${CCACHE_PATH}" -chown -R jenkins:jenkins "${CCACHE_PATH}" +mkdir -p "${CCACHE_DIR}" +chown -R jenkins:jenkins "${CCACHE_DIR}" # copy ssh keys to user jenkins mkdir -p ${SSH_KEY_TARGET} diff --git a/containers/buildkite-premerge-debian/start_agent.sh b/containers/buildkite-premerge-debian/start_agent.sh index 4758acc..698cc1f 100755 --- a/containers/buildkite-premerge-debian/start_agent.sh +++ b/containers/buildkite-premerge-debian/start_agent.sh @@ -20,9 +20,10 @@ USER=buildkite-agent mkdir -p "${BUILDKITE_BUILD_PATH}" chown -R ${USER}:${USER} "${BUILDKITE_BUILD_PATH}" -export CCACHE_PATH="${BUILDKITE_BUILD_PATH}"/ccache -mkdir -p "${CCACHE_PATH}" -chown -R ${USER}:${USER} "${CCACHE_PATH}" +export CCACHE_DIR="${BUILDKITE_BUILD_PATH}"/ccache +export CCACHE_MAXSIZE=20G +mkdir -p "${CCACHE_DIR}" +chown -R ${USER}:${USER} "${CCACHE_DIR}" # /mnt/ssh should contain known_hosts, id_rsa and id_rsa.pub . mkdir -p /var/lib/buildkite-agent/.ssh diff --git a/scripts/buildkite/build_branch_pipeline.py b/scripts/buildkite/build_branch_pipeline.py index 38edded..4897c9f 100755 --- a/scripts/buildkite/build_branch_pipeline.py +++ b/scripts/buildkite/build_branch_pipeline.py @@ -37,6 +37,7 @@ if __name__ == '__main__': 'set -euo pipefail', 'ccache --clear' if no_cache else '', 'ccache --zero-stats', + 'ccache --show-config', 'mkdir -p artifacts', 'dpkg -l >> artifacts/packages.txt', 'export SRC=${BUILDKITE_BUILD_PATH}/llvm-premerge-checks', @@ -55,6 +56,7 @@ if __name__ == '__main__': f'--projects="{projects}" --log-level={log_level} {filter_output}', 'EXIT_STATUS=\\$?', 'echo "--- ccache stats"', + 'ccache --print-stats', 'ccache --show-stats', 'exit \\$EXIT_STATUS', ], diff --git a/scripts/buildkite/build_master_pipeline.py b/scripts/buildkite/build_master_pipeline.py index 6d357f6..e119640 100755 --- a/scripts/buildkite/build_master_pipeline.py +++ b/scripts/buildkite/build_master_pipeline.py @@ -37,6 +37,7 @@ if __name__ == '__main__': 'set -euo pipefail', 'ccache --clear' if no_cache else '', 'ccache --zero-stats', + 'ccache --show-config', 'mkdir -p artifacts', 'dpkg -l >> artifacts/packages.txt', 'export SRC=${BUILDKITE_BUILD_PATH}/llvm-premerge-checks', @@ -49,6 +50,7 @@ if __name__ == '__main__': f'${{SRC}}/scripts/premerge_checks.py --projects="{projects}" --log-level={log_level} {filter_output}', 'EXIT_STATUS=\\$?', 'echo "--- ccache stats"', + 'ccache --print-stats', 'ccache --show-stats', 'exit \\$EXIT_STATUS', ], diff --git a/scripts/run_cmake.py b/scripts/run_cmake.py index 366ad0c..5375223 100755 --- a/scripts/run_cmake.py +++ b/scripts/run_cmake.py @@ -123,12 +123,10 @@ def _create_args(config: Configuration, llvm_enable_projects: str, use_cache: bo '-DCMAKE_CXX_COMPILER_LAUNCHER=sccache', ]) # enable ccache if the path is set in the environment - elif 'CCACHE_PATH' in os.environ: + elif 'CCACHE_DIR' in os.environ: logging.info("using ccache") arguments.extend([ '-D LLVM_CCACHE_BUILD=ON', - '-D LLVM_CCACHE_DIR={}'.format(os.environ['CCACHE_PATH']), - '-D LLVM_CCACHE_MAXSIZE=20G', ]) return arguments diff --git a/scripts/run_cmake.sh b/scripts/run_cmake.sh index 3933271..fa5f17c 100755 --- a/scripts/run_cmake.sh +++ b/scripts/run_cmake.sh @@ -15,7 +15,7 @@ set -eux # Runs Cmake. -# Inputs: CCACHE_PATH, WORKSPACE, TARGET_DIR; $WORKSPACE/build must exist. +# Inputs: CCACHE_DIR, WORKSPACE, TARGET_DIR; $WORKSPACE/build must exist. # Outputs: $TARGET_DIR/CMakeCache.txt, $WORKSPACE/compile_commands.json (symlink). echo "Running CMake... ======================================" @@ -27,7 +27,7 @@ cd "$WORKSPACE"/build set +e cmake -GNinja ../llvm -DCMAKE_BUILD_TYPE=Release -D LLVM_ENABLE_LLD=ON \ -D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libc;libcxx;libcxxabi;lld;libunwind;mlir;flang" \ - -D LLVM_CCACHE_BUILD=ON -D LLVM_CCACHE_DIR="${CCACHE_PATH}" -D LLVM_CCACHE_MAXSIZE=20G \ + -D LLVM_CCACHE_BUILD=ON -D LLVM_CCACHE_DIR="${CCACHE_DIR}" -D LLVM_CCACHE_MAXSIZE=20G \ -D LLVM_ENABLE_ASSERTIONS=ON -DCMAKE_CXX_FLAGS=-gmlt \ -DLLVM_LIT_ARGS="-v --xunit-xml-output ${WORKSPACE}/build/test-results.xml" RETURN_CODE="${PIPESTATUS[0]}" diff --git a/scripts/run_cmake_config.yaml b/scripts/run_cmake_config.yaml index 5818ac5..5cd44f7 100644 --- a/scripts/run_cmake_config.yaml +++ b/scripts/run_cmake_config.yaml @@ -24,7 +24,7 @@ arguments: - '-D LLVM_BUILD_EXAMPLES=ON' - '-D LLVM_LIT_ARGS="-v --xunit-xml-output test-results.xml"' linux: - # CCACHE is enabled in script iff environment variable `CCACHE_PATH` is set + # CCACHE is enabled in script iff environment variable `CCACHE_DIR` is set - '-D LLVM_ENABLE_LLD=ON' - '-D CMAKE_CXX_FLAGS=-gmlt' windows: []