(command, outfile, add_magic_str=False)
| 11 | |
| 12 | |
| 13 | def update_test(command, outfile, add_magic_str=False): |
| 14 | if isinstance(command, str): |
| 15 | print(">", command) |
| 16 | else: |
| 17 | print("\n".join(f"> {c}" for c in command)) |
| 18 | result = run_command_and_get_result(command) |
| 19 | stdout = result.stdout.decode().strip() |
| 20 | if add_magic_str: |
| 21 | # add magic string to beginning |
| 22 | magic_str = "/.*/" |
| 23 | stdout = magic_str + stdout |
| 24 | # add magic string after attack |
| 25 | mid_attack_str = "\n--------------------------------------------- Result 1" |
| 26 | stdout.replace(mid_attack_str, magic_str + mid_attack_str) |
| 27 | # write to file |
| 28 | open(outfile, "w").write(stdout + "\n") |
| 29 | |
| 30 | |
| 31 | def main(): |
no test coverage detected