You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-15 01:04:37 +02:00
Move command-line decompress check in common/compress test.
It makes sense to do this check right after the first compression so any issues are caught early. Also, none of the current compression formats omit decompressCmd so make the test mandatory.
This commit is contained in:
@ -94,6 +94,13 @@ testSuite(CompressType type, const char *decompressCmd)
|
||||
256 * 1024 * 1024),
|
||||
"simple data - compress large in/large out buffer");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("compressed output can be decompressed with command-line tool");
|
||||
|
||||
storagePutP(storageNewWriteP(storageTest, STRDEF("test.cmp")), compressed);
|
||||
TEST_SYSTEM_FMT("%s {[path]}/test.cmp > {[path]}/test.out", decompressCmd);
|
||||
TEST_RESULT_BOOL(bufEq(decompressed, storageGetP(storageNewReadP(storageTest, STRDEF("test.out")))), true, "check output");
|
||||
|
||||
TEST_RESULT_BOOL(
|
||||
bufEq(compressed, testCompress(compressFilter(type, 1), decompressed, 1024, 1)), true,
|
||||
"simple data - compress large in/small out buffer");
|
||||
@ -125,16 +132,6 @@ testSuite(CompressType type, const char *decompressCmd)
|
||||
bufEq(decompressed, testDecompress(decompressFilter(type), compressed, 1, 1)), true,
|
||||
"simple data - decompress small in/small out buffer");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
if (decompressCmd != NULL)
|
||||
{
|
||||
TEST_TITLE("compressed output can be decompressed with command-line tool");
|
||||
|
||||
storagePutP(storageNewWriteP(storageTest, STRDEF("test.cmp")), compressed);
|
||||
TEST_SYSTEM_FMT("%s {[path]}/test.cmp > {[path]}/test.out", decompressCmd);
|
||||
TEST_RESULT_BOOL(bufEq(decompressed, storageGetP(storageNewReadP(storageTest, STRDEF("test.out")))), true, "check output");
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("error on no compression data");
|
||||
|
||||
|
Reference in New Issue
Block a user