summaryrefslogtreecommitdiffstats
path: root/tools/check-messages.py
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2024-08-19 17:09:25 +0200
committerAndrei Pavel <andrei@isc.org>2024-08-22 14:47:23 +0200
commit87005846b0a2ce899f5a6e95291aee699f802086 (patch)
tree1806a4950249d2f1f1c964b5cefb0e40e7932078 /tools/check-messages.py
parent[#1945] minor: add +x permission to reorder_message_file.py (diff)
downloadkea-87005846b0a2ce899f5a6e95291aee699f802086.tar.xz
kea-87005846b0a2ce899f5a6e95291aee699f802086.zip
[#1945] take premium exhonerated duplicate messages into account
This makes it easier to run `./tools/check-messages.py` to correctly assess the state of messages while developing Kea without having to remove the premium directory.
Diffstat (limited to '')
-rwxr-xr-xtools/check-messages.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/check-messages.py b/tools/check-messages.py
index d5347a202d..3ac03052e9 100755
--- a/tools/check-messages.py
+++ b/tools/check-messages.py
@@ -29,12 +29,17 @@ This script does several verifications regarding logged messages:
def check_duplicate_occurences(occurences):
exhonerated = {}
parent_dir = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0])))
- with open(f'{parent_dir}/exhonerated-duplicate-messages.txt', 'r', encoding='utf-8') as f:
- lines = f.read().splitlines()
- for line in lines:
- message_id = line.split('%')[1].split(':')[0].strip()
- max_allowed = line.split(':')[1].strip()
- exhonerated[message_id] = int(max_allowed)
+ for exh_txt in [
+ f'{parent_dir}/exhonerated-duplicate-messages.txt',
+ f'{parent_dir}/../premium/tools/exhonerated-duplicate-messages.txt',
+ ]:
+ if pathlib.Path(exh_txt).is_file():
+ with open(exh_txt, 'r', encoding='utf-8') as f:
+ lines = f.read().splitlines()
+ for line in lines:
+ message_id = line.split('%')[1].split(':')[0].strip()
+ max_allowed = line.split(':')[1].strip()
+ exhonerated[message_id] = int(max_allowed)
failure = False
duplicate_occurences = {k: v for k, v in occurences.items() if v > 1}