Skip to content

Commit

Permalink
CI: ensure we also check the modifier strings against mainline kernel
Browse files Browse the repository at this point in the history
This would have found and avoided analogdevicesinc#1176

Signed-off-by: Robin Getz <[email protected]>
  • Loading branch information
rgetz committed Jul 21, 2024
1 parent fea2a83 commit 825c8d7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion CI/azure/check_kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -e

KERNEL_TYPES="/tmp/mainline_types.h"
KERNEL_MODIFIER="/tmp/modifier.c"
IIOH="./include/iio/iio.h"
CHANNELC="./channel.c"

Expand All @@ -15,8 +16,9 @@ if [ ! -f ${CHANNELC} ] ; then
exit 1
fi

rm -f ${KERNEL_TYPES}
rm -f ${KERNEL_TYPES} ${KERNEL_MODIFIER}
wget -O ${KERNEL_TYPES} https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/iio/types.h
wget -O ${KERNEL_MODIFIER} https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/drivers/iio/industrialio-core.c

ret=0

Expand Down Expand Up @@ -67,4 +69,16 @@ while IFS="" read -r p ; do
fi
done < /tmp/libiio_iio_modifier

sed '/\[IIO_MOD_.*\] =/!d' ${KERNEL_MODIFIER} | sed 's/,$//' > /tmp/kernel_modifier
while IFS="" read -r p ; do
key=$(echo $"${p}" | sed -e 's/^[ \t]*//' -e 's/\[/\\\[/g' -e 's/\]/\\\]/g' )
count=$(grep "${key}" ./channel.c | wc -l)
if [ "$count" -eq "0" ] ; then
echo "${p} set to wrong string in channel.c"
ret=1
fi
done < /tmp/kernel_modifier


rm -f /tmp/kernel_modifier /tmp/libiio_iio_modifier /tmp/libiio_iio_chan_type ${KERNEL_TYPES} ${KERNEL_MODIFIER}
exit $ret

0 comments on commit 825c8d7

Please sign in to comment.