jenkins: Validate IEs are added to tlv_definition
It was recently found that several IEs which were added in the header
file were not actually added to the tlv_definition, and hence the tlv
parser failed to decode them. Let's make sure we don't foget to add new
IEs in the future.
Related: SYS#5891
Change-Id: I1f6c274ea86b5803bbf1d845473b98078f46d1ad
diff --git a/contrib/jenkins_common.sh b/contrib/jenkins_common.sh
index b86a479..c39b356 100644
--- a/contrib/jenkins_common.sh
+++ b/contrib/jenkins_common.sh
@@ -12,6 +12,22 @@
verify_value_string_arrays_are_terminated.py
+# Validate enum fields in header are added to tlv_definition in source file (SYS#5891):
+
+verify_gsm0808_tlv_definition() {
+ set +x;
+ enums=$(grep "GSM0808_IE_" include/osmocom/gsm/protocol/gsm_08_08.h | grep "=" | awk '{ print $1 }')
+ counted_enums=$(for f in $enums; do printf "%-60s %s\n" "$f" "$(grep -c "\[$f\]" src/gsm/gsm0808.c)"; done)
+ missing_enums=$(echo "$counted_enums" | grep -v GSM0808_IE_RESERVED | grep "0$" || true)
+ if [ "x$missing_enums" != "x" ]; then
+ echo "Missing IEs in src/gsm/gsm0808.c!"
+ echo "$missing_enums"
+ exit 1
+ fi
+ set -x;
+}
+verify_gsm0808_tlv_definition
+
prep_build() {
_src_dir="$1"
_build_dir="$2"