ud3tn/tools/analysis/stylecheck.sh
Felix Walter e16ec4c579 Enable building a BPv7 decoder binary
This adds a target `data-decoder` which builds a binary to decode a
specified binary file using uD3TN's parsing logic (based on the CLA RX
subsystem) and print details about it. In this first version only the
decoding of BPv7 bundles is implemented.

This binary can be used, e.g., for fuzz testing.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-05-16 11:34:14 +02:00

35 lines
939 B
Bash

#!/bin/bash
# SPDX-License-Identifier: BSD-3-Clause OR Apache-2.0
CHECKPATCH_FLAGS="--no-tree --terse --show-types --ignore AVOID_EXTERNS \
--ignore COMPLEX_MACRO --ignore NEW_TYPEDEFS --ignore FUNCTION_ARGUMENTS \
--ignore SPDX_LICENSE_TAG --ignore LONG_LINE_STRING --ignore REPEATED_WORD \
--typedefsfile ./tools/analysis/stylecheck_typedefs.txt --emacs"
S=0
CHECKPATCH=./external/checkpatch/checkpatch.pl
check_dirs=(include components test/unit test/decoder)
for check_dir in "${check_dirs[@]}"; do
sub_dirs="$(find "$check_dir" -type d)"
for dir in $sub_dirs; do
cnt=`ls -1 $dir/*.c 2>/dev/null | wc -l`
if [ $cnt != 0 ]
then
echo "Checking $dir/*.c..."
$CHECKPATCH $CHECKPATCH_FLAGS --file $dir/*.c
S=$(($S + $?))
fi
cnt=`ls -1 $dir/*.h 2>/dev/null | wc -l`
if [ $cnt != 0 ]
then
echo "Checking $dir/*.h..."
$CHECKPATCH $CHECKPATCH_FLAGS --file $dir/*.h
S=$(($S + $?))
fi
done
done
exit $S