Skip to content

Commit

Permalink
Merge pull request #2304 from hzeller/feature-20241220-choose-patch-lint
Browse files Browse the repository at this point in the history
Make it possible to set patch utility via environment variable.
  • Loading branch information
hzeller authored Dec 21, 2024
2 parents 2f99cdc + 64c7d3c commit 20eb11e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions verible/verilog/tools/lint/lint_tool_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
MY_OUTPUT_FILE="${TEST_TMPDIR}/myoutput.txt"
readonly MY_OUTPUT_FILE

PATCH_SET=${PATCH:-no}
if [ "${PATCH_SET}" == "no" ]; then
PATCH=patch
else
# allow to set patch from environent variable
PATCH="$(readlink -f $PATCH)"
fi
readonly PATCH

# Process script flags and arguments.
[[ "$#" == 1 ]] || {
echo "Expecting 1 positional argument, verible-verilog-lint path."
Expand Down Expand Up @@ -554,7 +563,7 @@ check_diff "${ORIGINAL_TEST_FILE}" "${TEST_FILE}" "${DIFF_FILE}" \

# Patch source file with generated patch file

patch_out="$(patch "${TEST_FILE}" "${PATCH_FILE}" 2>&1)"
patch_out="$("${PATCH}" "${TEST_FILE}" "${PATCH_FILE}" 2>&1)"
status="$?"
(( $status )) && {
echo "Expected exit code 0 from 'patch' tool, but got $status"
Expand Down Expand Up @@ -616,7 +625,7 @@ check_diff "${ORIGINAL_TEST_FILE_3}" "${TEST_FILE_3}" "${DIFF_FILE_3}" \

# Patch sources with generated patch file

patch_out="$(cd $TEST_TMPDIR; patch -p1 < "${PATCH_FILE}" 2>&1)"
patch_out="$(cd $TEST_TMPDIR; "${PATCH}" -p1 < "${PATCH_FILE}" 2>&1)"
status="$?"
(( $status )) && {
echo "Expected exit code 0 from 'patch' tool, but got $status"
Expand Down Expand Up @@ -718,7 +727,7 @@ interactive_autofix_test() {
"${NO_CHANGES_ERR_MESSAGE}"
(( failure|="$?" ))

patch_out="$(cd $TEST_TMPDIR; patch -p1 < "${PATCH_FILE}" 2>&1)"
patch_out="$(cd $TEST_TMPDIR; "${PATCH}" -p1 < "${PATCH_FILE}" 2>&1)"
status="$?"
(( $status )) && {
echo "Expected exit code 0 from 'patch' tool, but got $status"
Expand Down

0 comments on commit 20eb11e

Please sign in to comment.