From bbadd3e82cb4b56af5f68d5ff0c376fb433c9687 Mon Sep 17 00:00:00 2001 From: ssube Date: Thu, 12 Aug 2021 23:30:42 -0500 Subject: [PATCH] fix(build): make example test script compatible with container build targets --- run.mk | 6 ++++-- scripts/ci-project-path.sh | 2 +- scripts/test-examples.sh | 7 +++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/run.mk b/run.mk index 601642a..76f75e6 100644 --- a/run.mk +++ b/run.mk @@ -32,11 +32,13 @@ test-rules: build-bundle --tag salty-dog > /dev/null || exit 1; \ done +DOCKER_OPTIONS ?= + local-alpine: - docker run --rm -v "$(shell pwd):/salty-dog" -w /salty-dog node:16-stretch make ci + docker run $(DOCKER_OPTIONS) --rm -v "$(shell pwd):/salty-dog" -w /salty-dog node:16-alpine sh -c "apk add build-base git && make ci" local-stretch: - docker run --rm -v "$(shell pwd):/salty-dog" -w /salty-dog node:16-alpine sh -c "apk add build-base git && make ci" + docker run $(DOCKER_OPTIONS) --rm -v "$(shell pwd):/salty-dog" -w /salty-dog node:16-stretch bash -c "make ci" local-chown-leaks: ## clean up root-owned files the containers may leak sudo chown -R ${USER}:${USER} $(ROOT_PATH) diff --git a/scripts/ci-project-path.sh b/scripts/ci-project-path.sh index f941420..e0195ca 100755 --- a/scripts/ci-project-path.sh +++ b/scripts/ci-project-path.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh PROJECT="${ROOT_PATH}" PARENT="$(dirname "${PROJECT}")" diff --git a/scripts/test-examples.sh b/scripts/test-examples.sh index f95997b..35507ab 100755 --- a/scripts/test-examples.sh +++ b/scripts/test-examples.sh @@ -35,8 +35,9 @@ do 2> ${STDERR_PATH} ACTUAL_STATUS=$? + echo "Test status: ${ACTUAL_STATUS}" - if [[ -s ${STDOUT_PATH} ]]; + if [ -s ${STDOUT_PATH} ]; then echo "Test output:" echo "===" @@ -46,7 +47,7 @@ do echo "===" fi - if [[ -s ${STDERR_PATH} ]]; + if [ -s ${STDERR_PATH} ]; then echo "Test errors:" echo "===" @@ -56,8 +57,6 @@ do echo "===" fi - echo "Test status: ${ACTUAL_STATUS}" - if [ "${ACTUAL_STATUS}" != "${EXPECTED_STATUS}" ]; then echo "Exit status does not match! (expected ${EXPECTED_STATUS}, got ${ACTUAL_STATUS})"