Call add item and tfs checking scripts in ubuntu pipeline

N.B. Neither of these scripts return an error code if issues are found.
This commit is contained in:
Martin Mathieson 2020-12-20 20:04:00 +00:00 committed by Wireshark GitLab Utility
parent b7d93ff0ef
commit e2593e2022
2 changed files with 16 additions and 10 deletions

View File

@ -317,6 +317,8 @@ merge-req:ubuntu-clang-other-tests:
- cd ..
- python3 tools/checklicenses.py
- ./tools/cppcheck/cppcheck.sh -l 1 -x | tee cppcheck_report.xml
- ./tools/check_typed_item_calls.py --commits 1 | tee item_calls_check.txt
- ./tools/check_tfs.py --commits 1 | tee tfs_check.txt
- if [[ -s "cppcheck_report.xml" ]]; then cppcheck-htmlreport --file cppcheck_report.xml --report-dir . ; fi
- cd build
- cmake -DENABLE_EXTRA_COMPILER_WARNINGS=on -DENABLE_CHECKHF_CONFLICT=on -DCMAKE_EXPORT_COMPILE_COMMANDS=on -DENABLE_CCACHE=ON -G Ninja ..
@ -328,6 +330,8 @@ merge-req:ubuntu-clang-other-tests:
paths:
- cppcheck_report.xml
- cppcheck_report.html
- item_calls_check.txt
- tfs_check.txt
# XXX This is still beta:
# https://docs.gitlab.com/ee/user/gitlab_com/index.html#windows-shared-runners-beta

View File

@ -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()