From 7807f0d0e86d866d993c5d31292e3206e4e88cfd Mon Sep 17 00:00:00 2001 From: Viacheslav Date: Thu, 3 Jul 2025 06:05:06 +0000 Subject: T7606: Add include and exclude mode for match check-install qemu --- scripts/check-qemu-install | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'scripts/check-qemu-install') diff --git a/scripts/check-qemu-install b/scripts/check-qemu-install index 8d6dbece..53e1c74d 100755 --- a/scripts/check-qemu-install +++ b/scripts/check-qemu-install @@ -875,12 +875,24 @@ try: # else, run configtest suite elif args.configtest: + # Remove config-tests that we don't want to run if args.match: - # Remove config-tests that we don't want to run - match_str = '-o '.join([f'-name "{name}"' for name in args.match.split("|")]) - c.sendline(f'sudo find /usr/libexec/vyos/tests/config -mindepth 1 -maxdepth 1 ! \( {match_str} \) -exec rm -rf {{}} +') + if args.match.startswith("!"): + # Exclude mode — delete only the matched names + names = args.match[1:].split("|") + match_str = '-o '.join([f'-name "{name}"' for name in names]) + cleanup_config_dir_cmd = f'sudo find /usr/libexec/vyos/tests/config -mindepth 1 -maxdepth 1 \\( {match_str} \\) -exec rm -rf {{}} +' + cleanup_config_tests_dir_cmd = f'sudo find /usr/libexec/vyos/tests/config-tests -mindepth 1 -maxdepth 1 \\( {match_str} \\) -exec rm -rf {{}} +' + else: + # Include mode — keep only the matched names, delete the rest + names = args.match.split("|") + match_str = '-o '.join([f'-name "{name}"' for name in names]) + cleanup_config_dir_cmd = f'sudo find /usr/libexec/vyos/tests/config -mindepth 1 -maxdepth 1 ! \\( {match_str} \\) -exec rm -rf {{}} +' + cleanup_config_tests_dir_cmd = f'sudo find /usr/libexec/vyos/tests/config-tests -mindepth 1 -maxdepth 1 ! \\( {match_str} \\) -exec rm -rf {{}} +' + + c.sendline(cleanup_config_dir_cmd) c.expect(op_mode_prompt) - c.sendline(f'sudo find /usr/libexec/vyos/tests/config-tests -mindepth 1 -maxdepth 1 ! \( {match_str} \) -exec rm -rf {{}} +') + c.sendline(cleanup_config_tests_dir_cmd) c.expect(op_mode_prompt) log.info('Adding a legacy WireGuard default keypair for migrations') -- cgit v1.2.3