-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1910 from ndim/guard-against-zombie-problems
Add checks for zombie sourcecode problems
- Loading branch information
Showing
6 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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,24 @@ | ||
name: "Check Sourcecode" | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- 'onlinedocs' | ||
pull_request: | ||
branches-ignore: | ||
- 'onlinedocs' | ||
|
||
jobs: | ||
|
||
check-sourcecode: | ||
name: "Check Sourcecode" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
# - name: Install prerequisites | ||
|
||
- name: "Check the sourcecode" | ||
run: ./tools/check-sourcecode |
This file contains 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 |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
|
||
%{ | ||
|
||
#include "ac_cfg.h" | ||
#include <ac_cfg.h> | ||
|
||
#include <stdlib.h> | ||
#include <string.h> | ||
|
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
* | ||
*/ | ||
|
||
#include "ac_cfg.h" | ||
#include <ac_cfg.h> | ||
|
||
#include "avrdude.h" | ||
#include "libavrdude.h" | ||
|
This file contains 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,53 @@ | ||
#!/usr/bin/env bash | ||
# check-sourcecode -- check the avrdude source code for zombie mistakes | ||
# Copyright (C) 2024 Hans Ulrich Niedermann <hun@n-dimensional.de> | ||
# SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
|
||
set -e | ||
|
||
prog="$(basename "$0")" | ||
cd "$(dirname "$0")" | ||
cd .. | ||
test -s README.md | ||
test -s COPYING | ||
test -s build.sh | ||
test -d .git/refs/heads | ||
|
||
|
||
declare -a checks=() | ||
fail=0 | ||
succ=0 | ||
|
||
|
||
checks+=(check_ac_cfg) | ||
check_ac_cfg() { | ||
if git grep -E '#include\s+"ac_cfg\.h"' | ||
then | ||
echo "Error: Found #include \"ac_cfg.h\" with double quotes \"\". Should be <>." | ||
echo " See https://github.com/avrdudes/avrdude/issues/1706 for details." | ||
return 1 | ||
fi | ||
} | ||
|
||
|
||
for check in "${checks[@]}" | ||
do | ||
if "$check"; then | ||
succ=$(( "$succ" + 1 )) | ||
status="SUCC" | ||
else | ||
fail=$(( "$fail" + 1 )) | ||
status="FAIL" | ||
fi | ||
echo "$status $check" | ||
done | ||
total=$(( "$succ" + "$fail" )) | ||
|
||
|
||
echo "$prog: Summary: $fail checks failed, $succ checks succeeded. $total checks in total." | ||
if [[ "$fail" -gt 0 ]]; then | ||
exit 1 | ||
else | ||
exit 0 | ||
fi |