Refactor diff script to streamline normalization process and improve readability

m3hm3t/pg18_normalize-sed-domain-base-type-error
Mehmet Yilmaz 2025-07-01 07:35:45 +00:00
parent 68cd4c117f
commit a0fb094b0f
1 changed files with 30 additions and 17 deletions

View File

@ -34,21 +34,34 @@ then
fi fi
fi fi
if test -z "${VANILLATEST:-}" # if test -z "${VANILLATEST:-}"
then # then
touch "$file1" # when adding a new test the expected file does not exist # touch "$file1" # when adding a new test the expected file does not exist
normalize_file="$BASEDIR/normalize.sed" # normalize_file="$BASEDIR/normalize.sed"
# when running tests on an existing cluster some changes need to be done on # # when running tests on an existing cluster some changes need to be done on
# normalize.sed file. So a new file is used. # # normalize.sed file. So a new file is used.
if [[ -f "$BASEDIR/normalize_modified.sed" ]] # if [[ -f "$BASEDIR/normalize_modified.sed" ]]
then # then
normalize_file="$BASEDIR/normalize_modified.sed" # normalize_file="$BASEDIR/normalize_modified.sed"
fi # fi
sed -Ef "$normalize_file" < "$file1" > "$file1.modified" # sed -Ef "$normalize_file" < "$file1" > "$file1.modified"
sed -Ef "$normalize_file" < "$file2" > "$file2.modified" # sed -Ef "$normalize_file" < "$file2" > "$file2.modified"
"$DIFF" -w $args "$file1.modified" "$file2.modified" | LC_CTYPE=C.UTF-8 diff-filter "$BASEDIR/normalize.sed" # "$DIFF" -w $args "$file1.modified" "$file2.modified" | LC_CTYPE=C.UTF-8 diff-filter "$BASEDIR/normalize.sed"
exit ${PIPESTATUS[0]} # exit ${PIPESTATUS[0]}
else # else
exec "$DIFF" -w $args "$file1" "$file2" # exec "$DIFF" -w $args "$file1" "$file2"
fi # fi
touch "$file1" # when adding a new test the expected file does not exist
normalize_file="$BASEDIR/normalize.sed"
# when running tests on an existing cluster some changes need to be done on
# normalize.sed file. So a new file is used.
if [[ -f "$BASEDIR/normalize_modified.sed" ]]
then
normalize_file="$BASEDIR/normalize_modified.sed"
fi
sed -Ef "$normalize_file" < "$file1" > "$file1.modified"
sed -Ef "$normalize_file" < "$file2" > "$file2.modified"
"$DIFF" -w $args "$file1.modified" "$file2.modified" | LC_CTYPE=C.UTF-8 diff-filter "$BASEDIR/normalize.sed"
exit ${PIPESTATUS[0]}