Skip to content

Commit

Permalink
Update the types excluded by check-backwards-compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mjambon committed Jan 22, 2025
1 parent f3ddea0 commit 7526474
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions scripts/check-backwards-compatibility
Original file line number Diff line number Diff line change
Expand Up @@ -39,39 +39,44 @@ for tag in $tags; do
# interface because these two programs are always distributed together,
# allowing their interface to change freely.
#
# TODO: add the option '--ignore core_output,targets' so as to produce
# --exit-success: exit 0 even if differences are found.
#
# TODO: add '--ignore ...' so as to produce
# an error if we fail to update the '--types' option when adding
# future new type definitions. This requires atddiff > 2.15.
atddiff_options="--no-locations --backward --types ci_scan_complete_response,ci_scan_results_response,deployment_response,diff_files,function_call,function_return,partial_scan_result,scan_config,scan_request,scan_response,tests_result"
#
# --ignore core_output,targets,function_call,function_return
#
atddiff_options="--exit-success --no-locations --backward --types ci_scan_complete,ci_scan_complete_response,ci_scan_failure,ci_scan_results,ci_scan_results_response,cli_output,datetime,deployment_response,diff_files,partial_scan_result,scan_config,scan_request,scan_response,tests_result"

# I'm getting an exit code 128 when atddiff returns 3 (as of git 2.43.0),
# contrary to what 'git difftool --help' promises for '--trust-exit-code'.
# I'd report the bug if it was easier. -- Martin
git difftool --trust-exit-code -x "atddiff $atddiff_options" -y \
"$tag" "origin/main" -- semgrep_output_v1.atd > before.txt
# The exit code is 0 if atddiff's exit code is 0, and it's an
# unspecified nonzero value if atddiff's exit code is not 0 (but
# not the same nonzero value!)
ret=$?
if [ "$ret" -ge 1 ] && [ "$ret" -le 2 ]; then
echo "ERROR: atddiff had an error: $ret"
if [[ "$ret" -ne 0 ]]; then
echo "ERROR: atddiff had an error: git difftool exit $ret"
cat before.txt
exit 1
fi
git difftool --trust-exit-code -x "atddiff $atddiff_options" -y \
"$tag" "HEAD" -- semgrep_output_v1.atd > after.txt
ret=$?
if [ "$ret" -ge 1 ] && [ "$ret" -le 2 ]; then
echo "ERROR: atddiff had an error: $ret"
if [[ "$ret" -ne 0 ]]; then
echo "ERROR: atddiff had an error: git difftool exit $ret"
cat after.txt
exit 1
fi

diff -u before.txt after.txt
if [ "$?" -ne 0 ]; then
if [[ "$?" -ne 0 ]]; then
echo "ERROR: semgrep_output_v1.atd is not backward compatible with $tag"
errors=$((errors + 1))
fi
set -e
done

if [ "$errors" -ne 0 ]; then
if [[ "$errors" -ne 0 ]]; then
exit 1
fi

0 comments on commit 7526474

Please sign in to comment.