Skip to content

Commit 6a7aec1

Browse files
committed
[libc++] Fix bug with appending and overwriting in benchmark-historical
The logic was wrong when the data file did not already exist but we were in 'append' mode.
1 parent a4168a6 commit 6a7aec1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libcxx/utils/benchmark-historical

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ def main(argv):
9191

9292
subprocess.call(test_cmd)
9393
output_file.parent.mkdir(parents=True, exist_ok=True)
94+
mode = 'a' if args.existing == 'append' else 'w'
9495
if output_file.exists() and args.existing == 'append':
9596
logging.info(f'Appending to existing data for {commit}')
96-
mode = 'a'
97-
else:
98-
assert args.existing == 'overwrite'
97+
elif output_file.exists() and args.existing == 'overwrite':
9998
logging.info(f'Overwriting existing data for {commit}')
100-
mode = 'w'
99+
else:
100+
logging.info(f'Writing data for {commit}')
101101
with open(output_file, mode) as out:
102102
subprocess.check_call([(PARENT_DIR / 'consolidate-benchmarks'), build_dir], stdout=out)
103103

0 commit comments

Comments
 (0)