Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix skipping certain SDK tests #84

Merged
merged 1 commit into from
Jul 9, 2017
Merged
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
33 changes: 17 additions & 16 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ log_dir="log"
error_file_name="error.log"
log_file_name="output.log"

# Utility methods

# Prints message after an error
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'"
echo "Use 'docker ps -a' to find container-id"
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 All @@ -48,7 +46,7 @@ _init() {
fi

if [ -z "$ENABLE_HTTPS" ]; then
ENABLE_HTTPS=0
export ENABLE_HTTPS=0
fi

# mode is set via env vars
Expand All @@ -64,6 +62,14 @@ _init() {
if [ -z "$MINT_DATA_DIR" ]; then
export MINT_DATA_DIR="/mint/data"
fi

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

# Set Docker Container ID
container_id=$(basename "$(cat /proc/1/cpuset)")
}

# Run the current SDK Test
Expand Down Expand Up @@ -99,36 +105,31 @@ doesntContainElement () {
return 0
}


# Cycle through the sdk directories and run sdk/cli tests
coreMain() {
local test_dir

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'"

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