diff options
author | Viacheslav <v.gletenko@vyos.io> | 2025-07-03 06:05:06 +0000 |
---|---|---|
committer | Viacheslav <v.gletenko@vyos.io> | 2025-07-03 06:05:06 +0000 |
commit | 7807f0d0e86d866d993c5d31292e3206e4e88cfd (patch) | |
tree | 66206fa68549b1f5aa65486bae96e88cf0cbf4cf | |
parent | a245f81e0628e2190e51cb863af5a506a8d1fec7 (diff) | |
download | vyos-build-7807f0d0e86d866d993c5d31292e3206e4e88cfd.tar.gz vyos-build-7807f0d0e86d866d993c5d31292e3206e4e88cfd.zip |
T7606: Add include and exclude mode for match check-install qemu
-rwxr-xr-x | scripts/check-qemu-install | 20 |
1 files changed, 16 insertions, 4 deletions
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') |