Add support to filter tests to run in run-tests.sh

This commit is contained in:
David Capello 2018-12-20 14:23:00 -03:00
parent 72109b99bb
commit 3e23e63824

View File

@ -22,17 +22,23 @@ function expect() {
fi
}
# General information
echo ----------------------------------------------------------------------
echo $ASEPRITE --version
$ASEPRITE --version
echo ----------------------------------------------------------------------
echo Temp dir
t=$(mktemp -d)
echo $t
filter="$*"
if [[ "$filter" != "" ]]; then
echo Filter: $filter
fi
t=$(mktemp -d)
echo Temp dir: $t
if [[ "$filter" == "" ]] || [[ "console" =~ $filter ]]; then
echo ----------------------------------------------------------------------
echo "Testing console..."
$ASEPRITE -b --script scripts/console_assert.lua >$t/tmp 2>$t/tmp_err
! grep -q "this should be in the output" $t/tmp && fail "print() text not found in output"
! grep -q "assertion failed" $t/tmp && fail "assert() text not found in output"
@ -48,13 +54,20 @@ hello world
EOF
! diff -u $t/tmp $t/tmp_expected && fail
fi
fi
echo ----------------------------------------------------------------------
echo "Testing scripts..."
first=0
result=0
for script in scripts/*.lua ; do
[[ $script =~ console ]] && continue
if [[ "$filter" != "" ]]; then
[[ $script =~ $filter ]] || continue
fi
if [ $first == 0 ]; then
echo ----------------------------------------------------------------------
echo "Testing scripts..."
first=1
fi
echo "Running $script"
if ! $ASEPRITE -b --script $script >$t/tmp 2>$t/tmp_err ; then
echo FAILED
@ -64,12 +77,17 @@ for script in scripts/*.lua ; do
fi
done
first=0
for script in cli/*.sh ; do
if [[ "$filter" == "" ]] || [[ $script =~ $filter ]]; then
if [ $first == 0 ]; then
echo ----------------------------------------------------------------------
echo "Testing CLI..."
for script in cli/*.sh ; do
first=1
fi
echo "Running $script"
source $script
fi
done
echo ----------------------------------------------------------------------