]> git.proxmox.com Git - mirror_frr.git/blob - tests/lib/fuzz_zlog_inputs.py
*: auto-convert to SPDX License IDs
[mirror_frr.git] / tests / lib / fuzz_zlog_inputs.py
1 # SPDX-License-Identifier: GPL-2.0-or-later
2 # zlog fuzz-tester input generator
3 #
4 # Copyright (C) 2021 David Lamparter for NetDEF, Inc.
5
6 from itertools import chain
7 import struct
8
9 lengths = set([128])
10 # lengths = [[i, i + 1, i + 3, i - 1, i - 3] for i in lengths]
11 # lengths = set([i for i in chain(*lengths) if i >= 0])
12
13 dsts = [0, 1, 2, 3]
14 fmts = [0, 1, 2, 3]
15
16
17 def combo():
18 for l0 in lengths:
19 for l1 in lengths:
20 for l2 in lengths:
21 for fmt in fmts:
22 for dst in dsts:
23 yield (l0, l1, l2, fmt, dst)
24
25
26 for i, tup in enumerate(combo()):
27 with open("input/i%d" % i, "wb") as fd:
28 fd.write(struct.pack("HHHBB", *tup))