diff --git a/programs/fileio.c b/programs/fileio.c index 855385be..538438cd 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -180,7 +180,7 @@ static FILE* FIO_openSrcFile(const char* srcFileName) return f; } - +/* `dstFileName must` be non-NULL */ static FILE* FIO_openDstFile(const char* dstFileName) { FILE* f; diff --git a/programs/fileio.h b/programs/fileio.h index 4a4f3d22..06d977d6 100644 --- a/programs/fileio.h +++ b/programs/fileio.h @@ -31,7 +31,6 @@ extern "C" { /* ************************************* * Special i/o constants **************************************/ -#define nullString "null" #define stdinmark "stdin" #define stdoutmark "stdout" #ifdef _WIN32 diff --git a/programs/playTests.sh b/programs/playTests.sh index b19c2bc5..6939aa81 100755 --- a/programs/playTests.sh +++ b/programs/playTests.sh @@ -206,6 +206,9 @@ $ECHO "test multiple files (*.zst) " $ZSTD -t *.zst $ECHO "test good and bad files (*) " $ZSTD -t * && die "bad files not detected !" +$ECHO "test --rm and --test combined " +$ZSTD -t --rm tmp1.zst +ls -ls tmp1.zst # check file is still present $ECHO "\n**** zstd round-trip tests **** " diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 344d3c88..30e0d01b 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -206,6 +206,7 @@ int main(int argCount, const char** argv) int argNb, bench=0, decode=0, + testmode=0, forceStdout=0, main_pause=0, nextEntryIsDictionary=0, @@ -273,7 +274,7 @@ int main(int argCount, const char** argv) if (!strcmp(argument, "--no-dictID")) { FIO_setDictIDFlag(0); continue; } if (!strcmp(argument, "--sparse")) { FIO_setSparseWrite(2); continue; } if (!strcmp(argument, "--no-sparse")) { FIO_setSparseWrite(0); continue; } - if (!strcmp(argument, "--test")) { decode=1; outFileName=nulmark; FIO_overwriteMode(); continue; } + if (!strcmp(argument, "--test")) { testmode=1; decode=1; continue; } if (!strcmp(argument, "--train")) { dictBuild=1; outFileName=g_defaultDictName; continue; } if (!strcmp(argument, "--maxdict")) { nextArgumentIsMaxDict=1; continue; } if (!strcmp(argument, "--dictID")) { nextArgumentIsDictID=1; continue; } @@ -337,7 +338,7 @@ int main(int argCount, const char** argv) case 'C': argument++; FIO_setChecksumFlag(2); break; /* test compressed file */ - case 't': decode=1; outFileName=nulmark; argument++; break; + case 't': testmode=1; decode=1; argument++; break; /* destination file name */ case 'o': nextArgumentIsOutFileName=1; argument++; break; @@ -503,6 +504,7 @@ int main(int argCount, const char** argv) #endif { /* decompression */ #ifndef ZSTD_NODECOMPRESS + if (testmode) { outFileName=nulmark; FIO_setRemoveSrcFile(0); } /* test mode */ if (filenameIdx==1 && outFileName) operationResult = FIO_decompressFilename(outFileName, filenameTable[0], dictFileName); else