Browse Source

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.
Nick Mathewson 6 years ago
parent
commit
7465ea4ad9
2 changed files with 4 additions and 12 deletions
  1. 0 4
      src/common/compress_lzma.c
  2. 4 8
      src/common/compress_zstd.c

+ 0 - 4
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;

+ 4 - 8
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