From da732997afa61203eae91cb39989ae4af3711155 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sun, 21 Jul 2024 16:12:07 -0400 Subject: [PATCH] CI: ensure we also check the modifier strings against mainline kernel This would have found and avoided #1176 Signed-off-by: Robin Getz --- CI/azure/check_kernel.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/CI/azure/check_kernel.sh b/CI/azure/check_kernel.sh index e8bb5931d..553c4737f 100755 --- a/CI/azure/check_kernel.sh +++ b/CI/azure/check_kernel.sh @@ -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" @@ -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 @@ -67,4 +69,17 @@ while IFS="" read -r p ; do fi done < /tmp/libiio_iio_modifier +sed '/\[IIO_MOD_.*\] =/!d' ${KERNEL_MODIFIER} | sed 's/,$//' > /tmp/kernel_modifier +sed '/\[IIO_[A-Z]*\] =/!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