Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
250 additions
and
155 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,4 @@ | ||
.git | ||
**.mdxml | ||
**/docs | ||
**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,14 @@ | ||
#!/bin/bash | ||
#### | ||
# bootstrap.bash: | ||
# | ||
# ** Assumes that the user is in the F prime root directory for F prime CI ** | ||
# | ||
# Sets up the python environment for the CI system. This will read the latest Python and ensure | ||
# that we are ready to run all tools. | ||
#### | ||
# Clean the repository as part of setup | ||
echo -e "${BLUE}Cleaning Repository and Installing PIP Package${NOCOLOR}" | ||
git clean -xdf . | ||
pip install ./Fw/Python | ||
pip install ./Gds[test-api-xls] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
#### | ||
# helpers.bash: | ||
# | ||
# Helpers used to make the CI system a bit nicer. It defines some methods, like pretty colors for | ||
# usage elsewhere. | ||
#### | ||
export BLUE='\033[0;34m' | ||
export RED='\033[0;31m' | ||
export NOCOLOR='\033[0m' # No Color | ||
|
||
#### | ||
# fail_and_stop: | ||
# | ||
# This function, when called ouside a subsehll, should print an error and stop the test. This will | ||
# allow fairly easy test failures. | ||
# :param message ($1): message to print to the error log | ||
#### | ||
function fail_and_stop() | ||
{ | ||
echo -e "${RED}---------------- ERROR ----------------" 1>&2 | ||
echo " CI Failed with error: ${1}" 1>&2 | ||
echo -e "---------------------------------------${NOCOLOR}" 1 >&2 | ||
exit 1 | ||
} |
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 | ||
#### | ||
# master.bash: | ||
# | ||
# Master script to run the CI process. This will setup and run the tests for the CI system. | ||
#### | ||
export SCRIPT_DIR="$(dirname ${BASH_SOURCE})" | ||
. "${SCRIPT_DIR}/helpers.bash" | ||
|
||
#### NEEDED ENVIRONMENT #### | ||
export FPRIME_DIR="$(pwd)" | ||
export LOG_DIR="${FPRIME_DIR}/ci-logs-$(date +"%Y-%m-%dT%H%M%S")" | ||
mkdir -p "${LOG_DIR}" | ||
|
||
# Loop through all scripts in tests directory and run them | ||
for test_script in "${SCRIPT_DIR}/tests"/* | ||
do | ||
"${SCriPT_DIR}/bootstrap.bash" || fail_and_stop "Cleaning and PIP install Failed" | ||
"${test_script}" || fail_and_stop "${test_script} failed" | ||
done |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
#### | ||
# 00-fw-uts.bash: | ||
# | ||
# FW Unit Tests for the pythonm code. Performed upfront as it will inform the stability of the rest | ||
# of the build. | ||
#### | ||
export SCRIPT_DIR="$(dirname ${BASH_SOURCE})/.." | ||
. "${SCRIPT_DIR}/helpers.bash" | ||
|
||
pytest Fw/Python || fail_and_stop "Failed to run F prime framework UTs" |
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,16 @@ | ||
#!/bin/bash | ||
#### | ||
# 05-ptf.bash: | ||
# | ||
# Heritage PTF UTs tests | ||
#### | ||
export SCRIPT_DIR="$(dirname ${BASH_SOURCE})/.." | ||
. "${SCRIPT_DIR}/helpers.bash" | ||
( | ||
cd ptf | ||
./run_all_unit_tests.sh | ||
) || fail_and_stop "F prime UTs failed via PTF" | ||
( | ||
cd ptf | ||
./run_ac_tests.sh | ||
) || fail_and_stop "F prime UTs failed via PTF" |
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,10 @@ | ||
#!/bin/bash | ||
#### | ||
# 10-cmake-uts.bash: | ||
# | ||
# Run the CMake UTs. | ||
#### | ||
export SCRIPT_DIR="$(dirname ${BASH_SOURCE})/.." | ||
. "${SCRIPT_DIR}/helpers.bash" | ||
|
||
pytest cmake/ -v --ignore test_ut.py --ignore test_validation.py || fail_and_stop "Failed to run CMake UTs" |
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,19 @@ | ||
#!/bin/bash | ||
#### | ||
# 20-fputil.bash: | ||
# | ||
# Run the tests on the software through fp-util. | ||
#### | ||
export SCRIPT_DIR="$(dirname ${BASH_SOURCE})/.." | ||
. "${SCRIPT_DIR}/helpers.bash" | ||
|
||
. ${SCRIPT_DIR}/tests/fputil.bash | ||
# Loop over deployments and targets | ||
for deployment in ${FPUTIL_DEPLOYS} | ||
do | ||
echo -e "${BLUE}Testing ${deployment} against fprime-util targets: ${FPUTIL_TARGET}${NOCOLOR}" | ||
for target in ${FPUTIL_TARGET} | ||
do | ||
fputil_action "${deployment}" "${target}" | ||
done | ||
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,16 @@ | ||
#!/bin/bash | ||
#### | ||
# 30-ints.bash: | ||
# | ||
# Integration tests for CI | ||
#### | ||
export SCRIPT_DIR="$(dirname ${BASH_SOURCE})/.." | ||
. "${SCRIPT_DIR}/helpers.bash" | ||
|
||
. ${SCRIPT_DIR}/tests/fputil.bash | ||
# Loop over deployments and targets | ||
for deployment in ${INTS_DEPLOYS} | ||
do | ||
echo -e "${BLUE}Testing ${deployment} against integration tests${NOCOLOR}" | ||
integration_test "${deployment}" | ||
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,72 @@ | ||
#!/bin/bash | ||
#### | ||
# fputil.bash: | ||
# | ||
# Helpers to test via FP util | ||
#### | ||
export FPUTIL_TARGETS="generate build build-uts check-all install build-all coverage" | ||
export FPUTIL_DEPLOYS="${FPRIME_DIR}/Ref ${FPRIME_DIR}/RPI" | ||
|
||
export INT_DEPLOYS="${FPRIME_DIR}/Ref" | ||
#### | ||
# fputil_action: | ||
# | ||
# Runs an action for the FP util. This takes two parameters a target and a deployment. This assumes | ||
# prequsite actions already exist. | ||
# :param target($1): command to run with FP util | ||
# :param deploy($2): deployment to run on | ||
#### | ||
function fputil_action | ||
do | ||
export TARGET="${1}" | ||
export WORKDIR="${2}" | ||
let JOBS="${JOBS:-$(( ( RANDOM % 100 ) + 1 ))}" | ||
( | ||
cd "${WORKDIR}" | ||
# Generate is only needed when it isn't being tested | ||
if [[ "${TARGET}" != "generate" ]] | ||
then | ||
echo "[INFO] Generating build cache before ${WORKDIR//\//_} '${TARGET}' execution" | ||
fprime-util "generate" --jobs "${JOBS}" > "${LOG_DIR}/${WORKDIR//\//_}_pregen.out.log" 2> "${LOG_DIR}/${WORKDIR//\//_}_pregen.err.log" \ | ||
|| fail_and_stop "Failed to generate before ${WORKDIR//\//_} '${TARGET}' execution" | ||
fi | ||
echo "[INFO] FP Util in ${WORKDIR} running ${target} with ${JOBS} jobs" | ||
fprime-util "${target}" --jobs "${JOBS}" > "${LOG_DIR}/${WORKDIR//\//_}_pregen.out.log" 2> "${LOG_DIR}/${WORKDIR//\//_}_pregen.err.log" \ | ||
|| fail_and_stop "Failed to run '${TARGET}' in ${WORKDIR}" | ||
) || exit 1 | ||
done | ||
|
||
#### | ||
# integration_test: | ||
# | ||
# Runs the FPrime GDS and integration test layer for a deployment. | ||
# :param deploy($1): deployment to run on. | ||
#### | ||
function integration_test | ||
do | ||
let SLEEP_TIME=10 | ||
export WORKDIR="${1}" | ||
fputil_action "${WORKDIR}" "install" || fail_and_stop "Failed to install before integration test" | ||
( | ||
mkdir -p "${LOG_DIR}/gds-logs" | ||
# Start the GDS layer and give it time to run | ||
echo "[INFO] Starting headless GDS layer" | ||
fprime-gds -d "${WORKDIR}" -g none -l "${LOG_DIR}/gds-logs" 1>${LOG_DIR}/gds-logs/fprime-gds.stdout.log 2>${LOG_DIR}/gds-logs/fprime-gds.stderr.log & | ||
GDS_PID=$! | ||
echo "[INFO] Allowing GDS ${SLEEP_TIME} seconds to start" | ||
sleep ${SLEEP_TIME} | ||
# Check the above started successfully | ||
ps -p ${GDS_PID} 2> /dev/null 1> /dev/null || fail_and_stop "Failed to start GDS layer headlessly" | ||
# Run integration tests | ||
( | ||
cd "${WORKDIR}" | ||
echo "[INFO] Running $1's pytest integration tests" | ||
pytest "${LOG_DIR}/${WORKDIR//\//_}_pytest_ints.out.log" 2> "${LOG_DIR}/${WORKDIR//\//_}_pytest_ints.err.log" | ||
) | ||
RET_PYTEST=$? | ||
kill $GDS_PID | ||
sleep 2 | ||
pkill -KILL Ref | ||
exit ${RET_PYTEST} | ||
) || fail_and_stop "Failed integration tests on ${WORKDIR}" | ||
done |
Oops, something went wrong.