@@ -5,7 +5,7 @@ shopt -s globstar
55# Default values
66target_dir=" integration-tests"
77overwrite=0
8- verbose=0
8+ err_out= " /dev/null "
99
1010# Parse arguments
1111while [ " $# " -gt 0 ]; do
@@ -14,7 +14,7 @@ while [ "$#" -gt 0 ]; do
1414 overwrite=1
1515 ;;
1616 -v|--verbose)
17- verbose=1
17+ err_out= " /dev/stderr "
1818 ;;
1919 * )
2020 target_dir=" $1 "
@@ -30,11 +30,6 @@ description_changed=0
3030minor_change=0
3131major_change=0
3232
33- err_out=" /dev/null"
34- if [ $verbose -gt 0 ]; then
35- err_out=" /dev/stderr"
36- fi
37-
3833# Find all config.json files in target directory
3934for config in $target_dir /** /config.json; do
4035 test_dir=" $( dirname " $config " ) "
@@ -90,31 +85,30 @@ for config in $target_dir/**/config.json; do
9085 rm -r " $workdir "
9186
9287 # Count accepted and failed in output
93- accepted_output =" $( echo " $output " | jq -s ' map(select(.accepted == true)) | length' ) "
94- failed_output =" $( echo " $output " | jq -s ' map(select(.accepted == false)) | length' ) "
95- echo -en " $accepted_output accepted, $failed_output failed\t"
88+ accepted_actual =" $( echo " $output " | jq -s ' map(select(.accepted == true)) | length' ) "
89+ failed_actual =" $( echo " $output " | jq -s ' map(select(.accepted == false)) | length' ) "
90+ echo -en " $accepted_actual accepted, $failed_actual failed\t"
9691
9792
9893
9994 if [ -f " $result_file " ]; then
10095 # Count accepted and failed in result
101- accepted_result=" $( jq -s ' map(select(.accepted == true)) | length' " $result_file " ) "
102- failed_result=" $( jq -s ' map(select(.accepted == true)) | length' " $result_file " ) "
103-
96+ accepted_expected=" $( jq -s ' map(select(.accepted == true)) | length' " $result_file " ) "
97+ failed_expected=" $( jq -s ' map(select(.accepted == false)) | length' " $result_file " ) "
10498
10599 # First check if files are exact using diff, then check if they differ except '.description', then check they differ in accepted or failed
106100
107101 if diff -c " $result_file " <( echo " $output " ) > " $err_out " ; then
108102 echo " [EXACT MATCH]"
109103 exact_match=$(( exact_match + 1 ))
110- elif diff -c <( jq " del(.description)" " $result_file " ) <( echo " $output " | jq " del(.description)" ) > " $err_out " ; then
104+ elif diff -c <( jq " del(.description)" " $result_file " ) <( echo " $output " | jq " del(.description)" ) > /dev/null ; then
111105 echo " [DESCRIPTION CHANGED]"
112106 description_changed=$(( description_changed + 1 ))
113- elif [ " $accepted_output " -eq " $accepted_result " ] && [ " $failed_output " -eq " $failed_result " ]; then
107+ elif [ " $accepted_actual " -eq " $accepted_expected " ] && [ " $failed_actual " -eq " $failed_expected " ]; then
114108 echo " [MINOR CHANGE] (accepted/failed unchanged)"
115109 minor_change=$(( minor_change + 1 ))
116110 else
117- echo " [MAJOR CHANGE] (accepted/failed changed, was $accepted_result / $failed_result )"
111+ echo " [MAJOR CHANGE] (accepted/failed changed, expected $accepted_expected / $failed_expected , actual $accepted_actual / $failed_actual )"
118112 major_change=$(( major_change + 1 ))
119113 fi
120114 fi
0 commit comments