Skip to content

Commit

Permalink
Exit value from subshell
Browse files Browse the repository at this point in the history
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
  • Loading branch information
phracek authored and pkubatrh committed Jun 7, 2022
1 parent 338e483 commit b0bd592
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,7 @@ check-latest-imagestream:
check-betka:
cd tests && ./check_betka.sh

check: check-failures check-squash check-latest-imagestream
check-remote-containers:
TESTED_IMAGES="$(TESTED_IMAGES)" tests/remote-containers.sh

check: check-failures check-squash check-latest-imagestream check-remote-containers
26 changes: 16 additions & 10 deletions tests/remote-containers.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#! /bin/bash

set -e

declare -A IMAGES

for image in ${TESTED_IMAGES}; do
Expand Down Expand Up @@ -49,7 +47,7 @@ analyse_commits ()

analyse_commits

test_short_summary=''
test_short_summary=""
TESTSUITE_RESULT=0

for image in "${!IMAGES[@]}"; do
Expand Down Expand Up @@ -94,23 +92,31 @@ for image in "${!IMAGES[@]}"; do
# TODO: Do we have to test all $(VERSION)s?
# TODO: The PS4 hack doesn't work if we run the testsuite as UID=0.
PS4="+ [$image] " make TARGET="$OS" test
if test $? -eq 0 ; then
printf -v test_short_summary "${test_short_summary}[PASSED] $image\n"
test_ret_value=$?
# Cleanup.
make clean

if test $test_ret_value -eq 0 ; then
info "Tests for $image succeeded."
exit 0
else
printf -v test_short_summary "${test_short_summary}[FAILED] $image\n"
info "Tests for $image failed."
TESTSUITE_RESULT=1
exit 1
fi
# Cleanup.
make clean
)
if test $? -eq 0 ; then
printf -v test_short_summary "${test_short_summary}[PASSED] $image\n"
else
printf -v test_short_summary "${test_short_summary}[FAILED] $image\n"
TESTSUITE_RESULT=1
fi
done

echo "$test_short_summary"

if [ $TESTSUITE_RESULT -eq 0 ] ; then
echo "Tests for 'container-common-scripts' succeeded."
else
echo "Tests for 'container-common-scripts' failed."
fi

exit $TESTSUITE_RESULT

0 comments on commit b0bd592

Please sign in to comment.