diff options
author | Max <msuraev@sysmocom.de> | 2017-08-25 17:33:32 +0200 |
---|---|---|
committer | Max <msuraev@sysmocom.de> | 2017-08-25 17:56:19 +0200 |
commit | 6081bd0e6f6ecd28fa2812d64c57123c66587d8b (patch) | |
tree | 6fd243f170d6994e56c69f90ca49d516f46c4d13 | |
parent | d5962a8ac750c39ab7a747e95f15093591845467 (diff) |
Use value string check from osmo-ci
Change-Id: I513835be2d931d0a931cdfc996f361a451bc1a15
-rwxr-xr-x | contrib/jenkins-arm.sh | 2 | ||||
-rwxr-xr-x | contrib/jenkins.sh | 5 | ||||
-rwxr-xr-x | contrib/verify_value_string_arrays_are_terminated.py | 33 |
3 files changed, 4 insertions, 36 deletions
diff --git a/contrib/jenkins-arm.sh b/contrib/jenkins-arm.sh index 510b0e9e..ad992af1 100755 --- a/contrib/jenkins-arm.sh +++ b/contrib/jenkins-arm.sh @@ -2,7 +2,7 @@ set -ex -./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") +verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") autoreconf --install --force ./configure --enable-static \ diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 6a72840d..4a26776d 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -1,8 +1,9 @@ -#!/usr/bin/env bash +#!/bin/sh +# jenkins build helper script for libosmo-sccp. This is how we build on jenkins.osmocom.org set -ex -./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") +verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") if [ "x$label" = "xFreeBSD_amd64" ]; then ENABLE_SANITIZE="" diff --git a/contrib/verify_value_string_arrays_are_terminated.py b/contrib/verify_value_string_arrays_are_terminated.py deleted file mode 100755 index 020bb4dd..00000000 --- a/contrib/verify_value_string_arrays_are_terminated.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 -# vim: expandtab tabstop=2 shiftwidth=2 nocin - -''' -Usage: - verify_value_string_arrays_are_terminated.py PATH [PATH [...]] - -e.g. -libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") -''' - -import re -import sys -import codecs - -value_string_array_re = re.compile( - r'((\bstruct\s+value_string\b[^{;]*?)\s*=[^{;]*{[^;]*}\s*;)', - re.MULTILINE | re.DOTALL) - -members = r'(\.(value|str)\s*=\s*)?' -terminator_re = re.compile('{\s*' + members + '(0|NULL)\s*,' - '\s*' + members + '(0|NULL)\s*}') -errors_found = 0 - -for f in sys.argv[1:]: - arrays = value_string_array_re.findall(codecs.open(f, "r", "utf-8").read()) - for array_def, name in arrays: - if not terminator_re.search(array_def): - print('ERROR: file contains unterminated value_string %r: %r' - % (name, f)) - errors_found += 1 - -sys.exit(errors_found) |