Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions hadoop-ozone/dist/src/main/compose/ozone-mr/test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
Expand All @@ -15,29 +16,22 @@
# limitations under the License.
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )
ALL_RESULT_DIR="$SCRIPT_DIR/result"
mkdir -p "$ALL_RESULT_DIR"
rm "$ALL_RESULT_DIR/*" || true
source "$SCRIPT_DIR/../testlib.sh"

tests=$(find_tests)
cd "$SCRIPT_DIR"

RESULT=0
# shellcheck disable=SC2044
for t in ${tests}; do
d="$(dirname "${t}")"
echo "Executing test in ${d}"

#required to read the .env file from the right location
cd "${d}" || continue
./test.sh
ret=$?
if [[ $ret -ne 0 ]]; then
RESULT=1
echo "ERROR: Test execution of ${d} is FAILED!!!!"
if ! run_test_script "${d}"; then
RESULT=1
fi
cd "$SCRIPT_DIR"
RESULT_DIR="${d}/result"
TEST_DIR_NAME=$(basename ${d})
rebot -N $TEST_DIR_NAME -o "$ALL_RESULT_DIR"/$TEST_DIR_NAME.xml "$RESULT_DIR"/"*.xml"
cp "$RESULT_DIR"/docker-*.log "$ALL_RESULT_DIR"/
cp "$RESULT_DIR"/*.out* "$ALL_RESULT_DIR"/ || true

copy_results "${d}" "${ALL_RESULT_DIR}"
done

21 changes: 5 additions & 16 deletions hadoop-ozone/dist/src/main/compose/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,18 @@ if [ "$OZONE_WITH_COVERAGE" ]; then
fi

tests=$(find_tests)
cd "$SCRIPT_DIR"

RESULT=0
# shellcheck disable=SC2044
for t in ${tests}; do
d="$(dirname "${t}")"
echo "Executing test in ${d}"

#required to read the .env file from the right location
cd "${d}" || continue
set +e
./test.sh
ret=$?
set -e
if [[ $ret -ne 0 ]]; then
RESULT=1
echo "ERROR: Test execution of ${d} is FAILED!!!!"
if ! run_test_script "${d}"; then
RESULT=1
fi
cd "$SCRIPT_DIR"
RESULT_DIR="${d}/result"
TEST_DIR_NAME=$(basename ${d})
rebot --nostatusrc -N $TEST_DIR_NAME -o "$ALL_RESULT_DIR"/$TEST_DIR_NAME.xml "$RESULT_DIR"/"*.xml"
cp "$RESULT_DIR"/docker-*.log "$ALL_RESULT_DIR"/
cp "$RESULT_DIR"/*.out* "$ALL_RESULT_DIR"/ || true

copy_results "${d}" "${ALL_RESULT_DIR}"
done

rebot --nostatusrc -N acceptance -d "$ALL_RESULT_DIR" "$ALL_RESULT_DIR"/*.xml
Expand Down
36 changes: 36 additions & 0 deletions hadoop-ozone/dist/src/main/compose/testlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,39 @@ generate_report(){
exit 1
fi
}

## @description Copy results of a single test environment to the "all tests" dir.
copy_results() {
local test_dir="$1"
local all_result_dir="$2"

local result_dir="${test_dir}/result"
local test_dir_name=$(basename ${test_dir})
if [[ -n "$(find "${result_dir}" -name "*.xml")" ]]; then
rebot --nostatusrc -N "${test_dir_name}" -o "${all_result_dir}/${test_dir_name}.xml" "${result_dir}/*.xml"
fi

cp "${result_dir}"/docker-*.log "${all_result_dir}"/
if [[ -n "$(find "${result_dir}" -name "*.out")" ]]; then
cp "${result_dir}"/*.out* "${all_result_dir}"/
fi
}

run_test_script() {
local d="$1"

echo "Executing test in ${d}"

#required to read the .env file from the right location
cd "${d}" || return

ret=0
if ! ./test.sh; then
ret=1
echo "ERROR: Test execution of ${d} is FAILED!!!!"
fi

cd - > /dev/null

return ${ret}
}