Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Runner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,16 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr

if allow_ccache
write(io, """
# Override `\${CCACHE}` setting from the outside.
CCACHE=""
if [[ \${USE_CCACHE} == "true" ]]; then
CCACHE="ccache"
fi
""")
end
# Don't evaluate `${CCACHE}` at all if not allowed in the first place.
write(io, """
vrun \${CCACHE} $(prog) "\${PRE_FLAGS[@]}" "\${ARGS[@]}" "\${POST_FLAGS[@]}"
vrun $(allow_ccache ? "\${CCACHE} " : "")$(prog) "\${PRE_FLAGS[@]}" "\${ARGS[@]}" "\${POST_FLAGS[@]}"
""")
end

Expand Down
6 changes: 6 additions & 0 deletions test/runners.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ end
"""
test_script = """
set -e
# Make sure setting `CCACHE` doesn't affect the compiler wrappers.
export CCACHE=pwned
export USE_CCACHE=false
echo '$(test_c)' > test.c
echo '$(main_c)' > main.c
# Build object file
Expand Down Expand Up @@ -222,6 +225,9 @@ end
set -e
echo '$(test_cpp)' > test.cpp
echo '$(main_cpp)' > main.cpp
# Make sure setting `CCACHE` doesn't affect the compiler wrappers.
export CCACHE=pwned
export USE_CCACHE=true
# Build object file
$(compiler) $(needfpic) -Werror -std=c++11 -c test.cpp -o test.o
# Link shared library
Expand Down
Loading