-
Notifications
You must be signed in to change notification settings - Fork 13
tests: dt_binding_check: new test #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
vladimiroltean
wants to merge
1
commit into
linux-netdev:main
Choose a base branch
from
vladimiroltean:dt_binding_check
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| #!/bin/bash | ||
| # SPDX-License-Identifier: GPL-2.0 | ||
| # Copyright 2025 NXP | ||
|
|
||
| HEAD=$(git rev-parse HEAD) | ||
| ncpu=$(grep -c processor /proc/cpuinfo) | ||
| rc=0 | ||
|
|
||
| pr() { | ||
| echo " ====== $* ======" | tee -a /dev/stderr | ||
| } | ||
|
|
||
| build() { | ||
| make -j $ncpu DT_CHECKER_FLAGS=-m dt_binding_check 2>&1 | ||
| } | ||
|
|
||
| # Only run this check if the patch touches DT binding files. | ||
| if ! git show --diff-filter=AM --pretty="" --name-only "${HEAD}" | \ | ||
| grep -q -E "^Documentation/devicetree/bindings/" | ||
| then | ||
| echo "No DT binding files touched, skip" >&"$DESC_FD" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Create temporary files for logs | ||
| tmpfile_o_raw=$(mktemp) | ||
| tmpfile_n_raw=$(mktemp) | ||
| tmpfile_o_filtered=$(mktemp) | ||
| tmpfile_n_filtered=$(mktemp) | ||
| tmp_new_issues=$(mktemp) | ||
|
|
||
| echo "Tree base:" | ||
| git log -1 --pretty='%h ("%s")' HEAD~ | ||
| echo "Now at:" | ||
| git log -1 --pretty='%h ("%s")' HEAD | ||
|
|
||
| # Define the filter pattern to exclude build noise from the make output. | ||
| # We only want to see the actual error/warning lines. | ||
| FILTER_PATTERN="^(make\[| CHKDT| DTC| DTEX| HOSTCC| HOSTLD| LEX| LINT| SCHEMA| YACC|$)" | ||
|
|
||
| pr "Checking before the patch" | ||
| git checkout -q HEAD~ | ||
|
|
||
| # Run the check on the parent commit | ||
| (build | tee -a "$tmpfile_o_raw") || true | ||
|
|
||
| # Filter and sort the output to get only relevant issue lines | ||
| grep -v -E "$FILTER_PATTERN" "$tmpfile_o_raw" | sort > "$tmpfile_o_filtered" | ||
| incumbent_total=$(wc -l < "$tmpfile_o_filtered") | ||
|
|
||
| pr "Checking the tree with the patch" | ||
| git checkout -q "$HEAD" | ||
|
|
||
| # Run the check on the new commit | ||
| (build | tee -a "$tmpfile_n_raw") || true | ||
|
|
||
| # Filter and sort the output | ||
| grep -v -E "$FILTER_PATTERN" "$tmpfile_n_raw" | sort > "$tmpfile_n_filtered" | ||
| current_total=$(wc -l < "$tmpfile_n_filtered") | ||
|
|
||
| # Compare the filtered lists to find new and fixed issues | ||
| # Use comm to find fixed issues (lines only in the old log, column 1). | ||
| fixed_issues_count=$(comm -23 "$tmpfile_o_filtered" "$tmpfile_n_filtered" | wc -l) | ||
|
|
||
| # Use comm to find new issues (lines only in the new log, column 2) | ||
| # and save them for later display. | ||
| comm -13 "$tmpfile_o_filtered" "$tmpfile_n_filtered" > "$tmp_new_issues" | ||
| new_issues_count=$(wc -l < "$tmp_new_issues") | ||
|
|
||
| echo "Issues before: $incumbent_total, after: $current_total" \ | ||
| "(Fixed: $fixed_issues_count, New: $new_issues_count)" >&"$DESC_FD" | ||
|
|
||
| if [ "$new_issues_count" -gt 0 ]; then | ||
| echo "New issues added:" 1>&2 | ||
| # Print the new issues we saved | ||
| cat "$tmp_new_issues" 1>&2 | ||
| rc=1 | ||
| elif [ "$fixed_issues_count" -gt 0 ]; then | ||
| echo "Patch fixed $fixed_issues_count issue(s)." >&2 | ||
| # No new issues, and some were fixed. This is a success. | ||
| fi | ||
|
|
||
| rm "$tmpfile_o_raw" "$tmpfile_n_raw" "$tmpfile_o_filtered" "$tmpfile_n_filtered" \ | ||
| "$tmp_new_issues" | ||
|
|
||
| exit $rc | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "run": ["dt_binding_check.sh"] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps use 'make -s' instead. Then you need all lines.
I'm happy to adjust the warnings format if that helps.