-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: tests/functional_tests/tools
- Loading branch information
1 parent
a901c76
commit 64ef707
Showing
4 changed files
with
70 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
# ########## | ||
# This script CMake configures and builds the project for functional tests assuming virtual environment is already setup. | ||
# ########## | ||
|
||
FULL_PATH_TO_SCRIPT="$(realpath "${BASH_SOURCE[0]}")" | ||
SCRIPT_DIRECTORY="$(dirname "$FULL_PATH_TO_SCRIPT")" | ||
cd "$SCRIPT_DIRECTORY" | ||
|
||
# 1. Go to the root of the project | ||
cd ../../.. | ||
|
||
# 2. Variables | ||
|
||
# 2.1 Default values | ||
ATSIGN_FIRST="@alice🛠" | ||
ATSIGN_SECOND="@bob🛠" | ||
ATDIRECTORY_HOST="vip.ve.atsign.zone" | ||
ATDIRECTORY_PORT=64 | ||
|
||
# 2.2 Parse command line arguments | ||
while getopts f:s:h:p: flag | ||
do | ||
case "${flag}" in | ||
f) ATSIGN_FIRST=${OPTARG};; | ||
s) ATSIGN_SECOND=${OPTARG};; | ||
h) ATDIRECTORY_HOST=${OPTARG};; | ||
p) ATDIRECTORY_PORT=${OPTARG};; | ||
esac | ||
done | ||
|
||
# 2.3 Print variables | ||
echo "ATSIGN_FIRST (-f): $ATSIGN_FIRST" | ||
echo "ATSIGN_SECOND (-s): $ATSIGN_SECOND" | ||
echo "ATDIRECTORY_HOST (-h): $ATDIRECTORY_HOST" | ||
echo "ATDIRECTORY_PORT (-p): $ATDIRECTORY_PORT" | ||
|
||
# 3. CMake configure | ||
cmake -S . -B build \ | ||
-DATSDK_BUILD_TESTS="func" \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DFIRST_ATSIGN="\"$ATSIGN_FIRST\"" \ | ||
-DSECOND_ATSIGN="\"$ATSIGN_SECOND\"" \ | ||
-DATDIRECTORY_HOST="\"$ATDIRECTORY_HOST\"" \ | ||
-DATDIRECTORY_PORT=$ATDIRECTORY_PORT | ||
|
||
# 4. CMake build (this step will build atsdk and link the atsdk to the functional | ||
cmake --build build |
10 changes: 1 addition & 9 deletions
10
tests/functional_tests/tools/run_test.sh → tests/functional_tests/tools/clean.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,5 @@ | ||
#!/bin/bash | ||
set -eu | ||
FULL_PATH_TO_SCRIPT="$(realpath "${BASH_SOURCE[0]}")" | ||
SCRIPT_DIRECTORY="$(dirname "$FULL_PATH_TO_SCRIPT")" | ||
cd "$SCRIPT_DIRECTORY" | ||
cd .. | ||
|
||
"../../tools/install.sh" | ||
|
||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug | ||
cmake --build build --target $1 | ||
|
||
./build/$1 | ||
rm -rf build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
FULL_PATH_TO_SCRIPT="$(realpath "${BASH_SOURCE[0]}")" | ||
SCRIPT_DIRECTORY="$(dirname "$FULL_PATH_TO_SCRIPT")" | ||
cd "$SCRIPT_DIRECTORY" | ||
|
||
# 1. Go to root of the project | ||
|
||
cd ../../.. | ||
|
||
# 2. Check if build directory exists | ||
|
||
if [ ! -d "build" ]; then | ||
echo "Build directory does not exist. Run build.sh first." | ||
exit 1 | ||
fi | ||
|
||
# 3. Run ctest | ||
|
||
ctest --test-dir build/tests/functional_tests --output-on-failure -VV --timeout 90 | ||
|
This file was deleted.
Oops, something went wrong.