1
0
Fork 0

rename CCACHE_PATH to CCACHE_DIR

https://ccache.dev/manual/3.7.11.html#_configuration uses CCACHE_DIR to set
cache directory. CCACHE_PATH has a different meaning.

+ removed LLVM_CCACHE_DIR ccache argument to use CCACHE_DIR from env.
+ print additional info about ccache config and machine readable stats.
This commit is contained in:
Mikhail Goncharov 2020-08-26 12:00:50 +02:00
parent dc1080fc4c
commit 46c9fefb77
10 changed files with 20 additions and 15 deletions

View file

@ -40,7 +40,8 @@ RUN groupadd -g ${gid} ${group} ;\
RUN chown -R ${user}:${user} /home/${user} RUN chown -R ${user}:${user} /home/${user}
WORKDIR /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 # configure locale
RUN sed --in-place '/en_US.UTF-8/s/^#//' /etc/locale.gen ;\ RUN sed --in-place '/en_US.UTF-8/s/^#//' /etc/locale.gen ;\

View file

@ -22,8 +22,8 @@ mkdir -p "${AGENT_ROOT}"
chown -R ${USER}:${USER} "${AGENT_ROOT}" chown -R ${USER}:${USER} "${AGENT_ROOT}"
# prepare folder for ccache # prepare folder for ccache
mkdir -p "${CCACHE_PATH}" mkdir -p "${CCACHE_DIR}"
chown -R ${USER}:${USER} "${CCACHE_PATH}" chown -R ${USER}:${USER} "${CCACHE_DIR}"
# TODO(kuhnel): wipe the disk(s) on startup # TODO(kuhnel): wipe the disk(s) on startup

View file

@ -46,7 +46,8 @@ RUN groupadd -g ${gid} ${group} ;\
RUN chown -R ${user}:${user} /home/${user} RUN chown -R ${user}:${user} /home/${user}
WORKDIR /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 # configure locale
RUN sed --in-place '/en_US.UTF-8/s/^#//' /etc/locale.gen ;\ RUN sed --in-place '/en_US.UTF-8/s/^#//' /etc/locale.gen ;\

View file

@ -26,8 +26,8 @@ mkdir -p "${AGENT_ROOT}"
chown -R jenkins:jenkins "${AGENT_ROOT}" chown -R jenkins:jenkins "${AGENT_ROOT}"
# prepare folder for ccache # prepare folder for ccache
mkdir -p "${CCACHE_PATH}" mkdir -p "${CCACHE_DIR}"
chown -R jenkins:jenkins "${CCACHE_PATH}" chown -R jenkins:jenkins "${CCACHE_DIR}"
# copy ssh keys to user jenkins # copy ssh keys to user jenkins
mkdir -p ${SSH_KEY_TARGET} mkdir -p ${SSH_KEY_TARGET}

View file

@ -20,9 +20,10 @@ USER=buildkite-agent
mkdir -p "${BUILDKITE_BUILD_PATH}" mkdir -p "${BUILDKITE_BUILD_PATH}"
chown -R ${USER}:${USER} "${BUILDKITE_BUILD_PATH}" chown -R ${USER}:${USER} "${BUILDKITE_BUILD_PATH}"
export CCACHE_PATH="${BUILDKITE_BUILD_PATH}"/ccache export CCACHE_DIR="${BUILDKITE_BUILD_PATH}"/ccache
mkdir -p "${CCACHE_PATH}" export CCACHE_MAXSIZE=20G
chown -R ${USER}:${USER} "${CCACHE_PATH}" mkdir -p "${CCACHE_DIR}"
chown -R ${USER}:${USER} "${CCACHE_DIR}"
# /mnt/ssh should contain known_hosts, id_rsa and id_rsa.pub . # /mnt/ssh should contain known_hosts, id_rsa and id_rsa.pub .
mkdir -p /var/lib/buildkite-agent/.ssh mkdir -p /var/lib/buildkite-agent/.ssh

View file

