From c3568c9d62bc908c19af68e26b6451494ab8c846 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 27 Mar 2022 19:39:10 -0700 Subject: [PATCH 01/22] Renamke HID.cpp to VirtualHID.cpp to avoid a naming conflict with KeyboardioHID, which causes warnings when running the simulator on macos --- src/kaleidoscope/device/virtual/{HID.cpp => VirtualHID.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/kaleidoscope/device/virtual/{HID.cpp => VirtualHID.cpp} (100%) diff --git a/src/kaleidoscope/device/virtual/HID.cpp b/src/kaleidoscope/device/virtual/VirtualHID.cpp similarity index 100% rename from src/kaleidoscope/device/virtual/HID.cpp rename to src/kaleidoscope/device/virtual/VirtualHID.cpp From 855ed3e9bcd670a85870802445ce5eebbe4d8490 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 28 Mar 2022 10:19:47 -0700 Subject: [PATCH 02/22] Remove (and document removal of) unused sketch preprocessing system --- docs/UPGRADING.md | 10 ++++++++++ .../sketch_preprocessing/sketch_footer.h | 2 -- .../sketch_preprocessing/sketch_header.h | 3 --- 3 files changed, 10 insertions(+), 5 deletions(-) delete mode 100644 src/kaleidoscope_internal/sketch_preprocessing/sketch_footer.h delete mode 100644 src/kaleidoscope_internal/sketch_preprocessing/sketch_header.h diff --git a/docs/UPGRADING.md b/docs/UPGRADING.md index 83548e73..91fa6fe4 100644 --- a/docs/UPGRADING.md +++ b/docs/UPGRADING.md @@ -437,6 +437,16 @@ As a developer, one can continue using `millis()`, but migrating to `Kaleidoscop ## Breaking changes +### Sketch preprocssing system + +We used to support the ability to amend all compiled sketches by +adding code to +`src/kaleidoscope_internal/sketch_preprocessing/sketch_header.h` +and `src/kaleidoscope_internal/sketch_preprocessing/sketch_footer.h`. +The functionality was never used by Kaleidoscope itself and frequently +pulled the (empty) header files from the wrong copy of Kaleidoscope. +If you need this functionality, please open a GitHub issue. + ### Macros This is a guide to upgrading existing Macros code to use the new version of diff --git a/src/kaleidoscope_internal/sketch_preprocessing/sketch_footer.h b/src/kaleidoscope_internal/sketch_preprocessing/sketch_footer.h deleted file mode 100644 index ab5a9d18..00000000 --- a/src/kaleidoscope_internal/sketch_preprocessing/sketch_footer.h +++ /dev/null @@ -1,2 +0,0 @@ -// Any code that appears here is added to the bottom of the preprocessed sketch file. -// NOLINT(build/header_guard) diff --git a/src/kaleidoscope_internal/sketch_preprocessing/sketch_header.h b/src/kaleidoscope_internal/sketch_preprocessing/sketch_header.h deleted file mode 100644 index 338f1217..00000000 --- a/src/kaleidoscope_internal/sketch_preprocessing/sketch_header.h +++ /dev/null @@ -1,3 +0,0 @@ -// Any code that appears here is added to the top of the preprocessed sketch file. -// NOLINT(build/header_guard) -#define KALEIDOSCOPE_SKETCH From 25eadfd0a63e213f9fdaf63c52c4f32f0b7e87a3 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 27 Mar 2022 22:05:20 -0700 Subject: [PATCH 03/22] Stop printing size information when running simulator tests --- etc/makefiles/sketch.mk | 2 +- testing/makefiles/testcase.mk | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/makefiles/sketch.mk b/etc/makefiles/sketch.mk index 4a3743ad..e3cd2151 100644 --- a/etc/makefiles/sketch.mk +++ b/etc/makefiles/sketch.mk @@ -165,7 +165,7 @@ compile: kaleidoscope-hardware-configured $(QUIET) install -d "${OUTPUT_PATH}" $(QUIET) $(ARDUINO_CLI) compile --fqbn "${FQBN}" ${ARDUINO_VERBOSE} --warnings all ${ccache_wrapper_property} ${local_cflags_property} \ - ${_arduino_local_libraries_prop} \ + ${_arduino_local_libraries_prop} ${_ARDUINO_CLI_COMPILE_CUSTOM_FLAGS} \ --library "${KALEIDOSCOPE_DIR}" \ --libraries "${KALEIDOSCOPE_DIR}/plugins/" \ --build-path "${BUILD_PATH}" \ diff --git a/testing/makefiles/testcase.mk b/testing/makefiles/testcase.mk index 15ed42c3..60cacbd4 100644 --- a/testing/makefiles/testcase.mk +++ b/testing/makefiles/testcase.mk @@ -78,6 +78,7 @@ compile-sketch: ${TEST_OBJS} @install -d "${BIN_DIR}" "${LIB_DIR}" $(QUIET) env LIBONLY=yes VERBOSE=${VERBOSE} \ OUTPUT_PATH="${LIB_DIR}" \ + _ARDUINO_CLI_COMPILE_CUSTOM_FLAGS='--build-property upload.maximum_size=""' \ $(MAKE) -f ${top_dir}/etc/makefiles/sketch.mk compile $(QUIET) $(COMPILER_WRAPPER) $(call _arduino_prop,compiler.cpp.cmd) -o "${BIN_DIR}/${BIN_FILE}" \ -lpthread -g -w ${TEST_OBJS} \ From 572d772a8e9222698c22de83a5b1e5d1c321df19 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 28 Mar 2022 00:05:15 -0700 Subject: [PATCH 04/22] Quiet down making the ktestfile. Add an identifier for which test we're running --- testing/makefiles/testcase.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testing/makefiles/testcase.mk b/testing/makefiles/testcase.mk index 60cacbd4..7aef8449 100644 --- a/testing/makefiles/testcase.mk +++ b/testing/makefiles/testcase.mk @@ -69,6 +69,7 @@ build: ${BIN_DIR}/${BIN_FILE} compile-sketch all: run run: ${BIN_DIR}/${BIN_FILE} + $(info Running test $(testcase)) $(QUIET) "${BIN_DIR}/${BIN_FILE}" -t -q ${BIN_DIR}/${BIN_FILE}: ${TEST_OBJS} @@ -95,7 +96,9 @@ generate-testcase: $(if $(HAS_KTEST_FILE), ${SRC_DIR}/generated-testcase.cpp) ${SRC_DIR}/generated-testcase.cpp: test.ktest ifneq (,$(wildcard test.ktest)) - $(info Compiling ${testcase} ktest script into ${SRC_DIR}/generated-testcase.cpp) +ifdef VERBOSE + $(QUIET) $(info Compiling ${testcase} ktest script into ${SRC_DIR}/generated-testcase.cpp) +endif $(QUIET) install -d "${SRC_DIR}" $(QUIET) perl ${top_dir}/testing/bin/ktest-to-cxx \ --ktest=test.ktest \ From 67155b84ad51cb6d68896c63040cd7ba72a03310 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 28 Mar 2022 09:49:37 -0700 Subject: [PATCH 06/22] When running make setup, only clone our submodules shallowly. It's easy for a developer to fix when they want/need to and for 99.9% of use cases is "the right thing" It should also make initial setup much faster --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index c940d834..ad4d15d0 100644 --- a/Makefile +++ b/Makefile @@ -50,10 +50,12 @@ $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/virtual/boards.txt: $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/boards.txt: git clone -c core.symlinks=true \ --recurse-submodules \ + --shallow-submodules \ https://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio \ $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio git clone -c core.symlinks=true \ --recurse-submodules \ + --shallow-submodules \ https://github.com/keyboardio/ArduinoCore-GD32-Keyboardio $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/gd32 update: From 5f03dbd245c49365c72989d72c62cd58210d3627 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 28 Mar 2022 10:08:28 -0700 Subject: [PATCH 07/22] When checking out our arduino core deps for Kaleidoscope dev and use, we don't need the extra copy of Kaleidoscope or the bootloader source code which is included in Arduino cores by convention --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index ad4d15d0..275290e5 100644 --- a/Makefile +++ b/Makefile @@ -51,11 +51,14 @@ $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/boards.txt: git clone -c core.symlinks=true \ --recurse-submodules \ --shallow-submodules \ + --recurse-submodules=':(exclude)avr/bootloaders' \ + --recurse-submodules=':(exclude)avr/libraries/Kaleidoscope' \ https://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio \ $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio git clone -c core.symlinks=true \ --recurse-submodules \ --shallow-submodules \ + --recurse-submodules=':(exclude)libraries/Kaleidoscope' \ https://github.com/keyboardio/ArduinoCore-GD32-Keyboardio $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/gd32 update: From b83604d37eb67bc227fa236ea2ba208993b8718a Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 27 Mar 2022 19:59:02 -0700 Subject: [PATCH 08/22] Fix some dependency errors in test makefile rules that could cause parallel testing to fail --- testing/makefiles/testcase.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/testing/makefiles/testcase.mk b/testing/makefiles/testcase.mk index 7aef8449..1a35608e 100644 --- a/testing/makefiles/testcase.mk +++ b/testing/makefiles/testcase.mk @@ -64,7 +64,7 @@ endif TEST_OBJS=$(patsubst $(SRC_DIR)/%.cpp,${OBJ_DIR}/%.o,$(TEST_FILES)) -build: ${BIN_DIR}/${BIN_FILE} compile-sketch +build: $(if $(HAS_KTEST_FILE), generate-testcase) compile-sketch all: run @@ -72,9 +72,10 @@ run: ${BIN_DIR}/${BIN_FILE} $(info Running test $(testcase)) $(QUIET) "${BIN_DIR}/${BIN_FILE}" -t -q -${BIN_DIR}/${BIN_FILE}: ${TEST_OBJS} +${BIN_DIR}/${BIN_FILE}: compile-sketch # We force sketch recompiliation because otherwise, make won't pick up changes to...anything on the arduino side +.PHONY: compile-sketch compile-sketch: ${TEST_OBJS} @install -d "${BIN_DIR}" "${LIB_DIR}" $(QUIET) env LIBONLY=yes VERBOSE=${VERBOSE} \ @@ -91,9 +92,9 @@ compile-sketch: ${TEST_OBJS} # If we have a test.ktest file, it should be processed into a c++ testcase +.PHONY: generate-testcase generate-testcase: $(if $(HAS_KTEST_FILE), ${SRC_DIR}/generated-testcase.cpp) - ${SRC_DIR}/generated-testcase.cpp: test.ktest ifneq (,$(wildcard test.ktest)) ifdef VERBOSE From 7cb1e225b75bbb8846cbc2a7dbd6f140d9279f08 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 27 Mar 2022 19:59:52 -0700 Subject: [PATCH 09/22] Make it possible to make some test rules a little quieter --- tests/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index dd691f7d..934ff215 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -79,13 +79,13 @@ ${top_dir}/testing/googletest/build/Makefile: install -d ${top_dir}/testing/googletest/build && cd ${top_dir}/testing/googletest/build && cmake -DCMAKE_C_COMPILER=$(call _arduino_prop,compiler.path)$(call _arduino_prop,compiler.c.cmd) -DCMAKE_CXX_COMPILER=$(call _arduino_prop,compiler.path)$(call _arduino_prop,compiler.cpp.cmd) .. ${libcommon_a}: - ${MAKE} -f ${top_dir}/testing/makefiles/libcommon.mk -C ${top_dir}/testing + $(QUIET) ${MAKE} -f ${top_dir}/testing/makefiles/libcommon.mk -C ${top_dir}/testing Makefile: @: ${TESTS}: ${libcommon_a} googletest - ${MAKE} -f ${top_dir}/testing/makefiles/testcase.mk -C $@ testcase=$@ build + $(QUIET) ${MAKE} -f ${top_dir}/testing/makefiles/testcase.mk -C $@ testcase=$@ generate-testcase build run %+run: - ${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $* testcase=$* run + $(QUIET) ${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $* testcase=$* run From 89678327a48091f482aa9f68a7414c35c97bee2d Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 27 Mar 2022 20:00:33 -0700 Subject: [PATCH 10/22] Reformat some testing rules for clarity --- tests/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index 934ff215..4d323ef6 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -56,7 +56,9 @@ all: ${TESTS} run-all run-all: ${TESTS} @for test in ${TESTS}; do \ - ${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $${test} testcase=$${test} run || ERROR=$$?; \ + ${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk \ + -C $${test} \ + testcase=$${test} run || ERROR=$$?; \ done; \ if [ -n $${ERROR} ]; then exit $${ERROR}; fi @@ -67,7 +69,9 @@ cmake-clean: clean: cmake-clean @for test in ${TESTS}; do \ - ${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $${test} testcase=$${test} clean; \ + ${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk \ + -C $${test} \ + testcase=$${test} clean; \ done rm -rf "${build_dir}"/* From 784dd83167001cc9ac2e4efded3f1b64531c49cd Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 27 Mar 2022 20:00:57 -0700 Subject: [PATCH 11/22] Clean up cmake invocation to not require a directory change and not fail if the build directory exists --- tests/Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index 4d323ef6..20c6bed0 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -76,11 +76,17 @@ clean: cmake-clean rm -rf "${build_dir}"/* googletest: ${top_dir}/testing/googletest/build/Makefile - cd ${top_dir}/testing/googletest/build && $(MAKE) + ${MAKE} -C ${top_dir}/testing/googletest/build ${top_dir}/testing/googletest/build/Makefile: $(info googletest Makefile is being remade) - install -d ${top_dir}/testing/googletest/build && cd ${top_dir}/testing/googletest/build && cmake -DCMAKE_C_COMPILER=$(call _arduino_prop,compiler.path)$(call _arduino_prop,compiler.c.cmd) -DCMAKE_CXX_COMPILER=$(call _arduino_prop,compiler.path)$(call _arduino_prop,compiler.cpp.cmd) .. + # This can fail if we're running in parallel, but that'd be harmless + -install -d ${top_dir}/testing/googletest/build + $(QUIET) cmake \ + -S ${top_dir}/testing/googletest \ + -B ${top_dir}/testing/googletest/build \ + -DCMAKE_C_COMPILER=$(call _arduino_prop,compiler.path)$(call _arduino_prop,compiler.c.cmd) \ + -DCMAKE_CXX_COMPILER=$(call _arduino_prop,compiler.path)$(call _arduino_prop,compiler.cpp.cmd) ${libcommon_a}: $(QUIET) ${MAKE} -f ${top_dir}/testing/makefiles/libcommon.mk -C ${top_dir}/testing From 968f2cbb1aa027a3eab482ae9aca47046d0fe163 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 27 Mar 2022 20:31:31 -0700 Subject: [PATCH 12/22] enable cccache for cmake --- tests/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index 20c6bed0..df1be532 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -86,7 +86,9 @@ ${top_dir}/testing/googletest/build/Makefile: -S ${top_dir}/testing/googletest \ -B ${top_dir}/testing/googletest/build \ -DCMAKE_C_COMPILER=$(call _arduino_prop,compiler.path)$(call _arduino_prop,compiler.c.cmd) \ - -DCMAKE_CXX_COMPILER=$(call _arduino_prop,compiler.path)$(call _arduino_prop,compiler.cpp.cmd) + -DCMAKE_CXX_COMPILER=$(call _arduino_prop,compiler.path)$(call _arduino_prop,compiler.cpp.cmd) \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ${libcommon_a}: $(QUIET) ${MAKE} -f ${top_dir}/testing/makefiles/libcommon.mk -C ${top_dir}/testing From d132ad244638f1ff81f206ee61180b81ab9a6f4f Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 27 Mar 2022 20:02:07 -0700 Subject: [PATCH 13/22] move cmake-clean rule up in the file for clarity --- tests/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index df1be532..0e88647b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -53,6 +53,8 @@ generate-testcases: done all: ${TESTS} run-all +cmake-clean: + rm -rf "${top_dir}"/testing/googletest/build/* run-all: ${TESTS} @for test in ${TESTS}; do \ @@ -64,9 +66,6 @@ run-all: ${TESTS} -cmake-clean: - rm -rf "${top_dir}"/testing/googletest/build/* - clean: cmake-clean @for test in ${TESTS}; do \ ${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk \ From 65dd53ba17c682a7bb670b04968a9de4f08fcd77 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 27 Mar 2022 20:04:10 -0700 Subject: [PATCH 14/22] We now run 'generate-testcase' as part of the build process --- tests/Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index 0e88647b..45236d5a 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -44,13 +44,9 @@ include $(top_dir)/etc/makefiles/arduino-cli.mk KALEIDOSCOPE_ETC_DIR ?= $(top_dir)/etc -.PHONY: clean cmake-clean all googletest generate-testcases +.PHONY: clean cmake-clean all googletest -generate-testcases: - @for test in ${TESTS}; do \ - ${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $${test} testcase=$${test} generate-testcase; \ - done all: ${TESTS} run-all cmake-clean: From b71ed0cdad7dc7a8e480ce1938c050263bceec51 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 27 Mar 2022 20:05:29 -0700 Subject: [PATCH 15/22] 'build' now has a proper dependency on generate-testcase. --- tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index 45236d5a..3a1adff0 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -92,7 +92,7 @@ Makefile: @: ${TESTS}: ${libcommon_a} googletest - $(QUIET) ${MAKE} -f ${top_dir}/testing/makefiles/testcase.mk -C $@ testcase=$@ generate-testcase build run + $(QUIET) ${MAKE} -f ${top_dir}/testing/makefiles/testcase.mk -C $@ testcase=$@ build run %+run: $(QUIET) ${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $* testcase=$* run From 091419c919468d51d992a9fb61751733042cf108 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 27 Mar 2022 20:13:44 -0700 Subject: [PATCH 16/22] Switch 'make all' in tests to use our new recursive-testrunner. Output ordering isn't right yet, but it's a lot faster --- tests/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index 3a1adff0..32ad737d 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -47,8 +47,9 @@ KALEIDOSCOPE_ETC_DIR ?= $(top_dir)/etc .PHONY: clean cmake-clean all googletest +all: ${libcommon_a} googletest ${TESTS} + @: -all: ${TESTS} run-all cmake-clean: rm -rf "${top_dir}"/testing/googletest/build/* From 493528a556409d4dac2e40262dcb04a6465a1655 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 28 Mar 2022 00:19:30 -0700 Subject: [PATCH 17/22] If you're using gmake 4.0 or newer, display simulator test output nicer --- Makefile | 5 +++++ tests/Makefile | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 275290e5..c787210f 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,11 @@ MAKEFLAGS += --no-builtin-rules .SUFFIXES: +# GNU Make earlier than 4.0 don't have the output-sync option, but we need it +# to make parallel simulator test output readable. (otherwise it gets interleaved) +ifeq ($(shell test $(firstword $(subst ., ,$(MAKE_VERSION))) -ge 4; echo $$?),0) +SUBDIR_MAKEFLAGS+=--output-sync=target +endif include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/etc/makefiles/arduino-cli.mk diff --git a/tests/Makefile b/tests/Makefile index 32ad737d..6dc80211 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -94,6 +94,3 @@ Makefile: ${TESTS}: ${libcommon_a} googletest $(QUIET) ${MAKE} -f ${top_dir}/testing/makefiles/testcase.mk -C $@ testcase=$@ build run - -%+run: - $(QUIET) ${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $* testcase=$* run From fbbead928b8dfc6463b49a60becdd22395bf6701 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 28 Mar 2022 00:30:22 -0700 Subject: [PATCH 18/22] Don't interleave output from test suite when running under gmake4 or newer. On gmake 3, warn the user --- Makefile | 7 ++++++- testing/makefiles/testcase.mk | 1 + tests/Makefile | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c787210f..29a3464f 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,9 @@ MAKEFLAGS += --no-builtin-rules # GNU Make earlier than 4.0 don't have the output-sync option, but we need it # to make parallel simulator test output readable. (otherwise it gets interleaved) ifeq ($(shell test $(firstword $(subst ., ,$(MAKE_VERSION))) -ge 4; echo $$?),0) -SUBDIR_MAKEFLAGS+=--output-sync=target +MAKEFLAGS+=--output-sync=target +else +_using_old_make=1 endif include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/etc/makefiles/arduino-cli.mk @@ -73,6 +75,9 @@ update: git submodule update --init --recursive simulator-tests: +ifneq ($(_using_old_make),) + $(info You're using an older version of GNU Make that doesn't offer the --output-sync option. If you're running the test suite in parallel, output may be garbled. You might consider using GNU Make 4.0 or later instead) +endif $(MAKE) -C tests all docker-simulator-tests: diff --git a/testing/makefiles/testcase.mk b/testing/makefiles/testcase.mk index 1a35608e..1629c51b 100644 --- a/testing/makefiles/testcase.mk +++ b/testing/makefiles/testcase.mk @@ -69,6 +69,7 @@ build: $(if $(HAS_KTEST_FILE), generate-testcase) compile-sketch all: run run: ${BIN_DIR}/${BIN_FILE} + $(info ) $(info Running test $(testcase)) $(QUIET) "${BIN_DIR}/${BIN_FILE}" -t -q diff --git a/tests/Makefile b/tests/Makefile index 6dc80211..f00e2ad7 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -36,6 +36,10 @@ TESTS := $(shell cd $(tests_dir); find ${TEST_PATH} -name '*.ino' -exec dirname KALEIDOSCOPE_CCACHE = 1 +# The clutter up the test output on Make 4.0 and newer +MAKEFLAGS += --no-print-directory + + include $(top_dir)/etc/makefiles/arduino-cli.mk # If we start off in tests to run make all, the sketch makefiles guess the wrong location for From 938536f55302f81aeae04b101e66541c8f9f65f9 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 28 Mar 2022 09:47:05 -0700 Subject: [PATCH 19/22] Don't turn on ccache unless asked for on the commandline --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 37905e72..f19747e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,6 @@ on: [push, pull_request] env: LC_ALL: C - KALEIDOSCOPE_CCACHE: 1 ARDUINO_DIRECTORIES_USER: ${{ github.workspace }}/.arduino/user CLANG_FORMAT_CMD: clang-format-12 jobs: From 430b5bac5381a7a8ec9f05b3dd9d518c280f4ca6 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 27 Mar 2022 22:14:35 -0700 Subject: [PATCH 20/22] Try to cache the files Arduino downloads --- .github/workflows/build.yml | 22 ++++++++++++++++------ testing/makefiles/testcase.mk | 1 - 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f19747e6..8bee6b85 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,18 +11,28 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - -## We delete the Bundle's version of Kaleidoscope, and symlink ourselves in. -## This makes sure we're using the current version of the library. - - run: sudo apt-get install ccache + - name: Cache arduino dep downloads + uses: actions/cache@v2 + with: + path: ${{ github.workspace}}/.arduino/downloads + key: ${{ runner.os }}-arduino-downloads + - run: sudo apt update + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 - run: make setup - run: make -j $(nproc) smoke-sketches run-google-tests: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 -# - uses: mxschmitt/action-tmate@v3 - - run: sudo apt-get install ccache + - name: Cache arduino dep downloads + uses: actions/cache@v2 + with: + path: ${{ github.workspace}}/.arduino/downloads + key: ${{ runner.os }}-arduino-downloads + - run: sudo apt update + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 - run: make setup - run: make -j $(nproc) simulator-tests check-formatting: diff --git a/testing/makefiles/testcase.mk b/testing/makefiles/testcase.mk index 1629c51b..5bf4e46e 100644 --- a/testing/makefiles/testcase.mk +++ b/testing/makefiles/testcase.mk @@ -92,7 +92,6 @@ compile-sketch: ${TEST_OBJS} # If we have a test.ktest file, it should be processed into a c++ testcase - .PHONY: generate-testcase generate-testcase: $(if $(HAS_KTEST_FILE), ${SRC_DIR}/generated-testcase.cpp) From fa6b6dc6bddf9712a4950f0779ee67c03e1be8c4 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 27 Mar 2022 20:26:42 -0700 Subject: [PATCH 21/22] Try a fancy new ccache action --- .github/workflows/build.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8bee6b85..86483dfb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,11 +16,8 @@ jobs: with: path: ${{ github.workspace}}/.arduino/downloads key: ${{ runner.os }}-arduino-downloads - - run: sudo apt update - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - run: make setup - - run: make -j $(nproc) smoke-sketches + - run: KALEIDOSCOPE_TEMP_PATH=${{ github.workspace}}/.kaleidoscope-temp make -j $(nproc) smoke-sketches run-google-tests: runs-on: ubuntu-20.04 steps: @@ -34,7 +31,7 @@ jobs: - name: ccache uses: hendrikmuhs/ccache-action@v1.2 - run: make setup - - run: make -j $(nproc) simulator-tests + - run: KALEIDOSCOPE_CCACHE=1 make -j $(nproc) --output-sync=recurse simulator-tests check-formatting: runs-on: ubuntu-latest steps: From 5805fb111779a102aa97877fb608d67b145e385e Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 28 Mar 2022 09:40:25 -0700 Subject: [PATCH 22/22] We shouldn't unilaterally force CCACHE to on when running tests --- tests/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index f00e2ad7..fc0466fe 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -34,8 +34,6 @@ export FQBN ?= keyboardio:virtual:model01 TESTS := $(shell cd $(tests_dir); find ${TEST_PATH} -name '*.ino' -exec dirname {} \;) -KALEIDOSCOPE_CCACHE = 1 - # The clutter up the test output on Make 4.0 and newer MAKEFLAGS += --no-print-directory