3 # Need at least 2 arguments
4 if [[ $# -lt 2 ]]; then
8 echo " [test.config path]"
16 WORKDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
17 CONFIG_PATH="$1"; shift
18 RESOURCE_DIR="$1"; shift
20 source "${CONFIG_PATH}"
22 echo "-- Found circle-inspect: ${CIRCLE_INSPECT_PATH}"
23 echo "-- Found circle-verify: ${CIRCLE_VERIFY_PATH}"
24 echo "-- Found circle2circle: ${CIRCLE2CIRCLE_PATH}"
25 echo "-- Found common-artifacts: ${RESOURCE_DIR}"
32 while [[ $# -ne 0 ]]; do
37 PASSED_TAG="${PREFIX}.passed"
41 cat > "${PREFIX}.log" <(
44 echo "-- Found circle: ${PREFIX}.opt.circle"
46 # Exit immediately if any command fails
52 # Check if rule is satisfied
55 # Note: turn off 'command printing'. Otherwise printing will be so messy
58 # (COMPILED_FILE, INSPECT_PROG_PATH, VERIFY_PROG_PATH, ERROR_LOG) must be set for rule-lib.sh
59 COMPILED_FILE="${PREFIX}.opt.circle"
60 INSPECT_PROG_PATH=${CIRCLE_INSPECT_PATH}
61 VERIFY_PROG_PATH=${CIRCLE_VERIFY_PATH}
62 ERROR_LOG="${PREFIX}.error"
66 # in case error while running rule-lib.sh, prints error msg
67 trap 'echo "** ERROR **" ; cat "${ERROR_LOG}"' ERR
70 source "${RESOURCE_DIR}/${PREFIX}.rule"
76 # At this point, the exit code of all commands is 0
77 # If not 0, execution of this script ends because of "set -e"
81 if [[ -f "${PASSED_TAG}" ]]; then
89 if [[ ${#TESTED[@]} -ne ${#PASSED[@]} ]]; then
91 for TEST in "${FAILED[@]}"