Skip to content

Commit 67604f2

Browse files
committed
tests/gen-tests-mk: allow overriding the set of attacks via --attacks
Fixes #2. Signed-off-by: Tim Janik <timj@gnu.org>
1 parent 8fcd988 commit 67604f2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/gen-tests-mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def main():
127127
parser.add_argument ("--seed", type = int, default = None, help = "Seed for random number generators")
128128
parser.add_argument ("--without-original", action = "store_true", help = "Disable use of original image for detection.")
129129
parser.add_argument ("--cornersync", choices = ['on', 'off', 'auto'], default = 'auto', help = "Set cornersync aided detection mode (on|off|auto).")
130+
parser.add_argument ("--attacks", type = str, default = 'all', help = "Comma-separated list of attacks to run.")
130131
args = parser.parse_args()
131132
seed = args.seed if args.seed is not None else random.randint (0, 2**32 - 1)
132133
random.seed (seed)
@@ -151,6 +152,8 @@ def main():
151152
content = re.sub (r'^SRCDIR\s*\?=.*', f'SRCDIR := {SRCDIR}', content, 0, re.M)
152153
content = re.sub (r'^WITHOUT_ORIGINAL\s*\?=.*', f'WITHOUT_ORIGINAL := {str (args.without_original).lower()}', content, 0, re.M)
153154
content = re.sub (r'^CORNERSYNC_MODE\s*\?=.*', f'CORNERSYNC_MODE := {str (args.cornersync).lower()}', content, 0, re.M)
155+
if args.attacks and 'all' != args.attacks:
156+
content = re.sub (r'^(ATTACKS\s*\?=.*)', f'# \\1\nATTACKS ?= { " ".join (args.attacks.split (",")) }', content, 0, re.M)
154157
dst.write (content)
155158

156159
# crawl imagedir for files with an image extension

0 commit comments

Comments
 (0)