Skip to content

Commit

Permalink
wireguard: selftests: restore support for ccache
Browse files Browse the repository at this point in the history
When moving to non-system toolchains, we inadvertantly killed the
ability to use ccache. So instead, build ccache support into the test
harness directly.

Signed-off-by: Jason A. Donenfeld <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
zx2c4 authored and kuba-moo committed May 5, 2022
1 parent d5d9b29 commit d261ba6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions tools/testing/selftests/wireguard/qemu/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
build/
distfiles/
ccache/
18 changes: 17 additions & 1 deletion tools/testing/selftests/wireguard/qemu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ $(info Building for $(CHOST) using $(CBUILD))
export CROSS_COMPILE := $(CHOST)-
export PATH := $(TOOLCHAIN_PATH)/bin:$(PATH)
export CC := $(CHOST)-gcc
CCACHE_PATH := $(shell which ccache 2>/dev/null)
ifneq ($(CCACHE_PATH),)
export KBUILD_BUILD_TIMESTAMP := Fri Jun 5 15:58:00 CEST 2015
export PATH := $(TOOLCHAIN_PATH)/bin/ccache:$(PATH)
export CCACHE_SLOPPINESS := file_macro,time_macros
export CCACHE_DIR ?= $(PWD)/ccache
endif

USERSPACE_DEPS := $(TOOLCHAIN_PATH)/.installed $(TOOLCHAIN_PATH)/$(CHOST)/include/linux/.installed

Expand Down Expand Up @@ -329,6 +336,10 @@ $(TOOLCHAIN_PATH)/.installed: $(TOOLCHAIN_TAR)
mkdir -p $(BUILD_PATH)
flock -s $<.lock tar -C $(BUILD_PATH) -xf $<
$(STRIP) -s $(TOOLCHAIN_PATH)/$(CHOST)/lib/libc.so
ifneq ($(CCACHE_PATH),)
mkdir -p $(TOOLCHAIN_PATH)/bin/ccache
ln -s $(CCACHE_PATH) $(TOOLCHAIN_PATH)/bin/ccache/$(CC)
endif
touch $@

$(IPERF_PATH)/.installed: $(IPERF_TAR)
Expand Down Expand Up @@ -421,8 +432,13 @@ clean:
distclean: clean
rm -rf $(DISTFILES_PATH)

cacheclean: clean
ifneq ($(CCACHE_DIR),)
rm -rf $(CCACHE_DIR)
endif

menuconfig: $(KERNEL_BUILD_PATH)/.config
$(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

.PHONY: qemu build clean distclean menuconfig
.PHONY: qemu build clean distclean cacheclean menuconfig
.DELETE_ON_ERROR:

0 comments on commit d261ba6

Please sign in to comment.