@ -37,6 +37,7 @@ if __name__ == '__main__':
'set -euo pipefail', 'set -euo pipefail',
'ccache --clear' if no_cache else '', 'ccache --clear' if no_cache else '',
'ccache --zero-stats', 'ccache --zero-stats',
'ccache --show-config',
'mkdir -p artifacts', 'mkdir -p artifacts',
'dpkg -l >> artifacts/packages.txt', 'dpkg -l >> artifacts/packages.txt',
'export SRC=${BUILDKITE_BUILD_PATH}/llvm-premerge-checks', 'export SRC=${BUILDKITE_BUILD_PATH}/llvm-premerge-checks',
@ -55,6 +56,7 @@ if __name__ == '__main__':
f'--projects="{projects}" --log-level={log_level} {filter_output}', f'--projects="{projects}" --log-level={log_level} {filter_output}',
'EXIT_STATUS=\\$?', 'EXIT_STATUS=\\$?',
'echo "--- ccache stats"', 'echo "--- ccache stats"',
'ccache --print-stats',
'ccache --show-stats', 'ccache --show-stats',
'exit \\$EXIT_STATUS', 'exit \\$EXIT_STATUS',
], ],

View file

@ -37,6 +37,7 @@ if __name__ == '__main__':
'set -euo pipefail', 'set -euo pipefail',
'ccache --clear' if no_cache else '', 'ccache --clear' if no_cache else '',
'ccache --zero-stats', 'ccache --zero-stats',
'ccache --show-config',
'mkdir -p artifacts', 'mkdir -p artifacts',
'dpkg -l >> artifacts/packages.txt', 'dpkg -l >> artifacts/packages.txt',
'export SRC=${BUILDKITE_BUILD_PATH}/llvm-premerge-checks', '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}', f'${{SRC}}/scripts/premerge_checks.py --projects="{projects}" --log-level={log_level} {filter_output}',
'EXIT_STATUS=\\$?', 'EXIT_STATUS=\\$?',
'echo "--- ccache stats"', 'echo "--- ccache stats"',
'ccache --print-stats',
'ccache --show-stats', 'ccache --show-stats',
'exit \\$EXIT_STATUS', 'exit \\$EXIT_STATUS',
], ],

View file

@ -123,12 +123,10 @@ def _create_args(config: Configuration, llvm_enable_projects: str, use_cache: bo
'-DCMAKE_CXX_COMPILER_LAUNCHER=sccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=sccache',
]) ])
# enable ccache if the path is set in the environment # 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") logging.info("using ccache")
arguments.extend([ arguments.extend([
'-D LLVM_CCACHE_BUILD=ON', '-D LLVM_CCACHE_BUILD=ON',
'-D LLVM_CCACHE_DIR={}'.format(os.environ['CCACHE_PATH']),
'-D LLVM_CCACHE_MAXSIZE=20G',
]) ])
return arguments return arguments

View file

@ -15,7 +15,7 @@
set -eux set -eux
# Runs Cmake. # 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). # Outputs: $TARGET_DIR/CMakeCache.txt, $WORKSPACE/compile_commands.json (symlink).
echo "Running CMake... ======================================" echo "Running CMake... ======================================"
@ -27,7 +27,7 @@ cd "$WORKSPACE"/build
set +e set +e
cmake -GNinja ../llvm -DCMAKE_BUILD_TYPE=Release -D LLVM_ENABLE_LLD=ON \ 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_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 \ -D LLVM_ENABLE_ASSERTIONS=ON -DCMAKE_CXX_FLAGS=-gmlt \
-DLLVM_LIT_ARGS="-v --xunit-xml-output ${WORKSPACE}/build/test-results.xml" -DLLVM_LIT_ARGS="-v --xunit-xml-output ${WORKSPACE}/build/test-results.xml"
RETURN_CODE="${PIPESTATUS[0]}" RETURN_CODE="${PIPESTATUS[0]}"

View file

@ -24,7 +24,7 @@ arguments:
- '-D LLVM_BUILD_EXAMPLES=ON' - '-D LLVM_BUILD_EXAMPLES=ON'
- '-D LLVM_LIT_ARGS="-v --xunit-xml-output test-results.xml"' - '-D LLVM_LIT_ARGS="-v --xunit-xml-output test-results.xml"'
linux: 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 LLVM_ENABLE_LLD=ON'
- '-D CMAKE_CXX_FLAGS=-gmlt' - '-D CMAKE_CXX_FLAGS=-gmlt'
windows: [] windows: []