Fix the testing dir handling

Now the controller will be kept, and database and logs will be saved.
This commit is contained in:
Tobias Reisinger 2020-11-11 22:55:58 +01:00
parent ead52a0f47
commit fad3d80f39
2 changed files with 13 additions and 11 deletions

3
.gitignore vendored
View file

@ -1,8 +1,7 @@
build/ build/
docs/ docs/
tests/testing_latest/ tests/testing/
tests/testing_bak/
include/sql/*.h include/sql/*.h

View file

@ -1,15 +1,10 @@
#!/usr/bin/env sh #!/usr/bin/env sh
source_dir=$PWD source_dir=$PWD
working_dir=$PWD/testing_latest working_dir=$PWD/testing
working_bak=$PWD/testing_bak
alias valgrind_emgauwa="valgrind -s $2 --log-file=$working_dir/valgrind.log" alias valgrind_emgauwa="valgrind -s $2 --log-file=$working_dir/valgrind.log"
rm -rf $working_bak
[ -d $working_dir ] && mv $working_dir $working_bak
mkdir -p $working_dir mkdir -p $working_dir
cd $working_dir cd $working_dir
@ -17,15 +12,17 @@ target_branch=$(git rev-parse --abbrev-ref HEAD)
if [ -z "$EMGAUWA_CONTROLLER_EXE" ] if [ -z "$EMGAUWA_CONTROLLER_EXE" ]
then then
git clone --quiet ssh://git@git.serguzim.me:3022/emgauwa/controller.git controller || exit mkdir -p controller
cd ./controller cd controller
git pull >/dev/null || git clone --quiet ssh://git@git.serguzim.me:3022/emgauwa/controller.git . || exit
git checkout dev >/dev/null 2>&1 git checkout dev >/dev/null 2>&1
git checkout $target_branch >/dev/null 2>&1 git checkout $target_branch >/dev/null 2>&1
git checkout $2 >/dev/null 2>&1 git checkout $2 >/dev/null 2>&1
echo "Building controller on branch $(git rev-parse --abbrev-ref HEAD)" echo "Building controller on branch $(git rev-parse --abbrev-ref HEAD)"
mkdir build mkdir -p build
cd build cd build
cmake -DWIRING_PI_DEBUG=on .. >/dev/null cmake -DWIRING_PI_DEBUG=on .. >/dev/null
@ -69,4 +66,10 @@ test_result=$?
kill $core_id kill $core_id
kill $controller_id kill $controller_id
timestamp=$(date -Iseconds)
for backup_file in core.log controller.log valgrind.log core.sqlite; do
mv $backup_file $timestamp.$backup_file
ln -sf $timestamp.$backup_file latest.$backup_file
done
exit $test_result exit $test_result