commit 7465ea4ad906d2c1fb8a31c01c29b62ccfe7a590 Author: Nick Mathewson nickm@torproject.org Date: Tue Aug 8 10:08:06 2017 -0400
Remove some LCOV_EXCL stuff that I think may be testable after all.
This is partial revert on 22286.
Also, tweak some log messages to be distinct. --- src/common/compress_lzma.c | 4 ---- src/common/compress_zstd.c | 12 ++++-------- 2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/src/common/compress_lzma.c b/src/common/compress_lzma.c index 30d5920ca..d453d9f71 100644 --- a/src/common/compress_lzma.c +++ b/src/common/compress_lzma.c @@ -46,7 +46,6 @@ memory_level(compression_level_t level) static const char * lzma_error_str(lzma_ret error) { - // LCOV_EXCL_START switch (error) { case LZMA_OK: return "Operation completed successfully"; @@ -75,7 +74,6 @@ lzma_error_str(lzma_ret error) default: return "Unknown LZMA error"; } - // LCOV_EXCL_STOP } #endif // HAVE_LZMA.
@@ -303,12 +301,10 @@ tor_lzma_compress_process(tor_lzma_compress_state_t *state, case LZMA_DATA_ERROR: case LZMA_PROG_ERROR: default: - // LCOV_EXCL_START log_warn(LD_GENERAL, "LZMA %s didn't finish: %s.", state->compress ? "compression" : "decompression", lzma_error_str(retval)); return TOR_COMPRESS_ERROR; - // LCOV_EXCL_STOP } #else // HAVE_LZMA. (void)state; diff --git a/src/common/compress_zstd.c b/src/common/compress_zstd.c index 5c5026c37..0808bcd9a 100644 --- a/src/common/compress_zstd.c +++ b/src/common/compress_zstd.c @@ -197,7 +197,8 @@ tor_zstd_compress_new(int compress,
if (result->u.compress_stream == NULL) { // LCOV_EXCL_START - log_warn(LD_GENERAL, "Error while creating Zstandard stream"); + log_warn(LD_GENERAL, "Error while creating Zstandard compression " + "stream"); goto err; // LCOV_EXCL_STOP } @@ -216,7 +217,8 @@ tor_zstd_compress_new(int compress,
if (result->u.decompress_stream == NULL) { // LCOV_EXCL_START - log_warn(LD_GENERAL, "Error while creating Zstandard stream"); + log_warn(LD_GENERAL, "Error while creating Zstandard decompression " + "stream"); goto err; // LCOV_EXCL_STOP } @@ -313,12 +315,10 @@ tor_zstd_compress_process(tor_zstd_compress_state_t *state, }
if (ZSTD_isError(retval)) { - // LCOV_EXCL_START log_warn(LD_GENERAL, "Zstandard %s didn't finish: %s.", state->compress ? "compression" : "decompression", ZSTD_getErrorName(retval)); return TOR_COMPRESS_ERROR; - // LCOV_EXCL_STOP }
if (state->compress && !state->have_called_end) { @@ -328,11 +328,9 @@ tor_zstd_compress_process(tor_zstd_compress_state_t *state, *out_len = output.size - output.pos;
if (ZSTD_isError(retval)) { - // LCOV_EXCL_START log_warn(LD_GENERAL, "Zstandard compression unable to flush: %s.", ZSTD_getErrorName(retval)); return TOR_COMPRESS_ERROR; - // LCOV_EXCL_STOP }
// ZSTD_flushStream returns 0 if the frame is done, or >0 if it @@ -359,12 +357,10 @@ tor_zstd_compress_process(tor_zstd_compress_state_t *state, *out_len = output.size - output.pos;
if (ZSTD_isError(retval)) { - // LCOV_EXCL_START log_warn(LD_GENERAL, "Zstandard compression unable to write " "epilogue: %s.", ZSTD_getErrorName(retval)); return TOR_COMPRESS_ERROR; - // LCOV_EXCL_STOP }
// endStream returns the number of bytes that is needed to write the