2019-02-26 11:59:53 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-02-26 14:36:50 +02:00
|
|
|
WORKSPACES_ROOT=workspaces
|
|
|
|
[ -e "${WORKSPACES_ROOT}" ] && rm -rf ${WORKSPACES_ROOT}
|
2019-02-26 11:59:53 +02:00
|
|
|
|
2019-02-27 09:55:44 +02:00
|
|
|
TEST_CASES=$(find '.' -depth 2 -name '*.yml')
|
2019-02-26 17:10:13 +02:00
|
|
|
|
|
|
|
i=0
|
|
|
|
for f in ${TEST_CASES}
|
2019-02-26 11:59:53 +02:00
|
|
|
do
|
2019-02-26 17:51:47 +02:00
|
|
|
testCase=$(basename "${f%.*}")
|
|
|
|
area=$(dirname "${f#*/}")
|
2019-02-26 17:47:31 +02:00
|
|
|
echo "[INFO] Running test case \"${testCase}\" in area \"${area}\"."
|
|
|
|
TEST_CASE_ROOT="${WORKSPACES_ROOT}/${area}/${testCase}"
|
|
|
|
[ -e "${TEST_CASE_ROOT}" ] && rm -rf "${TEST_CASE_ROOT}"
|
|
|
|
mkdir -p "${TEST_CASE_ROOT}"
|
2019-02-26 17:51:47 +02:00
|
|
|
source ./runTest.sh "${testCase}" "${TEST_CASE_ROOT}" &> "${TEST_CASE_ROOT}/log.txt" &
|
2019-02-26 17:47:31 +02:00
|
|
|
pid=$!
|
|
|
|
processes[$i]="${testCase}:${pid}"
|
|
|
|
echo "[INFO] Test case \"${testCase}\" in area \"${area}\" launched. (PID: \"${pid}\")."
|
|
|
|
let i=i+1
|
2019-02-26 17:10:13 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
#
|
|
|
|
# wait for the test cases and cat the log
|
|
|
|
for p in "${processes[@]}"
|
|
|
|
do
|
2019-02-26 17:47:31 +02:00
|
|
|
testCase=${p%:*}
|
|
|
|
processId=${p#*:}
|
|
|
|
echo "[INFO] Waiting for test case \"${testCase}\" (PID: \"${processId}\")."
|
2019-02-26 17:51:47 +02:00
|
|
|
wait "${processId}"
|
2019-02-26 17:47:31 +02:00
|
|
|
echo "[INFO] Test case \"${testCase}\" finished (PID: \"${processId}\")."
|
|
|
|
echo "[INFO] <START> Logs for test case \"${testCase}\"."
|
|
|
|
cat "${TEST_CASE_ROOT}/log.txt"
|
|
|
|
echo "[INFO] <END> Logs for test case \"${testCase}\"."
|
2019-02-26 17:10:13 +02:00
|
|
|
done
|
2019-02-26 14:36:50 +02:00
|
|
|
|
2019-02-26 17:10:13 +02:00
|
|
|
#
|
|
|
|
# list test case status
|
|
|
|
echo "[INFO] Build status:"
|
|
|
|
failure="false"
|
|
|
|
for p in "${processes[@]}"
|
|
|
|
do
|
2019-02-26 17:47:31 +02:00
|
|
|
status="UNDEFINED"
|
|
|
|
testCase=${p%:*}
|
|
|
|
if [ -f "${TEST_CASE_ROOT}/SUCCESS" ]
|
|
|
|
then
|
|
|
|
status="SUCCESS"
|
|
|
|
else
|
|
|
|
status="FAILURE"
|
|
|
|
failure="true"
|
|
|
|
fi
|
|
|
|
printf "[INFO] %-30s: %s\n" "${testCase}" ${status}
|
2019-02-26 11:59:53 +02:00
|
|
|
done
|
2019-02-26 17:10:13 +02:00
|
|
|
|
|
|
|
if [ "${failure}" == "true" ]
|
|
|
|
then
|
2019-02-26 17:47:31 +02:00
|
|
|
echo "[WARNING] There are test failures. Check earlier log for details."
|
|
|
|
exit 1
|
2019-02-26 17:10:13 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "[INFO] Integration tests succeeded."
|
|
|
|
exit 0
|