diff options
author | Lars Wirzenius <liw@liw.fi> | 2024-01-09 12:11:39 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2024-01-09 12:11:39 +0200 |
commit | b5f2076af96915496a3c90811b3542cfb76d47ad (patch) | |
tree | aba783d705527e5d4ca598eb86173eeb984e6895 | |
parent | 3cd0e9d954713871970bd85791515957de3ac411 (diff) | |
download | wumpus-hunter-b5f2076af96915496a3c90811b3542cfb76d47ad.tar.gz |
feat: name log files to indicate success or failure
Signed-off-by: Lars Wirzenius <liw@liw.fi>
-rwxr-xr-x | wumpus-hunter | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/wumpus-hunter b/wumpus-hunter index c701435..ac3398d 100755 --- a/wumpus-hunter +++ b/wumpus-hunter @@ -194,12 +194,16 @@ def remove_log(log): os.remove(log) -def rename_log(log, dirname, commit): +def rename_log(log, dirname, commit, succeeded): commit_dir = os.path.join(dirname, f"log-{commit}") if not os.path.exists(commit_dir): os.mkdir(commit_dir) timestamp = time.strftime("%Y-%m-%dT%H:%M:%S") - run_log = os.path.join(commit_dir, f"log-{timestamp}.txt") + if succeeded: + suffix = "success" + else: + suffix = "fail" + run_log = os.path.join(commit_dir, f"log-{timestamp}.{suffix}.txt") os.rename(log, run_log) @@ -274,13 +278,13 @@ def main(): run_tests(args.dir, args.test) record_success(args.stats, commit) if args.keep: - rename_log(args.log, args.run_log, commit) + rename_log(args.log, args.run_log, commit, True) else: remove_log(args.log) except Exception as e: logging.error(f"{e}", exc_info=True) record_failure(args.stats, commit) - rename_log(args.log, args.run_log, commit) + rename_log(args.log, args.run_log, commit, False) if args.counts: count(args.dir, args.counts, args.stats) |