-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor progress bar & summary line logic
* Centralize the logic about whether to print the progress bar or not in the `*_PROGRESS()` macros. * Centralize the logc about whether to print the summary line or not in `FIO_shouldDisplayFileSummary()` and `FIO_shouldDisplayMultipleFileSummary()`. * Make `--progress` work for non-zstd (de)compressors. * Clean up several edge cases in compression and decompression progress printing along the way. E.g. wrong log level, or missing summary line. One thing I don't like about stdout mode, which sets the display level to 1, is that warnings aren't displayed. After this PR, we could change stdout mode from lowering the display level, to defaulting to implied `--no-progress`. But, I think that deserves a separate PR.
- Loading branch information
Showing
6 changed files
with
318 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh | ||
|
||
#!/bin/sh | ||
|
||
. "$COMMON/platform.sh" | ||
|
||
set -e | ||
|
||
echo hello > hello | ||
echo world > world | ||
|
||
zstd -q hello world | ||
|
||
println >&2 "Tests cases where progress information should not be printed" | ||
|
||
for args in \ | ||
"" \ | ||
"--fake-stderr-is-console -q" \ | ||
"--fake-stderr-is-console -qq --progress" \ | ||
"--no-progress --fake-stderr-is-console" \ | ||
"--no-progress --fake-stderr-is-console -v" | ||
do | ||
println >&2 "args = $args" | ||
println >&2 "compress file to file" | ||
zstd $args -f hello | ||
println >&2 "compress pipe to pipe" | ||
zstd $args < hello > $INTOVOID | ||
println >&2 "compress pipe to file" | ||
zstd $args < hello -fo hello.zst | ||
println >&2 "compress file to pipe" | ||
zstd $args hello -c > $INTOVOID | ||
println >&2 "compress 2 files" | ||
zstd $args -f hello world | ||
|
||
println >&2 "decompress file to file" | ||
zstd $args -d -f hello.zst | ||
println >&2 "decompress pipe to pipe" | ||
zstd $args -d < hello.zst > $INTOVOID | ||
println >&2 "decompress pipe to file" | ||
zstd $args -d < hello.zst -fo hello | ||
println >&2 "decompress file to pipe" | ||
zstd $args -d hello.zst -c > $INTOVOID | ||
println >&2 "decompress 2 files" | ||
zstd $args -d -f hello.zst world.zst | ||
println >&2 "" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
Tests cases where progress information should not be printed | ||
args = | ||
compress file to file | ||
compress pipe to pipe | ||
compress pipe to file | ||
compress file to pipe | ||
compress 2 files | ||
decompress file to file | ||
decompress pipe to pipe | ||
decompress pipe to file | ||
decompress file to pipe | ||
decompress 2 files | ||
|
||
args = --fake-stderr-is-console -q | ||
compress file to file | ||
compress pipe to pipe | ||
compress pipe to file | ||
compress file to pipe | ||
compress 2 files | ||
decompress file to file | ||
decompress pipe to pipe | ||
decompress pipe to file | ||
decompress file to pipe | ||
decompress 2 files | ||
|
||
args = --fake-stderr-is-console -qq --progress | ||
compress file to file | ||
compress pipe to pipe | ||
compress pipe to file | ||
compress file to pipe | ||
compress 2 files | ||
decompress file to file | ||
decompress pipe to pipe | ||
decompress pipe to file | ||
decompress file to pipe | ||
decompress 2 files | ||
|
||
args = --no-progress --fake-stderr-is-console | ||
compress file to file | ||
hello*hello.zst* | ||
compress pipe to pipe | ||
compress pipe to file | ||
*stdin*hello.zst* | ||
compress file to pipe | ||
compress 2 files | ||
2 files compressed* | ||
decompress file to file | ||
hello.zst* | ||
decompress pipe to pipe | ||
decompress pipe to file | ||
*stdin* | ||
decompress file to pipe | ||
decompress 2 files | ||
2 files decompressed* | ||
|
||
args = --no-progress --fake-stderr-is-console -v | ||
compress file to file | ||
*zstd* | ||
hello*hello.zst* | ||
compress pipe to pipe | ||
*zstd* | ||
*stdin*stdout* | ||
compress pipe to file | ||
*zstd* | ||
*stdin*hello.zst* | ||
compress file to pipe | ||
*zstd* | ||
*hello*stdout* | ||
compress 2 files | ||
*zstd* | ||
*hello*hello.zst* | ||
*world*world.zst* | ||
2 files compressed* | ||
decompress file to file | ||
*zstd* | ||
hello.zst* | ||
decompress pipe to pipe | ||
*zstd* | ||
*stdin* | ||
decompress pipe to file | ||
*zstd* | ||
*stdin* | ||
decompress file to pipe | ||
*zstd* | ||
hello.zst* | ||
decompress 2 files | ||
*zstd* | ||
hello.zst* | ||
world.zst* | ||
2 files decompressed* |
Oops, something went wrong.