This repository has been archived by the owner on Dec 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(regression): Allow different build options
Fixes #402. Allow the regression test to cover different build options including `--proxy_passthrough`, `--define mqtt=enable`, `--define db=enable`, `--define build_type=dbg`, `--define build_type=profile`.
- Loading branch information
Showing
14 changed files
with
232 additions
and
56 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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,54 @@ | ||
# Build options | ||
setup_build_opts() { | ||
# The options are separated by '|', the format is as follows | ||
# <bazel build args> | <binary cli arguments> | ||
OPTIONS=( | ||
"|" | ||
"|--iri_host ${IRI_HOST}" | ||
"|--iri_port ${IRI_PORT}" | ||
"|--ta_host ${TA_HOST}" | ||
"|--db_host ${DB_HOST}" | ||
"|--verbose" | ||
"|--proxy_passthrough" | ||
"--define db=enable|" | ||
"--define build_type=debug|" | ||
"--define build_type=profile|" | ||
) | ||
success=() | ||
fail=() | ||
} | ||
|
||
# Check environment variables | ||
check_env() { | ||
ENV_NAME=( | ||
"IRI_HOST" | ||
"IRI_PORT" | ||
"TA_HOST" | ||
"TA_PORT" | ||
"DB_HOST" | ||
) | ||
|
||
echo "Checking environment variables" | ||
echo "==============================" | ||
|
||
for (( i = 0; i < ${#ENV_NAME[@]}; i++ )); do | ||
name=${ENV_NAME[${i}]} | ||
if [[ -z ${!name} ]]; then | ||
echo "${name} not set" | ||
fail=1 | ||
else | ||
echo "${name} is set to ${!name}" | ||
fi | ||
done | ||
|
||
echo "==============================" | ||
|
||
[ -z ${fail} ] || exit 1 | ||
} | ||
|
||
# Parse command line arguments | ||
get_cli_args () { | ||
sleep_time=$1 | ||
shift | ||
remaining_args=$@ # Get the remaining arguments | ||
} |
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 +1,5 @@ | ||
certifi==2019.11.28 | ||
chardet==3.0.4 | ||
idna==2.7 | ||
requests==2.20.0 | ||
urllib3==1.24.3 |
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,46 @@ | ||
#!/bin/bash | ||
|
||
source tests/regression/common.sh | ||
|
||
check_env | ||
setup_build_opts | ||
|
||
# Get command line arguments | ||
# Current arguments parsed are <sleep_time> <remaining_args> | ||
get_cli_args $@ | ||
|
||
# Install prerequisites | ||
make MQTT | ||
pip install --user -r tests/regression/requirements.txt | ||
redis-server & | ||
|
||
# Iterate over all available build options | ||
for (( i = 0; i < ${#OPTIONS[@]}; i++ )); do | ||
option=${OPTIONS[${i}]} | ||
cli_arg=${option} | cut -d '|' -f 1 | ||
build_arg=${option} | cut -d '|' -f 2 | ||
|
||
bazel run accelerator ${build_arg} -- --ta_port=${TA_PORT} ${cli_arg} & | ||
TA=$! | ||
sleep ${sleep_time} # TA takes time to be built | ||
trap "kill -9 ${TA};" INT # Trap SIGINT from Ctrl-C to stop TA | ||
|
||
python3 tests/regression/runner.py ${remaining_args} --url localhost:${TA_PORT} | ||
rc=$? | ||
|
||
if [ $rc -ne 0 ] | ||
then | ||
echo "Build option '${option}' failed" | ||
fail+=("${option}") | ||
else | ||
success+=("${option}") | ||
fi | ||
|
||
bazel clean | ||
wait $(kill -9 ${TA}) | ||
done | ||
|
||
echo "--------- Successful build options ---------" | ||
for (( i = 0; i < ${#success[@]}; i++ )); do echo ${success[${i}]}; done | ||
echo "----------- Failed build options -----------" | ||
for (( i = 0; i < ${#fail[@]}; i++ )); do echo ${fail[${i}]}; done |
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,46 @@ | ||
#!/bin/bash | ||
|
||
source tests/regression/common.sh | ||
|
||
check_env | ||
setup_build_opts | ||
|
||
# Get command line arguments | ||
# Current arguments parsed are <sleep_time> <remaining_args> | ||
get_cli_args $@ | ||
|
||
# Install prerequisites | ||
make | ||
pip install --user -r tests/regression/requirements.txt | ||
redis-server & | ||
|
||
# Iterate over all available build options | ||
for (( i = 0; i < ${#OPTIONS[@]}; i++ )); do | ||
option=${OPTIONS[${i}]} | ||
cli_arg=${option} | cut -d '|' -f 1 | ||
build_arg=${option} | cut -d '|' -f 2 | ||
|
||
bazel run accelerator ${build_arg} -- --ta_port=${TA_PORT} ${cli_arg} & | ||
TA=$! | ||
sleep ${sleep_time} # TA takes time to be built | ||
trap "kill -9 ${TA};" INT # Trap SIGINT from Ctrl-C to stop TA | ||
|
||
python3 tests/regression/runner.py ${remaining_args} --url localhost:${TA_PORT} | ||
rc=$? | ||
|
||
if [ $rc -ne 0 ] | ||
then | ||
echo "Build option '${option}' failed" | ||
fail+=("${option}") | ||
else | ||
success+=("${option}") | ||
fi | ||
|
||
bazel clean | ||
wait $(kill -9 ${TA}) | ||
done | ||
|
||
echo "--------- Successful build options ---------" | ||
for (( i = 0; i < ${#success[@]}; i++ )); do echo ${success[${i}]}; done | ||
echo "----------- Failed build options -----------" | ||
for (( i = 0; i < ${#fail[@]}; i++ )); do echo ${fail[${i}]}; done |
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
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
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
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
Oops, something went wrong.