aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMartin Mathieson <martin.mathieson@keysight.com>2020-12-20 20:04:00 +0000
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2020-12-21 11:46:29 +0000
commite2593e20227e2482268f1e69e66537d8de4a6712 (patch)
tree216ab177e5649d9344e962221369277c6a0d9793 /tools
parentb7d93ff0eff58b932c56eef3e33065dddfdf36fd (diff)
Call add item and tfs checking scripts in ubuntu pipeline
N.B. Neither of these scripts return an error code if issues are found.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/check_typed_item_calls.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/tools/check_typed_item_calls.py b/tools/check_typed_item_calls.py
index f55f73dd5a..43984f228a 100755
--- a/tools/check_typed_item_calls.py
+++ b/tools/check_typed_item_calls.py
@@ -11,11 +11,11 @@ import argparse
import signal
import subprocess
-# This utility scans the dissector code for proto_tree_add_...() calls constrain the type of the
-# item added, and checks that the used item is acceptable.
+# This utility scans the dissector code for proto_tree_add_...() calls that constrain the type
+# or length of the item added, and checks that the used item is acceptable.
#
-# Note that this can only work where the hf_item variable is passed in directly - where it
-# is assigned to a different variable it isn't tracked.
+# Note that this can only work where the hf_item variable or length is passed in directly - where it
+# is assigned to a different variable or a macro is used, it isn't tracked.
# TODO:
# Attempt to check length (where literal value is given). Arg position differs among functions.
@@ -162,7 +162,7 @@ known_non_contiguous_fields = { 'wlan.fixed.capabilities.cfpoll.sta',
field_widths = {
- 'FT_BOOLEAN' : 64, # Width depends upon 'display' field, not checked.
+ 'FT_BOOLEAN' : 64, # TODO: Width depends upon 'display' field, not checked.
'FT_UINT8' : 8,
'FT_INT8' : 8,
'FT_UINT16' : 16,
@@ -341,7 +341,7 @@ apiChecks.append(APICheck('proto_tree_add_ascii_7bits_item', { 'FT_STRING'}))
apiChecks.append(APICheck('proto_tree_add_checksum', { 'FT_UINT8', 'FT_UINT16', 'FT_UINT24', 'FT_UINT32'}))
apiChecks.append(APICheck('proto_tree_add_int64_bits_format_value', { 'FT_INT40', 'FT_INT48', 'FT_INT56', 'FT_INT64'}))
-# Also try to check proto_tree_add_item() calls
+# Also try to check proto_tree_add_item() calls (for length)
apiChecks.append(ProtoTreeAddItemCheck())
@@ -366,7 +366,9 @@ def isGeneratedFile(filename):
line.find('is autogenerated') != -1 or
line.find('automatically generated by Pidl') != -1 or
line.find('Created by: The Qt Meta Object Compiler') != -1 or
- line.find('This file was generated') != -1):
+ line.find('This file was generated') != -1 or
+ line.find('This filter was automatically generated') != -1):
+
f_read.close()
return True
@@ -400,8 +402,8 @@ def is_dissector_file(filename):
p = re.compile(r'.*packet-.*\.c')
return p.match(filename)
-def findDissectorFilesInFolder(folder, dissector_files=[], recursive=False):
+def findDissectorFilesInFolder(folder, dissector_files=[], recursive=False):
if recursive:
for root, subfolders, files in os.walk(folder):
for f in files:
@@ -420,7 +422,7 @@ def findDissectorFilesInFolder(folder, dissector_files=[], recursive=False):
-# Check the given dissector file.
+# Run checks on the given dissector file.
def checkFile(filename, check_mask=False, check_label=False, check_consecutive=False):
# Find important parts of items.
items = find_items(filename, check_mask, check_label, check_consecutive)
@@ -431,6 +433,7 @@ def checkFile(filename, check_mask=False, check_label=False, check_consecutive=F
c.check_against_items(items)
+
#################################################################
# Main logic.
@@ -451,7 +454,6 @@ parser.add_argument('--consecutive', action='store_true',
help='when set, copy copy/paste errors between consecutive items')
-
args = parser.parse_args()