#!/bin/bash [ -z "${TESTING_TEMP}" ] && [ -d "$(pwd)/test_results" ] && export TESTING_TEMP=$(pwd)/test_results/$(whoami) [ -z "${TESTING_TEMP}" ] && [ -d "${LOGICMOO_WS}/test_results" ] && export TESTING_TEMP=${LOGICMOO_WS}/test_results/$(whoami) [ -z "${TESTING_TEMP}" ] && export TESTING_TEMP=$(mktemp -d -t logicmoo_testing-$(date +%Y-%m-%d-%H-%M-%S)-XXXXXXXXXX) export TESTING_TEMP mkdir -p ${TESTING_TEMP}/ if [ -n "${MAX_TEST_SUITE_NUM}" ]; then if [ $MAX_TEST_SUITE_NUM -le 0 ]; then echo "Warn exceeded MAX_TEST_SUITE_NUM" return 0 2>/dev/null ; exit 0 fi fi parent-find() { local file="$1" local dir="$(realpath $2)" # echo parent-find "$file" "$(dirname "$dir")" test -e "$dir/$file" && echo "$dir" && return 0 [ '/' = "$dir" ] && return 1 parent-find "$file" "$(dirname "$dir")" } export PACK_DIR=$(basename junit/$(parent-find "pack.pl" . )) echo "" export JUNIT_PACKAGE="${PACK_DIR}.$(basename `realpath .. | sed -e 's|/[^.]/|/|g' `).$(basename `realpath .`)" JUNIT_PACKAGE=$(echo $JUNIT_PACKAGE | sed -e "s/logicmoo_//g" -e "s|\.t\.|\.test\.|g" -e "s|tests|test|g" ) JUNIT_PACKAGE="logicmoo.${JUNIT_PACKAGE}" echo "" export JUNIT_PACKAGE_STEM=$(echo "${JUNIT_PACKAGE}" | sed -e "s/\./-/g" -e "s/--/-/g" | rev | cut -c 1-110 | rev) export GLOB="$*" [ -z "$GLOB" ] && GLOB="*_0*.*" GLOBSTEM=$(echo "${JUNIT_PACKAGE_STEM}-${GLOB}" | sed -e "s/[*]/vSTARv/g" -e "s/[?]/vQUESTv/g" -e "s/[.]/vDOTv/g" -e "s/[^_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]/-/g" -e "s/--/-/g" | rev | cut -c 1-110 | rev) echo "" [ -z "${TEST_STEM}" ] && export TEST_STEM=Report-${GLOBSTEM}-Units echo "" [ -z "${TEST_STEM_PATH}" ] && export TEST_STEM_PATH="${TESTING_TEMP}/${TEST_STEM}" echo "" export CAPTURE_TEST_ANSI=${TEST_STEM_PATH}.ansi # Run tests for JUnit Results if test ! -z "${CAPTURE_TEST_ANSI+}"; then echo -e "" cat /dev/null > ${CAPTURE_TEST_ANSI} lmoo-junit-minor -k "$GLOB" 2>&1 | tee -a ${CAPTURE_TEST_ANSI} else echo -e "" lmoo-junit-minor -k "$GLOB" 2>&1 fi junitCombined=${TEST_STEM_PATH}-junitCombined-rollup.tmp # Generate JUnit Results ( echo "" sed -r "s/\x1B\[(([0-9]{1,2})?(;)?([0-9]{1,2})?)?[m,K,H,f,J]//g" ${TEST_STEM_PATH}?*-junit.xml | sed -e "s|||g" -e 's|||g' -e "s|||g" echo -e "\n\n\n\n" ) | iconv -c -t utf-8 > ${junitCombined} PATH=~/.npm-packages/bin:$PATH # Generate Html Reports echo ""