mirror of
https://github.com/kevinnlsamuel/stdouterr.git
synced 2025-12-06 09:55:58 +05:30
test: improve test script to run from anywhere + stricter exit on error
This commit is contained in:
19
dev/test
19
dev/test
@@ -13,7 +13,8 @@ project_name='stdouterr'
|
|||||||
project_version='v0.1.0-beta'
|
project_version='v0.1.0-beta'
|
||||||
project_lang='C'
|
project_lang='C'
|
||||||
|
|
||||||
project_root="$( cd .. ; pwd )"
|
script_dir="$(realpath -e $(dirname "${0}") 2>/dev/null)"
|
||||||
|
project_root=${script_dir%/*} # remove everything after the final `/`
|
||||||
|
|
||||||
test_dir="${project_root}/dev/tests.d"
|
test_dir="${project_root}/dev/tests.d"
|
||||||
[[ ! -d "${test_dir}" ]] && mkdir -p "${test_dir}"
|
[[ ! -d "${test_dir}" ]] && mkdir -p "${test_dir}"
|
||||||
@@ -104,9 +105,15 @@ test(){
|
|||||||
echo "=== end of test ==="
|
echo "=== end of test ==="
|
||||||
}
|
}
|
||||||
|
|
||||||
check_compilers \
|
if check_compilers; then
|
||||||
&& compile \
|
if compile; then
|
||||||
&& echo $? \
|
if test "$@"; then
|
||||||
&& test "$@" \
|
echo "completed with exit code $?"
|
||||||
|| exit 1
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
exit_code=$?
|
||||||
|
>>2 echo "some error occurred"
|
||||||
|
exit "${exit_code}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user