controller/tests/run_tests.sh

68 lines
1.6 KiB
Bash
Raw Normal View History

#!/usr/bin/env sh
2022-07-19 22:31:28 +00:00
source_dir=$PWD/tests
working_dir=$source_dir/testing_latest
working_bak=$source_dir/testing_bak
2022-07-19 22:31:28 +00:00
rm -rf "$working_bak"
[ -d "$working_dir" ] && mv "$working_dir" "$working_bak"
2022-07-19 22:31:28 +00:00
mkdir -p "$working_dir"
2022-07-19 22:31:28 +00:00
cp "${1:-"target/debug/emgauwa-core"}" "$working_dir/core"
2022-07-19 22:31:28 +00:00
cd "$working_dir" || exit
2022-07-19 22:31:28 +00:00
#target_branch=$(git rev-parse --abbrev-ref HEAD)
2022-07-19 22:31:28 +00:00
#if [ -z "$EMGAUWA_CONTROLLER_EXE" ]
#then
# git clone --quiet ssh://git@git.serguzim.me:3022/emgauwa/controller.git controller || exit
# cd ./controller || exit
#
# git checkout dev >/dev/null 2>&1
# git checkout "$target_branch" >/dev/null 2>&1
# git checkout "$2" >/dev/null 2>&1
#
# echo "Building controller on branch $(git rev-parse --abbrev-ref HEAD)"
# mkdir build
# cd build || exit
#
# cmake -DWIRING_PI_DEBUG=on .. >/dev/null
# make >/dev/null
# EMGAUWA_CONTROLLER_EXE=./controller
#fi
2022-07-19 22:31:28 +00:00
#echo "Emgauwa controller: $($EMGAUWA_CONTROLLER_EXE --version)"
2022-07-19 22:31:28 +00:00
#$EMGAUWA_CONTROLLER_EXE start -c "$source_dir/controller.testing.ini" >"$working_dir/controller.log" 2>&1 &
#controller_id=$!
2022-07-19 22:31:28 +00:00
cd "$working_dir" || exit
2022-07-19 22:31:28 +00:00
EMGAUWA_CORE_EXE="$working_dir/core"
cp "$source_dir/core.testing.ini" "$working_dir/core.ini"
2022-07-19 22:31:28 +00:00
$EMGAUWA_CORE_EXE start >>"$working_dir/core.log" 2>&1 &
core_id=$!
# wait for start
if [ -x "$(command -v wait-for-it)" ]
then
wait-for-it localhost:5000 -t 15
else
echo "waiting 5 seconds for server"
sleep 5;
fi
export PYTHONPATH=$PYTHONPATH:$source_dir/tavern_utils
2022-07-19 22:31:28 +00:00
tavern-ci --disable-warnings "$source_dir/tavern_tests"
test_result=$?
2022-07-19 22:31:28 +00:00
#kill $controller_id
kill $core_id
exit $test_result