Merge pull request #250 from terrelln/test-mode
Fix test mode and write to null
This commit is contained in:
commit
6d6a3e0fb5
@ -393,7 +393,7 @@ int main(int argc, const char** argv)
|
||||
case 'c': forceStdout=1; output_filename=stdoutmark; displayLevel=1; break;
|
||||
|
||||
/* Test integrity */
|
||||
case 't': decode=1; LZ4IO_setOverwrite(1); output_filename=nulmark; break;
|
||||
case 't': decode=1; LZ4IO_setTestMode(1); output_filename=nulmark; break;
|
||||
|
||||
/* Overwrite */
|
||||
case 'f': LZ4IO_setOverwrite(1); break;
|
||||
|
@ -136,6 +136,7 @@ static clock_t g_time = 0;
|
||||
* Local Parameters
|
||||
**************************************/
|
||||
static int g_overwrite = 1;
|
||||
static int g_testMode = 0;
|
||||
static int g_blockSizeId = LZ4IO_BLOCKSIZEID_DEFAULT;
|
||||
static int g_blockChecksum = 0;
|
||||
static int g_streamChecksum = 1;
|
||||
@ -184,6 +185,13 @@ int LZ4IO_setOverwrite(int yes)
|
||||
return g_overwrite;
|
||||
}
|
||||
|
||||
/* Default setting : testMode = 0; return : testMode (0/1) */
|
||||
int LZ4IO_setTestMode(int yes)
|
||||
{
|
||||
g_testMode = (yes!=0);
|
||||
return g_testMode;
|
||||
}
|
||||
|
||||
/* blockSizeID : valid values : 4-5-6-7 */
|
||||
int LZ4IO_setBlockSizeID(int bsid)
|
||||
{
|
||||
@ -283,7 +291,7 @@ static int LZ4IO_getFiles(const char* input_filename, const char* output_filenam
|
||||
} else {
|
||||
/* Check if destination file already exists */
|
||||
*pfoutput=0;
|
||||
if (output_filename != nulmark) *pfoutput = fopen( output_filename, "rb" );
|
||||
if (strcmp(output_filename, nulmark)) *pfoutput = fopen( output_filename, "rb" );
|
||||
if (*pfoutput!=0) {
|
||||
fclose(*pfoutput);
|
||||
if (!g_overwrite) {
|
||||
@ -908,7 +916,7 @@ static unsigned long long selectDecoder(dRess_t ress, FILE* finput, FILE* foutpu
|
||||
EXTENDED_FORMAT; /* macro extension for custom formats */
|
||||
default:
|
||||
if (nbCalls == 1) { /* just started */
|
||||
if (g_overwrite)
|
||||
if (!g_testMode && g_overwrite)
|
||||
return LZ4IO_passThrough(finput, foutput, MNstore);
|
||||
EXM_THROW(44,"Unrecognized header : file cannot be decoded"); /* Wrong magic number at the beginning of 1st stream */
|
||||
}
|
||||
|
@ -63,6 +63,10 @@ int LZ4IO_decompressMultipleFilenames(const char** inFileNamesTable, int ifntSiz
|
||||
return : overwrite mode (0/1) */
|
||||
int LZ4IO_setOverwrite(int yes);
|
||||
|
||||
/* Default setting : testMode = 0;
|
||||
return : testMode (0/1) */
|
||||
int LZ4IO_setTestMode(int yes);
|
||||
|
||||
/* blockSizeID : valid values : 4-5-6-7
|
||||
return : -1 if error, blockSize if OK */
|
||||
int LZ4IO_setBlockSizeID(int blockSizeID);
|
||||
|
@ -217,7 +217,10 @@ test-lz4-basic: lz4 datagen
|
||||
|
||||
test-lz4: lz4 datagen test-lz4-basic test-lz4-multiple test-lz4-sparse test-lz4-contentSize test-lz4-frame-concatenation
|
||||
@echo "\n ---- test pass-through ----"
|
||||
./datagen | $(PRGDIR)/lz4 -tf
|
||||
./datagen | $(PRGDIR)/lz4 -t && false || true
|
||||
./datagen | $(PRGDIR)/lz4 -tf && false || true
|
||||
./datagen | $(PRGDIR)/lz4 -d > $(VOID) && false || true
|
||||
./datagen | $(PRGDIR)/lz4 -df > $(VOID)
|
||||
|
||||
test-lz4c: lz4c datagen
|
||||
@echo "\n ---- test lz4c version ----"
|
||||
|
Loading…
Reference in New Issue
Block a user