mirror of
https://github.com/ovh/the-bastion.git
synced 2025-09-05 04:24:11 +08:00
chore: tests: support multiple unit-tests
This commit is contained in:
parent
89e49ac8b7
commit
b444dc027f
2 changed files with 18 additions and 8 deletions
|
@ -29,6 +29,8 @@ chmod 0644 "$basedir"/bin/dev/perlcriticrc
|
|||
chmod 0700 "$basedir"/bin/admin/install
|
||||
chmod 0700 "$basedir"/contrib
|
||||
chmod 0700 "$basedir"/bin/sudogen
|
||||
chmod 0700 "$basedir"/tests
|
||||
test -d "$basedir"/install && chmod 0700 "$basedir"/install
|
||||
|
||||
while IFS= read -r -d '' file
|
||||
do
|
||||
|
@ -49,8 +51,9 @@ chmod 0755 "$basedir"/docker/entrypoint.sh \
|
|||
"$basedir"/tests/functional/launch_tests_on_instance.sh \
|
||||
"$basedir"/tests/functional/docker/target_role.sh \
|
||||
"$basedir"/tests/functional/docker/tester_role.sh \
|
||||
"$basedir"/tests/functional/fake_ttyrec.sh \
|
||||
"$basedir"/tests/unit/run.pl
|
||||
"$basedir"/tests/functional/fake_ttyrec.sh
|
||||
|
||||
find "$basedir"/tests/unit -type f -name "*.pl" -print0 | xargs -r0 chmod 0755 --
|
||||
|
||||
while IFS= read -r -d '' plugin
|
||||
do
|
||||
|
|
|
@ -418,10 +418,10 @@ runtests()
|
|||
for module in "$(dirname $0)"/tests.d/???-*.sh
|
||||
do
|
||||
if [ -n "$TEST_SCRIPT" ] && [ "$TEST_SCRIPT" != "$(basename "$module")" ]; then
|
||||
echo "### SKIPPING MODULE $module"
|
||||
echo "### SKIPPING MODULE $(basename $module)"
|
||||
continue
|
||||
fi
|
||||
echo "### RUNNING MODULE $module"
|
||||
echo "### RUNNING MODULE $(basename $module)"
|
||||
|
||||
# as this is a loop, we do the check in a reversed way, see any included module for more info:
|
||||
# shellcheck disable=SC1090
|
||||
|
@ -434,10 +434,17 @@ runtests()
|
|||
|
||||
COUNTONLY=0
|
||||
echo === running unit tests ===
|
||||
if ! $r0 perl "$remote_basedir/tests/unit/run.pl"; then
|
||||
printf "%b%b%b\\n" "$WHITE_ON_RED" "Unit tests failed :(" "$NOC"
|
||||
exit 1
|
||||
fi
|
||||
# a while read loop doesn't work well here:
|
||||
# shellcheck disable=SC2044
|
||||
for f in $(find "$basedir/tests/unit/" -mindepth 1 -maxdepth 1 -type f -name "*.pl" -print)
|
||||
do
|
||||
fbasename=$(basename "$f")
|
||||
echo "-> $fbasename"
|
||||
if ! $r0 perl "$remote_basedir/tests/unit/$fbasename"; then
|
||||
printf "%b%b%b\\n" "$WHITE_ON_RED" "Unit tests failed :(" "$NOC"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
COUNTONLY=1
|
||||
testno=0
|
||||
|
|
Loading…
Add table
Reference in a new issue