add check for feature file name

This commit is contained in:
Prajwol Amatya
2024-12-03 09:50:38 +05:45
parent 4f248ce47f
commit 5388aaad40

View File

@@ -42,20 +42,29 @@ for expected_failure_file in "${EXPECTED_FAILURE_FILES[@]}"; do
# also filter the duplicated suites name
EXPECTED_FAILURE_SUITES=($(echo "${EXPECTED_FAILURE_SUITES[@]}" | tr ' ' '\n' | sort | uniq))
# Check the existence of the suite
NONEXISTING_SCENARIOS=()
NON_EXISTING_SCENARIOS=()
FEATURE_PATTERN="[a-zA-Z0-9]+\\.feature:[0-9]+"
for suite in "${EXPECTED_FAILURE_SUITES[@]}"; do
pattern="(\\b${suite}/${FEATURE_PATTERN}\\b)"
if [[ " ${AVAILABLE_SUITES[*]} " != *" $suite "* ]]; then
pattern="(\\b${suite}/[a-zA-Z0-9]+\\.feature:[0-9]+)"
NONEXISTING_SCENARIOS+=($(grep -Eo ${pattern} ${PATH_TO_EXPECTED_FAILURE_FILE}))
NON_EXISTING_SCENARIOS+=($(grep -Eo ${pattern} ${PATH_TO_EXPECTED_FAILURE_FILE}))
else
SCENARIOS=($(grep -Eo ${pattern} ${PATH_TO_EXPECTED_FAILURE_FILE} | grep -Eo "${FEATURE_PATTERN}"))
for scenario in "${SCENARIOS[@]}"; do
FEATURE_FILE=$(echo "$scenario" | cut -d':' -f1)
if [[ ! -f "$PATH_TO_SUITES/$suite/$FEATURE_FILE" ]]; then
NON_EXISTING_SCENARIOS+=("$suite/$scenario")
fi
done
fi
done
count="${#NONEXISTING_SCENARIOS[@]}"
count="${#NON_EXISTING_SCENARIOS[@]}"
if [ "$count" -gt 0 ]; then
EXIT_CODE=1
log_info "The following test scenarios do not exist anymore:"
log_info "They can be deleted from the '${expected_failure_file}'"
for scenario_path in "${NONEXISTING_SCENARIOS[@]}"; do
for scenario_path in "${NON_EXISTING_SCENARIOS[@]}"; do
log_error "$scenario_path"
done
else