From d5c397c677076779f77011b757e6e173c94bfd3b Mon Sep 17 00:00:00 2001 From: jpirnay Date: Wed, 29 Apr 2026 12:07:46 +0200 Subject: [PATCH] Amend test script to no longer fail if environment is not properly setup --- test/run_epub_css_test.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/test/run_epub_css_test.sh b/test/run_epub_css_test.sh index 6b1f0eab..e8bf238b 100644 --- a/test/run_epub_css_test.sh +++ b/test/run_epub_css_test.sh @@ -7,14 +7,29 @@ BINARY="$BUILD_DIR/CssParserTest" PLATFORMIO_DIR="${PLATFORMIO_CORE_DIR:-$HOME/.platformio}" ARDUINO_FRAMEWORK_DIR="$PLATFORMIO_DIR/packages/framework-arduinoespressif32" +PIO_CMD="" +if command -v pio >/dev/null 2>&1; then + PIO_CMD="pio" +elif command -v platformio >/dev/null 2>&1; then + PIO_CMD="platformio" +fi + +if [ ! -d "$PLATFORMIO_DIR" ] && [ -n "$PIO_CMD" ]; then + PLATFORMIO_DIR="$($PIO_CMD settings get home_dir 2>/dev/null || true)" + if [ -n "$PLATFORMIO_DIR" ] && [ -d "$PLATFORMIO_DIR" ]; then + ARDUINO_FRAMEWORK_DIR="$PLATFORMIO_DIR/packages/framework-arduinoespressif32" + echo "Using PLATFORMIO_DIR from $PIO_CMD: $PLATFORMIO_DIR" + fi +fi + if [ ! -d "$PLATFORMIO_DIR" ]; then - echo "ERROR: PLATFORMIO_DIR does not exist: $PLATFORMIO_DIR" >&2 - exit 1 + echo "SKIP: PLATFORMIO_DIR does not exist and PlatformIO could not be located; skipping EPUB CSS test." >&2 + exit 0 fi if [ ! -d "$ARDUINO_FRAMEWORK_DIR" ]; then - echo "ERROR: ARDUINO_FRAMEWORK_DIR does not exist: $ARDUINO_FRAMEWORK_DIR" >&2 - exit 1 + echo "SKIP: ARDUINO_FRAMEWORK_DIR does not exist: $ARDUINO_FRAMEWORK_DIR; skipping EPUB CSS test." >&2 + exit 0 fi mkdir -p "$BUILD_DIR"