From 9dac583e45eafafb9bd9214744e2a7557b873264 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Thu, 28 Mar 2024 16:45:45 -0400 Subject: [PATCH] Patch test projects so they build without deprecated features Also ensure the test scripts pass shellcheck --- CONTRIBUTING.md | 4 +-- test/fetch-test-deps.sh | 40 ++++++++++++++--------------- test/patches/LADX-Disassembly.patch | 15 +++++++++++ test/patches/libbet.patch | 17 ++++++++++++ test/patches/ucity.patch | 25 ++++++++++++++++++ test/run-tests.sh | 20 +++++++-------- 6 files changed, 89 insertions(+), 32 deletions(-) create mode 100644 test/patches/LADX-Disassembly.patch create mode 100644 test/patches/libbet.patch create mode 100644 test/patches/ucity.patch diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c03d834f7..17920559b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -145,12 +145,12 @@ If one *does* exist, RGBGFX's return status is ignored, but its output **must** 2. Add the project to `test/fetch-test-deps.sh`: add a new `action` line at the bottom, following the existing pattern: ```sh - action / + action ``` (The date is used to avoid fetching too much history when cloning the repositories.) 3. Add the project to `test/run-tests.sh`: add a new `test_downstream` line at the bottom, following the existing pattern: ```sh - test_downstream + test_downstream ``` diff --git a/test/fetch-test-deps.sh b/test/fetch-test-deps.sh index 5bfd54337..d8d87f94e 100755 --- a/test/fetch-test-deps.sh +++ b/test/fetch-test-deps.sh @@ -39,7 +39,7 @@ while [[ $# -gt 0 ]]; do break ;; *) - echo "$(basename $0): unknown option "$1"" + echo "$(basename "$0"): unknown option '$1'" exit 1 ;; esac @@ -48,9 +48,9 @@ done case "$actionname" in --get-deps) - action() { # # owner/repo + action() { # _ repo _ _ # libbet depends on PIL to build - if [ "$1" = "pinobatch/libbet" ]; then + if [ "$2" = "libbet" ]; then case "${osname%-*}" in ubuntu|macos) python3 -m pip install pillow @@ -67,38 +67,38 @@ case "$actionname" in ;; --get-hash) - action() { # owner/repo shallow-since commit - printf "%s@%s-" "${1##*/}" "$3" + action() { # _ repo _ commit + printf "%s@%s-" "$2" "$4" } ;; --get-paths) - action() { # owner/repo shallow-since commit - printf "test/%s," "${1##*/}" + action() { # _ repo + printf "test/%s," "$2" } ;; *) echo "Fetching test dependency repositories" - action() { # owner/repo shallow-since commit - if [ ! -d ${1##*/} ]; then - git clone https://github.com/$1.git --shallow-since=$2 --single-branch + action() { # owner repo shallow-since commit + if [ ! -d "$2" ]; then + git clone "https://github.com/$1/$2.git" --shallow-since="$3" --single-branch fi - pushd ${1##*/} - git checkout -f $3 - if [ -f ../patches/${1##*/}.patch ]; then - git apply --ignore-whitespace ../patches/${1##*/}.patch + pushd "$2" + git checkout -f "$4" + if [ -f "../patches/$2.patch" ]; then + git apply --ignore-whitespace "../patches/$2.patch" fi popd } esac if "$nonfree"; then - action pret/pokecrystal 2024-03-03 c1da20e2f12f95c935500151d15f455e7e7eb213 - action pret/pokered 2024-01-02 fabe2b3fb3fb5a849c5220298acabbdc9ad30f3b - action zladx/LADX-Disassembly 2024-02-25 583c78d2f2a5258b87bf133f75b7129228255650 + action pret pokecrystal 2024-03-03 c1da20e2f12f95c935500151d15f455e7e7eb213 + action pret pokered 2024-01-02 fabe2b3fb3fb5a849c5220298acabbdc9ad30f3b + action zladx LADX-Disassembly 2024-02-25 583c78d2f2a5258b87bf133f75b7129228255650 fi -action AntonioND/ucity 2023-11-02 c781ae20c0b319262b19b51e5067a2c93cf3b362 -action pinobatch/libbet 2024-03-09 c98c7574d94f3e1a977bd7e98899f30a1ecbbb17 -action LIJI32/SameBoy 2024-03-08 e7792c16b24c08f55a370973f0beaecb7bd0ab92 +action AntonioND ucity 2023-11-02 c781ae20c0b319262b19b51e5067a2c93cf3b362 +action pinobatch libbet 2024-03-09 c98c7574d94f3e1a977bd7e98899f30a1ecbbb17 +action LIJI32 SameBoy 2024-03-08 e7792c16b24c08f55a370973f0beaecb7bd0ab92 diff --git a/test/patches/LADX-Disassembly.patch b/test/patches/LADX-Disassembly.patch new file mode 100644 index 000000000..f4fd78b07 --- /dev/null +++ b/test/patches/LADX-Disassembly.patch @@ -0,0 +1,15 @@ +diff --git a/Makefile b/Makefile +index d05ccba..1011447 100644 +--- a/Makefile ++++ b/Makefile +@@ -13,9 +13,7 @@ RGBDS := + + ASM := $(RGBDS)rgbasm + ASFLAGS := \ +- --export-all\ +- --halt-without-nop\ +- --preserve-ld ++ --export-all + + LD := $(RGBDS)rgblink + LDFLAGS := diff --git a/test/patches/libbet.patch b/test/patches/libbet.patch new file mode 100644 index 000000000..654d3193d --- /dev/null +++ b/test/patches/libbet.patch @@ -0,0 +1,17 @@ +diff --git a/makefile b/makefile +index 6513518..35826eb 100644 +--- a/makefile ++++ b/makefile +@@ -85,10 +85,10 @@ $(title).gb: $(objlisto) + $(RGBFIX) -jvsc -k "OK" -l 0x33 -m ROM -p 0xFF -t "LIBBET" -v $@ + + obj/gb/%.o: src/%.z80 src/hardware.inc src/global.inc +- ${RGBASM} -h -o $@ $< ++ ${RGBASM} -o $@ $< + + obj/gb/%.o: obj/gb/%.z80 +- ${RGBASM} -h -o $@ $< ++ ${RGBASM} -o $@ $< + + # Files that will be included with incbin + diff --git a/test/patches/ucity.patch b/test/patches/ucity.patch new file mode 100644 index 000000000..0740e2477 --- /dev/null +++ b/test/patches/ucity.patch @@ -0,0 +1,25 @@ +diff --git a/Makefile b/Makefile +index 22c65e9..e7c888d 100644 +--- a/Makefile ++++ b/Makefile +@@ -51,7 +51,7 @@ ASMFILES := $(foreach dir,$(SOURCE_ALL_DIRS),$(wildcard $(dir)/*.asm)) + + # List of include directories: All source and data folders. + # A '/' is appended to the path. +-INCLUDES := $(foreach dir,$(SOURCE_ALL_DIRS),-i$(dir)/) ++INCLUDES := $(foreach dir,$(SOURCE_ALL_DIRS),-I$(dir)/) + + # Prepare object paths from source files. + OBJ := $(ASMFILES:.asm=.obj) +@@ -72,10 +72,9 @@ clean: + @echo rm $(OBJ) $(BIN) $(COMPAT_BIN) $(NAME).sym $(NAME).map + @rm -f $(OBJ) $(BIN) $(COMPAT_BIN) $(NAME).sym $(NAME).map + +-# TODO: Remove the -h when RGBASM is updated to remove it + %.obj : %.asm + @echo rgbasm $< +- @$(RGBASM) $(INCLUDES) -h -E -o$@ $< ++ @$(RGBASM) $(INCLUDES) -E -o$@ $< + + $(BIN): $(OBJ) + @echo rgblink $(BIN) diff --git a/test/run-tests.sh b/test/run-tests.sh index b7d74442a..1097c167c 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -28,7 +28,7 @@ while [[ $# -gt 0 ]]; do break ;; *) - echo "$(basename $0): internal error" + echo "$(basename "$0"): internal error" exit 1 ;; esac @@ -54,21 +54,21 @@ done # When updating subprojects, change the commit being checked out, and set the `shallow-since` # to the day before, to reduce the amount of refs being transferred and thus speed up CI. -test_downstream() { # owner/repo make-target - if ! pushd ${1##*/}; then +test_downstream() { # owner repo make-target + if ! pushd "$2"; then echo >&2 'Please run `'"$FETCH_TEST_DEPS"'` before running the test suite' return 1 fi make clean - make -j4 $2 RGBDS=../../ + make -j4 "$3" RGBDS=../../ popd } if "$nonfree"; then - test_downstream pret/pokecrystal compare - test_downstream pret/pokered compare - test_downstream zladx/LADX-Disassembly '' + test_downstream pret pokecrystal compare + test_downstream pret pokered compare + test_downstream zladx LADX-Disassembly default fi -test_downstream AntonioND/ucity '' -test_downstream pinobatch/libbet all -test_downstream LIJI32/SameBoy bootroms +test_downstream AntonioND ucity all +test_downstream pinobatch libbet all +test_downstream LIJI32 SameBoy bootroms