core-legacy/tests/run_tests.sh

59 lines
1.3 KiB
Bash
Raw Normal View History

2020-05-05 20:29:04 +00:00
#!/usr/bin/env sh
2020-05-10 20:37:55 +00:00
source_dir=$PWD
working_dir=$PWD/testing_tmp
working_bak=$PWD/testing_bak
2020-05-05 20:29:04 +00:00
2020-05-22 23:28:48 +00:00
alias valgrind_emgauwa="valgrind --leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
--log-file=$working_dir/valgrind.log"
2020-05-10 20:37:55 +00:00
rm -rf $working_dir
mkdir -p $working_dir
cd $working_dir
2020-05-05 20:29:04 +00:00
2020-05-31 22:45:08 +00:00
2020-05-10 20:37:55 +00:00
git clone --quiet ssh://git@git.serguzim.me:3022/emgauwa/controller.git controller || exit
pushd ./controller > /dev/null
git checkout $2
mkdir build
cd build
cmake -DWIRING_PI_DEBUG=on .. >/dev/null
cp $source_dir/controller.testing.ini ./controller.ini
make >/dev/null
2020-05-31 22:45:08 +00:00
2020-05-10 20:37:55 +00:00
./controller start >$working_dir/controller.log 2>&1 &
controller_id=$!
popd > /dev/null
2020-05-31 22:45:08 +00:00
2020-05-10 20:37:55 +00:00
cp $1 $working_dir/core
cp $source_dir/core.testing.ini $working_dir/core.ini
2020-05-31 22:45:08 +00:00
echo "=== invalids start (must exit) ===" >$working_dir/core.log
$working_dir/core >>$working_dir/core.log 2>&1
$working_dir/core INVALID_ACTION >>$working_dir/core.log 2>&1
echo "=== invalid start ===" >>$working_dir/core.log
valgrind_emgauwa $working_dir/core start >>$working_dir/core.log 2>&1 &
2020-05-05 20:29:04 +00:00
core_id=$!
2020-05-31 22:45:08 +00:00
2020-05-05 20:29:04 +00:00
sleep 2;
2020-05-31 22:45:08 +00:00
export PYTHONPATH=$PYTHONPATH:$source_dir/tavern_utils
tavern-ci --disable-warnings $source_dir/tavern_tests
2020-05-10 20:37:55 +00:00
test_result=$?
2020-05-05 20:29:04 +00:00
kill $core_id
2020-05-10 20:37:55 +00:00
kill $controller_id
2020-05-22 23:28:48 +00:00
rm -rf $working_bak
mv $working_dir $working_bak
2020-05-10 20:37:55 +00:00
rm -rf $working_dir
exit $test_result