diff options
| author | KunoiSayami <[email protected]> | 2023-06-19 02:05:56 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2023-06-19 02:05:56 +0800 |
| commit | 14e6ffcc19a47e79325fcf18778c443473ed775b (patch) | |
| tree | f1ffcc196dfee009c2687bc00177a96b5ce73941 /analysis0617.py | |
| parent | 813049a3ff85b18bc1ca6f640c7677c8bbf39414 (diff) | |
feat(exp): Add a argument in test
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'analysis0617.py')
| -rwxr-xr-x | analysis0617.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/analysis0617.py b/analysis0617.py index 46a36b9..2e1fe7a 100755 --- a/analysis0617.py +++ b/analysis0617.py @@ -8,21 +8,22 @@ import random async def grab_output(p: asyncio.subprocess.Process) -> float | None: out = (await p.communicate())[0].decode() if p.returncode: - print("Error:", out) + print("Error:", p.returncode, out.strip()) return None print(out.strip()) return float(out.rsplit(':')[-1]) -async def run_custom_exec(p_s: str, sample: int, search: int, insertion: int) -> float | None: - p = (await asyncio.create_subprocess_exec(p_s, str(sample), str(search), str(insertion), - stdout=asyncio.subprocess.PIPE)) +async def run_custom_exec(p_s: str, sample: int, search: int, insertion: int, total_row: str) -> float | None: + p = (await asyncio.create_subprocess_exec(p_s, str(sample), str(search), str(insertion), total_row, + stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.STDOUT)) await p.wait() return await grab_output(p) -async def run_exec(p_s: str, search: int, insertion: int) -> float | None: - p = await asyncio.create_subprocess_exec(p_s, str(search), str(insertion), stdout=asyncio.subprocess.PIPE) +async def run_exec(p_s: str, search: int, insertion: int, total_row: str) -> float | None: + p = await asyncio.create_subprocess_exec(p_s, str(search), str(insertion), total_row, + stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.STDOUT) await p.wait() return await grab_output(p) @@ -78,7 +79,7 @@ async def main(matches: argparse.Namespace) -> None: for _ in range(3): await asyncio.sleep(1) retries = 3 - while (normal := await run_exec(matches.exec2, search, insertion)) is None: + while (normal := await run_exec(matches.exec2, search, insertion, matches.total_row)) is None: retries -= 1 fault_run += 1 if not retries: @@ -86,7 +87,9 @@ async def main(matches: argparse.Namespace) -> None: total_run += 4 - retries await asyncio.sleep(1) retries = 3 - while (custom := await run_custom_exec(matches.exec1, sample, search, insertion)) is None: + while ( + custom := await run_custom_exec(matches.exec1, sample, search, insertion, + matches.total_row)) is None: retries -= 1 fault_run += 1 if not retries: @@ -108,6 +111,7 @@ if __name__ == '__main__': run_.add_argument("exec2") run_.add_argument("sample_limit") run_.add_argument("limit") + run_.add_argument("--total-row", default=0) run_.add_argument("--test-times", default=3) parser_ = arg_.parse_args() if parser_.sub == 'run': |
