Skip to content

Commit

Permalink
Fix test skipping and add container-id in user message
Browse files Browse the repository at this point in the history
  • Loading branch information
nitisht committed Jul 7, 2017
1 parent 6697cb4 commit 5cb833d
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ log_file_name="output.log"
printMsg() {
echo ""
echo "Use 'docker ps -a' to find container-id"
echo "Export run logs from the container using 'docker cp container-id:/mint/log /tmp/mint-logs'"
container_id=$(basename "$(cat /proc/1/cpuset)")
echo "Export run logs from the container using 'docker cp ${container_id:0-12}:/mint/log /tmp/mint-logs'"
}

# Setup environment variables for the run.
Expand Down Expand Up @@ -64,6 +65,11 @@ _init() {
if [ -z "$MINT_DATA_DIR" ]; then
export MINT_DATA_DIR="/mint/data"
fi

# check if any tests are ignored
if [ -z "$SKIP_TESTS" ]; then
IFS=',' read -ra SDKS_TO_IGNORE <<< "${SKIP_TESTS}"
fi
}

# Run the current SDK Test
Expand Down Expand Up @@ -106,29 +112,26 @@ coreMain() {

test_dir="run/core"

# check if any tests are ignored
if [ -z "${SKIP_TESTS}" ]; then
IFS=',' read -ra SDKS_TO_IGNORE <<< "${SKIP_TESTS}"
fi

# read the SDKs to run
for i in ${root_dir}/${test_dir}/*;
do
# if directory exists.
if [[ -d "${i}" ]] && doesntContainElement "${i}" "${SDKS_TO_IGNORE[@]}"; then
sdk="$(basename "$i")"
sdk="$(basename "$i")"
# if "i" is a directory
if [[ -d "${i}" ]] && doesntContainElement "$sdk" "${SDKS_TO_IGNORE[@]}"; then
echo -n "Running $sdk tests ... "
# log start time
start=$(date +%s)
runCoreTest "$i" "$MINT_MODE" || { printMsg; exit 2; }
runCoreTest "$i" || { printMsg; exit 2; }
# log end time
end=$(date +%s)
# get diif
diff=$(( end - start ))
echo "Finished in $(humantime ${diff})"
fi
done
echo "Mint ran all core tests successfully. To view logs, use 'docker cp container-id:/mint/log /tmp/mint-logs'"

container_id=$(basename "$(cat /proc/1/cpuset)")
echo "Mint ran all core tests successfully. To view logs, use 'docker cp ${container_id:0-12}:/mint/log /tmp/mint-logs'"
}

function humantime {
Expand Down

0 comments on commit 5cb833d

Please sign in to comment.