From f83c6c07b2a7e8c944203adf7c10c428180d2f8e Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Mon, 19 Aug 2024 15:20:57 +0200 Subject: [PATCH] test --- src/asm/output.cpp | 2 +- test/asm/test.sh | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/asm/output.cpp b/src/asm/output.cpp index 70a251c29..b0a4e040f 100644 --- a/src/asm/output.cpp +++ b/src/asm/output.cpp @@ -492,7 +492,7 @@ static bool dumpMacros(FILE *file) { void out_WriteState(std::string name, std::vector const &features) { FILE *file; if (name != "-") { - file = fopen(name.c_str(), "w"); + file = fopen(name.c_str(), "wb"); } else { name = ""; file = fdopen(STDOUT_FILENO, "w"); diff --git a/test/asm/test.sh b/test/asm/test.sh index c175ebdec..ab8485015 100755 --- a/test/asm/test.sh +++ b/test/asm/test.sh @@ -5,6 +5,19 @@ export LC_ALL=C # Game Boy release date, 1989-04-21T12:34:56Z (for reproducible test results) export SOURCE_DATE_EPOCH=609165296 +# On Windows, the paths returned by `mktemp` are Unix paths, whereas RGBDS expects Windows paths. +# Bash implicitly translates them when recognised, but this breaks if the path is prefixed +# (at-files, state file spec, etc.); thus, return an absolute path instead. +w32_path() { + set -x + if which cygpath 2>/dev/null; then + cygpath -w "$1" + else + printf '%s\n' "$1" + fi + set +x +} + o="$(mktemp)" gb="$(mktemp)" input="$(mktemp)" @@ -132,7 +145,7 @@ done # These tests do their own thing i="state-file" -RGBASMFLAGS="-Weverything -s all:$o" +RGBASMFLAGS="-Weverything -s all:$(w32_path "$o")" for variant in '' '.pipe'; do (( tests++ )) echo "${bold}${green}${i%.asm}${variant}...${rescolors}${resbold}"