From 623a2c81ba76cfdc452db45498d88970f6df08bc Mon Sep 17 00:00:00 2001 From: hasherezade Date: Sat, 23 Nov 2019 20:56:15 +0100 Subject: [PATCH] [NOBIN] Added a script for regression tests --- .gitignore | 1 + CMakeLists.txt | 5 +++++ test.sh | 27 +++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100755 test.sh diff --git a/.gitignore b/.gitignore index ebb46e67..3439e7b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build/ build_qt5/ build_qt4/ +test_cases/ diff --git a/CMakeLists.txt b/CMakeLists.txt index cfd75b83..35398b64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,5 +36,10 @@ if(CMD_BUILD_TESTING) # 0) does the application run add_test (TestRuns ${CMAKE_BINARY_DIR}/bearcommander) set_tests_properties(TestRuns PROPERTIES PASS_REGULAR_EXPRESSION "Bearparser") + + # 1) regression tests for the commander + add_test (TestRegression ${CMAKE_SOURCE_DIR}/test.sh ${CMAKE_SOURCE_DIR}) + set_tests_properties(TestRegression PROPERTIES PASS_REGULAR_EXPRESSION "All passed") endif() + diff --git a/test.sh b/test.sh new file mode 100755 index 00000000..a273cc9d --- /dev/null +++ b/test.sh @@ -0,0 +1,27 @@ +#!/bin/bash +START_DIR=$(pwd) +SOURCE_DIR=$1 +cd "$SOURCE_DIR" +echo "Source Dir: ""$SOURCE_DIR" + +rm -rf test_cases +mkdir test_cases +cd test_cases +wget "https://drive.google.com/uc?export=download&id=1johP6rf7iS8-mi6xrT5mCX4wnbKk8rq8" -O test_cases.zip +7z x test_cases.zip +rm *.zip +cd .. +BCMD_DIR=$(pwd)/build/ + +cd test_cases +chmod +x test1.sh +./test1.sh "$BCMD_DIR" "info" "x64/QtGui4" +if [[ "$?" != 0 ]]; then + exit 1 +fi +./test1.sh "$BCMD_DIR" "winfo0" "x64/QtGui4" +if [[ "$?" != 0 ]]; then + exit 1 +fi +echo "All passed" +cd "$START_DIR"