From 920bf21714f99cc20d3b8bcc28060136a390354a Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Fri, 4 Nov 2016 19:59:50 -0700 Subject: Fix LZ4_decompress_fast_continue() bug It specified the external dictionary location incorrectly. Add tests that expose this bug with both normal compilation and ASAN. --- lib/lz4.c | 2 +- tests/Makefile | 8 +++- tests/fasttest.c | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 tests/fasttest.c diff --git a/lib/lz4.c b/lib/lz4.c index 6db4c0b..740ae64 100644 --- a/lib/lz4.c +++ b/lib/lz4.c @@ -1366,7 +1366,7 @@ int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const ch lz4sd->prefixEnd += originalSize; } else { lz4sd->extDictSize = lz4sd->prefixSize; - lz4sd->externalDict = (BYTE*)dest - lz4sd->extDictSize; + lz4sd->externalDict = lz4sd->prefixEnd - lz4sd->extDictSize; result = LZ4_decompress_generic(source, dest, 0, originalSize, endOnOutputSize, full, 0, usingExtDict, (BYTE*)dest, lz4sd->externalDict, lz4sd->extDictSize); diff --git a/tests/Makefile b/tests/Makefile index 0dd8a59..2da6408 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -97,6 +97,9 @@ frametest: $(LZ4DIR)/lz4frame.o $(LZ4DIR)/lz4.o $(LZ4DIR)/lz4hc.o $(LZ4DIR)/xxha frametest32: $(LZ4DIR)/lz4frame.c $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c $(LZ4DIR)/xxhash.c frametest.c $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) +fasttest: $(LZ4DIR)/lz4.o fasttest.c + $(CC) $(FLAGS) $^ -o $@$(EXT) + datagen : $(PRGDIR)/datagen.c datagencli.c $(CC) $(FLAGS) -I$(PRGDIR) $^ -o $@$(EXT) @@ -119,7 +122,7 @@ versionsTest: #FreeBSD targets ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD)) -test: test-lz4 test-lz4c test-frametest test-fullbench test-fuzzer test-mem +test: test-lz4 test-lz4c test-fasttest test-frametest test-fullbench test-fuzzer test-mem test32: test-lz4c32 test-frametest32 test-fullbench32 test-fuzzer32 test-mem32 @@ -267,6 +270,9 @@ test-frametest: frametest test-frametest32: frametest32 ./frametest32 $(FUZZER_TIME) +test-fasttest: fasttest + ./fasttest + test-mem: lz4 datagen fuzzer frametest fullbench @echo "\n ---- valgrind tests : memory analyzer ----" valgrind --leak-check=yes --error-exitcode=1 ./datagen -g50M > $(VOID) diff --git a/tests/fasttest.c b/tests/fasttest.c new file mode 100644 index 0000000..a405542 --- /dev/null +++ b/tests/fasttest.c @@ -0,0 +1,138 @@ +/************************************** + * Compiler Options + **************************************/ +#ifdef _MSC_VER /* Visual Studio */ +# define _CRT_SECURE_NO_WARNINGS // for MSVC +# define snprintf sprintf_s +#endif +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-braces" /* GCC bug 53119 : doesn't accept { 0 } as initializer (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119) */ +#endif + + +/************************************** + * Includes + **************************************/ +#include +#include +#include +#include +#include "lz4.h" + + +/* Returns non-zero on failure. */ +int test_compress(const char *input, int inSize, char *output, int outSize) +{ + LZ4_stream_t lz4Stream_body = { 0 }; + LZ4_stream_t* lz4Stream = &lz4Stream_body; + + int inOffset = 0; + int outOffset = 0; + + if (inSize & 3) return -1; + + while (inOffset < inSize) { + const int length = inSize >> 2; + if (inSize > 1024) return -2; + if (outSize - (outOffset + 8) < LZ4_compressBound(length)) return -3; + { + const int outBytes = LZ4_compress_continue( + lz4Stream, input + inOffset, output + outOffset + 8, length); + if(outBytes <= 0) return -4; + memcpy(output + outOffset, &length, 4); /* input length */ + memcpy(output + outOffset + 4, &outBytes, 4); /* output length */ + inOffset += length; + outOffset += outBytes + 8; + } + } + if (outOffset + 8 > outSize) return -5; + memset(output + outOffset, 0, 4); + memset(output + outOffset + 4, 0, 4); + return 0; +} + +void swap(void **a, void **b) { + void *tmp = *a; + *a = *b; + *b = tmp; +} + +/* Returns non-zero on failure. Not a safe function. */ +int test_decompress(const char *uncompressed, const char *compressed) +{ + char outBufferA[1024]; + char spacing; /* So prefixEnd != dest */ + char outBufferB[1024]; + char *output = outBufferA; + char *lastOutput = outBufferB; + LZ4_streamDecode_t lz4StreamDecode_body = { 0 }; + LZ4_streamDecode_t* lz4StreamDecode = &lz4StreamDecode_body; + int offset = 0; + int unOffset = 0; + int lastBytes = 0; + + (void)spacing; + + for(;;) { + int32_t bytes; + int32_t unBytes; + /* Read uncompressed size and compressed size */ + memcpy(&unBytes, compressed + offset, 4); + memcpy(&bytes, compressed + offset + 4, 4); + offset += 8; + /* Check if we reached end of stream or error */ + if(bytes == 0 && unBytes == 0) return 0; + if(bytes <= 0 || unBytes <= 0 || unBytes > 1024) return 1; + + /* Put the last output in the dictionary */ + LZ4_setStreamDecode(lz4StreamDecode, lastOutput, lastBytes); + /* Decompress */ + bytes = LZ4_decompress_fast_continue( + lz4StreamDecode, compressed + offset, output, unBytes); + if(bytes <= 0) return 2; + /* Check result */ + { + int r = memcmp(uncompressed + unOffset, output, unBytes); + if (r) return 3; + } + swap((void**)&output, (void**)&lastOutput); + offset += bytes; + unOffset += unBytes; + lastBytes = unBytes; + } +} + + +int main(int argc, char **argv) +{ + char input[] = + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello!" + "Hello Hello Hello Hello Hello Hello Hello Hello"; + char output[LZ4_COMPRESSBOUND(4096)]; + int r; + + (void)argc; + (void)argv; + + if ((r = test_compress(input, sizeof(input), output, sizeof(output)))) { + return r; + } + if ((r = test_decompress(input, output))) { + return r; + } + return 0; +} -- cgit v0.12 From ef9d1b2d41a2e9fd588c394161bc3dfce83035c7 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 7 Nov 2016 12:13:12 +0100 Subject: fixed --test --- programs/lz4cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/lz4cli.c b/programs/lz4cli.c index e49bbcb..9625640 100644 --- a/programs/lz4cli.c +++ b/programs/lz4cli.c @@ -326,7 +326,7 @@ int main(int argc, const char** argv) if ((!strcmp(argument, "--decompress")) || (!strcmp(argument, "--uncompress"))) { decode = 1; continue; } if (!strcmp(argument, "--multiple")) { multiple_inputs = 1; if (inFileNames==NULL) inFileNames = (const char**)malloc(argc * sizeof(char*)); continue; } - if (!strcmp(argument, "--test")) { decode = 1; LZ4IO_setOverwrite(1); output_filename=nulmark; continue; } + if (!strcmp(argument, "--test")) { decode = 1; LZ4IO_setTestMode(1); output_filename=nulmark; continue; } if (!strcmp(argument, "--force")) { LZ4IO_setOverwrite(1); continue; } if (!strcmp(argument, "--no-force")) { LZ4IO_setOverwrite(0); continue; } if ((!strcmp(argument, "--stdout")) -- cgit v0.12 From 1581567299d150504eae3e08c44dcdfec78008e6 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 7 Nov 2016 12:13:35 +0100 Subject: util.h requires CharacterSet=MultiByte --- visual/VS2010/lz4/lz4.vcxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/visual/VS2010/lz4/lz4.vcxproj b/visual/VS2010/lz4/lz4.vcxproj index 7513d8c..ee53f8b 100644 --- a/visual/VS2010/lz4/lz4.vcxproj +++ b/visual/VS2010/lz4/lz4.vcxproj @@ -28,24 +28,24 @@ Application true - Unicode + MultiByte Application true - Unicode + MultiByte Application false true - Unicode + MultiByte Application false true - Unicode + MultiByte -- cgit v0.12 From 98be008479486f60b0a98289eee2f57c28650964 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 7 Nov 2016 12:41:14 +0100 Subject: Copy owner, file permissions and modification time --- programs/lz4io.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/programs/lz4io.c b/programs/lz4io.c index 2f64561..73ca27e 100644 --- a/programs/lz4io.c +++ b/programs/lz4io.c @@ -33,14 +33,7 @@ /************************************** * Compiler Options **************************************/ -#ifdef _MSC_VER /* Visual Studio */ -# define _CRT_SECURE_NO_WARNINGS -# define _CRT_SECURE_NO_DEPRECATE /* VS2005 */ -# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ -#endif - #define _LARGE_FILES /* Large file support on 32-bits AIX */ -#define _FILE_OFFSET_BITS 64 /* Large file support on 32-bits unix */ #if defined(__MINGW32__) && !defined(_POSIX_SOURCE) # define _POSIX_SOURCE 1 /* disable %llu warnings with MinGW on Windows */ @@ -49,6 +42,7 @@ /***************************** * Includes *****************************/ +#include "util.h" /* Compiler options, UTIL_getFileStat */ #include /* fprintf, fopen, fread, stdin, stdout, fflush, getchar */ #include /* malloc, free */ #include /* strcmp, strlen */ @@ -464,12 +458,14 @@ static int LZ4IO_compressFilename_extRess(cRess_t ress, const char* srcFileName, size_t readSize; LZ4F_compressionContext_t ctx = ress.ctx; /* just a pointer */ LZ4F_preferences_t prefs; - + stat_t statbuf; + int stat_result = 0; /* Init */ memset(&prefs, 0, sizeof(prefs)); /* File check */ + if (strcmp (srcFileName, stdinmark) && UTIL_getFileStat(srcFileName, &statbuf)) stat_result = 1; if (LZ4IO_getFiles(srcFileName, dstFileName, &srcFile, &dstFile)) return 1; /* Set compression parameters */ @@ -547,6 +543,9 @@ static int LZ4IO_compressFilename_extRess(cRess_t ress, const char* srcFileName, fclose (srcFile); fclose (dstFile); + /* Copy owner, file permissions and modification time */ + if (strcmp (dstFileName, stdoutmark) && stat_result) UTIL_setFileStat(dstFileName, &statbuf); + /* Final Status */ DISPLAYLEVEL(2, "\r%79s\r", ""); DISPLAYLEVEL(2, "Compressed %llu bytes into %llu bytes ==> %.2f%%\n", -- cgit v0.12 From 58ead8dd27681a8203ca94e3c83bdd00ec434f41 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 7 Nov 2016 13:00:08 +0100 Subject: fixed appveyor.yml --- appveyor.yml | 10 +++++----- lib/lz4frame.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index e941a7e..b51a7ad 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,13 +14,13 @@ environment: CONFIGURATION: "Release" PLATFORM: "Win32" - COMPILER: "gcc" - MAKE_PARAMS: "-C programs lz4 fullbench" + MAKE_PARAMS: "make -C programs lz4 && make -C tests fullbench" PLATFORM: "mingw64" - COMPILER: "gcc" - MAKE_PARAMS: "-C programs lz4 fullbench" + MAKE_PARAMS: "make -C programs lz4 && make -C tests fullbench" PLATFORM: "mingw32" - COMPILER: "gcc" - MAKE_PARAMS: '-C programs lz4 fullbench CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion"' + MAKE_PARAMS: 'make -C programs lz4 CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" && make -C tests fullbench CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion"' PLATFORM: "clang" install: @@ -48,8 +48,8 @@ build_script: echo ----- && make -v && echo ----- && - ECHO make -%MAKE_PARAMS%- && - make %MAKE_PARAMS% + ECHO -%MAKE_PARAMS%- && + %MAKE_PARAMS% ) ELSE ( ECHO *** && ECHO *** Building Visual Studio 2010 %PLATFORM%\%CONFIGURATION% && diff --git a/lib/lz4frame.h b/lib/lz4frame.h index 63d61ad..6b6e320 100644 --- a/lib/lz4frame.h +++ b/lib/lz4frame.h @@ -66,7 +66,7 @@ extern "C" { #endif #if defined(_MSC_VER) -# define LZ4F_DEPRECATE(x) __declspec(deprecated) x +# define LZ4F_DEPRECATE(x) x /* __declspec(deprecated) x - only works with C++ */ #elif defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 6)) # define LZ4F_DEPRECATE(x) x __attribute__((deprecated)) #else -- cgit v0.12 From 434d1230e0cf15214d32cfd14c50386548155e49 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 7 Nov 2016 13:43:25 +0100 Subject: fixed appveyor.yml (2) --- appveyor.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b51a7ad..51f0d07 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,13 +14,10 @@ environment: CONFIGURATION: "Release" PLATFORM: "Win32" - COMPILER: "gcc" - MAKE_PARAMS: "make -C programs lz4 && make -C tests fullbench" PLATFORM: "mingw64" - COMPILER: "gcc" - MAKE_PARAMS: "make -C programs lz4 && make -C tests fullbench" PLATFORM: "mingw32" - COMPILER: "gcc" - MAKE_PARAMS: 'make -C programs lz4 CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" && make -C tests fullbench CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion"' PLATFORM: "clang" install: @@ -48,9 +45,13 @@ build_script: echo ----- && make -v && echo ----- && - ECHO -%MAKE_PARAMS%- && - %MAKE_PARAMS% - ) ELSE ( + if not [%PLATFORM%]==[clang] ( + make -C programs lz4 && make -C tests fullbench" + ) ELSE ( + sh -c CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" make -C programs lz4 && make -C tests fullbench + ) + ) + - if [%COMPILER%]==[visual] ( ECHO *** && ECHO *** Building Visual Studio 2010 %PLATFORM%\%CONFIGURATION% && ECHO *** && -- cgit v0.12 From 90d4401fe0dbc6888ddfe499a0355cbb7a3dbac1 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 7 Nov 2016 13:47:48 +0100 Subject: fixed appveyor.yml (3) --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 51f0d07..c4b2e8d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -46,7 +46,7 @@ build_script: make -v && echo ----- && if not [%PLATFORM%]==[clang] ( - make -C programs lz4 && make -C tests fullbench" + make -C programs lz4 && make -C tests fullbench ) ELSE ( sh -c CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" make -C programs lz4 && make -C tests fullbench ) -- cgit v0.12 From 4b29af350c82a67a82736b08a8be95f61b0f38cc Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 7 Nov 2016 14:00:30 +0100 Subject: TreatWarningAsError=true only for debug --- appveyor.yml | 4 +++- visual/VS2010/datagen/datagen.vcxproj | 4 ++-- visual/VS2010/frametest/frametest.vcxproj | 4 ++-- visual/VS2010/fullbench/fullbench.vcxproj | 4 ++-- visual/VS2010/fuzzer/fuzzer.vcxproj | 4 ++-- visual/VS2010/liblz4/liblz4.vcxproj | 4 ++-- visual/VS2010/lz4/lz4.vcxproj | 8 ++++---- 7 files changed, 17 insertions(+), 15 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c4b2e8d..1e95ebb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -48,7 +48,8 @@ build_script: if not [%PLATFORM%]==[clang] ( make -C programs lz4 && make -C tests fullbench ) ELSE ( - sh -c CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" make -C programs lz4 && make -C tests fullbench + make -C programs lz4 CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" && + make -C tests fullbench CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" ) ) - if [%COMPILER%]==[visual] ( @@ -83,5 +84,6 @@ test_script: lz4 -i1b10 lz4.exe && lz4 -i1b15 lz4.exe && echo lz4 tested && + CD ..\tests && fullbench.exe -i1 fullbench.exe ) diff --git a/visual/VS2010/datagen/datagen.vcxproj b/visual/VS2010/datagen/datagen.vcxproj index 4d7516e..587e457 100644 --- a/visual/VS2010/datagen/datagen.vcxproj +++ b/visual/VS2010/datagen/datagen.vcxproj @@ -121,7 +121,7 @@ true true WIN32;NDEBUG;_CONSOLE;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true + false false @@ -140,7 +140,7 @@ true true WIN32;NDEBUG;_CONSOLE;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true + false true /analyze:stacksize295252 %(AdditionalOptions) diff --git a/visual/VS2010/frametest/frametest.vcxproj b/visual/VS2010/frametest/frametest.vcxproj index 5def90e..7ac7e33 100644 --- a/visual/VS2010/frametest/frametest.vcxproj +++ b/visual/VS2010/frametest/frametest.vcxproj @@ -121,7 +121,7 @@ true true WIN32;NDEBUG;_CONSOLE;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true + false false @@ -140,7 +140,7 @@ true true WIN32;NDEBUG;_CONSOLE;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true + false true /analyze:stacksize295252 %(AdditionalOptions) diff --git a/visual/VS2010/fullbench/fullbench.vcxproj b/visual/VS2010/fullbench/fullbench.vcxproj index 3d858a3..6e2488c 100644 --- a/visual/VS2010/fullbench/fullbench.vcxproj +++ b/visual/VS2010/fullbench/fullbench.vcxproj @@ -121,7 +121,7 @@ true true WIN32;NDEBUG;_CONSOLE;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true + false false @@ -140,7 +140,7 @@ true true WIN32;NDEBUG;_CONSOLE;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true + false true /analyze:stacksize295252 %(AdditionalOptions) diff --git a/visual/VS2010/fuzzer/fuzzer.vcxproj b/visual/VS2010/fuzzer/fuzzer.vcxproj index 2b2d58d..8469c7b 100644 --- a/visual/VS2010/fuzzer/fuzzer.vcxproj +++ b/visual/VS2010/fuzzer/fuzzer.vcxproj @@ -121,7 +121,7 @@ true true WIN32;NDEBUG;_CONSOLE;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true + false false @@ -140,7 +140,7 @@ true true WIN32;NDEBUG;_CONSOLE;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true + false true /analyze:stacksize295252 %(AdditionalOptions) diff --git a/visual/VS2010/liblz4/liblz4.vcxproj b/visual/VS2010/liblz4/liblz4.vcxproj index cbc2173..cbe93bb 100644 --- a/visual/VS2010/liblz4/liblz4.vcxproj +++ b/visual/VS2010/liblz4/liblz4.vcxproj @@ -119,7 +119,7 @@ true true WIN32;NDEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true + false false @@ -137,7 +137,7 @@ true true WIN32;NDEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true + false true /analyze:stacksize295252 %(AdditionalOptions) diff --git a/visual/VS2010/lz4/lz4.vcxproj b/visual/VS2010/lz4/lz4.vcxproj index ee53f8b..4684043 100644 --- a/visual/VS2010/lz4/lz4.vcxproj +++ b/visual/VS2010/lz4/lz4.vcxproj @@ -1,4 +1,4 @@ - + @@ -121,7 +121,7 @@ true true WIN32;NDEBUG;_CONSOLE;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true + false false @@ -140,7 +140,7 @@ true true WIN32;NDEBUG;_CONSOLE;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true + false true /analyze:stacksize295252 %(AdditionalOptions) @@ -172,4 +172,4 @@ - + \ No newline at end of file -- cgit v0.12 From 7a98db266bce656ee64bd3cfedf796921c154f90 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 7 Nov 2016 14:04:43 +0100 Subject: added datagen.c to lz4.vcxproj --- visual/VS2010/lz4/lz4.vcxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/visual/VS2010/lz4/lz4.vcxproj b/visual/VS2010/lz4/lz4.vcxproj index 4684043..d12ae65 100644 --- a/visual/VS2010/lz4/lz4.vcxproj +++ b/visual/VS2010/lz4/lz4.vcxproj @@ -157,6 +157,7 @@ + @@ -165,6 +166,7 @@ + -- cgit v0.12 From d61bb74f2044fed546de21f5b1e39737d79b8e48 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 7 Nov 2016 14:14:42 +0100 Subject: updated declaration of LZ4F_freeDecompressionContext --- appveyor.yml | 2 +- lib/lz4frame.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 1e95ebb..85d8ea2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -52,6 +52,7 @@ build_script: make -C tests fullbench CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion" ) ) + - if [%COMPILER%]==[gcc] (COPY tests\fullbench.exe programs\) - if [%COMPILER%]==[visual] ( ECHO *** && ECHO *** Building Visual Studio 2010 %PLATFORM%\%CONFIGURATION% && @@ -84,6 +85,5 @@ test_script: lz4 -i1b10 lz4.exe && lz4 -i1b15 lz4.exe && echo lz4 tested && - CD ..\tests && fullbench.exe -i1 fullbench.exe ) diff --git a/lib/lz4frame.h b/lib/lz4frame.h index 6b6e320..43bc23c 100644 --- a/lib/lz4frame.h +++ b/lib/lz4frame.h @@ -274,7 +274,7 @@ typedef struct { * That is, it should be == 0 if decompression has been completed fully and correctly. */ LZ4FLIB_API LZ4F_errorCode_t LZ4F_createDecompressionContext(LZ4F_dctx** dctxPtr, unsigned version); -LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeDecompressionContext(LZ4F_dctx* dctx); +LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeDecompressionContext(LZ4F_dctx* const dctx); /*====== Decompression ======*/ -- cgit v0.12 From ef54f9f9dd5d69ab69a085f25adaf4ce4533fe5c Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 7 Nov 2016 14:50:58 +0100 Subject: added --rm option --- programs/lz4cli.c | 6 ++++-- programs/lz4io.c | 48 ++++++++++++++++++++++-------------------------- programs/lz4io.h | 2 ++ 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/programs/lz4cli.c b/programs/lz4cli.c index 9625640..f091d3a 100644 --- a/programs/lz4cli.c +++ b/programs/lz4cli.c @@ -149,6 +149,7 @@ static int usage(void) DISPLAY( " -d : decompression (default for %s extension)\n", LZ4_EXTENSION); DISPLAY( " -z : force compression\n"); DISPLAY( " -f : overwrite output without prompting \n"); + DISPLAY( "--rm : remove source file(s) after successful de/compression \n"); DISPLAY( " -h/-H : display help/long help and exit\n"); return 0; } @@ -340,7 +341,8 @@ int main(int argc, const char** argv) if (!strcmp(argument, "--verbose")) { displayLevel=4; continue; } if (!strcmp(argument, "--quiet")) { if (displayLevel) displayLevel--; continue; } if (!strcmp(argument, "--version")) { DISPLAY(WELCOME_MESSAGE); return 0; } - if (!strcmp(argument, "--keep")) { continue; } /* keep source file (default anyway; just for xz/lzma compatibility) */ + if (!strcmp(argument, "--keep")) { LZ4IO_setRemoveSrcFile(0); continue; } /* keep source file (default anyway; just for xz/lzma compatibility) */ + if (!strcmp(argument, "--rm")) { LZ4IO_setRemoveSrcFile(1); continue; } /* Short commands (note : aggregated short commands are allowed) */ if (argument[0]=='-') { @@ -406,7 +408,7 @@ int main(int argc, const char** argv) case 'q': if (displayLevel) displayLevel--; break; /* keep source file (default anyway, so useless) (for xz/lzma compatibility) */ - case 'k': break; + case 'k': LZ4IO_setRemoveSrcFile(0); break; /* Modify Block Properties */ case 'B': diff --git a/programs/lz4io.c b/programs/lz4io.c index 73ca27e..02f4c2b 100644 --- a/programs/lz4io.c +++ b/programs/lz4io.c @@ -78,10 +78,6 @@ # define SET_SPARSE_FILE_MODE(file) #endif -#if !defined(S_ISREG) -# define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) -#endif - /***************************** * Constants @@ -236,19 +232,9 @@ int LZ4IO_setContentSize(int enable) return g_contentSizeFlag; } -static unsigned long long LZ4IO_GetFileSize(const char* infilename) -{ - int r; -#if defined(_MSC_VER) - struct _stat64 statbuf; - r = _stat64(infilename, &statbuf); -#else - struct stat statbuf; - r = stat(infilename, &statbuf); -#endif - if (r || !S_ISREG(statbuf.st_mode)) return 0; /* failure, or is not a regular file */ - return (unsigned long long)statbuf.st_size; -} +static U32 g_removeSrcFile = 0; +void LZ4IO_setRemoveSrcFile(unsigned flag) { g_removeSrcFile = (flag>0); } + /* ************************************************************************ ** @@ -458,14 +444,11 @@ static int LZ4IO_compressFilename_extRess(cRess_t ress, const char* srcFileName, size_t readSize; LZ4F_compressionContext_t ctx = ress.ctx; /* just a pointer */ LZ4F_preferences_t prefs; - stat_t statbuf; - int stat_result = 0; /* Init */ memset(&prefs, 0, sizeof(prefs)); /* File check */ - if (strcmp (srcFileName, stdinmark) && UTIL_getFileStat(srcFileName, &statbuf)) stat_result = 1; if (LZ4IO_getFiles(srcFileName, dstFileName, &srcFile, &dstFile)) return 1; /* Set compression parameters */ @@ -475,7 +458,7 @@ static int LZ4IO_compressFilename_extRess(cRess_t ress, const char* srcFileName, prefs.frameInfo.blockSizeID = (LZ4F_blockSizeID_t)g_blockSizeId; prefs.frameInfo.contentChecksumFlag = (LZ4F_contentChecksum_t)g_streamChecksum; if (g_contentSizeFlag) { - unsigned long long const fileSize = LZ4IO_GetFileSize(srcFileName); + U64 const fileSize = UTIL_getFileSize(srcFileName); prefs.frameInfo.contentSize = fileSize; /* == 0 if input == stdin */ if (fileSize==0) DISPLAYLEVEL(3, "Warning : cannot determine input content size \n"); @@ -544,7 +527,12 @@ static int LZ4IO_compressFilename_extRess(cRess_t ress, const char* srcFileName, fclose (dstFile); /* Copy owner, file permissions and modification time */ - if (strcmp (dstFileName, stdoutmark) && stat_result) UTIL_setFileStat(dstFileName, &statbuf); + { stat_t statbuf; + if (strcmp (srcFileName, stdinmark) && strcmp (dstFileName, stdoutmark) && UTIL_getFileStat(srcFileName, &statbuf)) + UTIL_setFileStat(dstFileName, &statbuf); + } + + if (g_removeSrcFile) { if (remove(srcFileName)) EXM_THROW(39, "Remove error : %s: %s", srcFileName, strerror(errno)); } /* remove source file : --rm */ /* Final Status */ DISPLAYLEVEL(2, "\r%79s\r", ""); @@ -945,14 +933,22 @@ static int LZ4IO_decompressFile_extRess(dRess_t ress, const char* input_filename filesize += decodedSize; } while (decodedSize != ENDOFSTREAM); - /* Final Status */ - DISPLAYLEVEL(2, "\r%79s\r", ""); - DISPLAYLEVEL(2, "Successfully decoded %llu bytes \n", filesize); - /* Close */ fclose(finput); fclose(foutput); + /* Copy owner, file permissions and modification time */ + { stat_t statbuf; + if (strcmp (input_filename, stdinmark) && strcmp (output_filename, stdoutmark) && UTIL_getFileStat(input_filename, &statbuf)) + UTIL_setFileStat(output_filename, &statbuf); + } + + if (g_removeSrcFile) { if (remove(input_filename)) EXM_THROW(45, "Remove error : %s: %s", input_filename, strerror(errno)); } /* remove source file : --rm */ + + /* Final Status */ + DISPLAYLEVEL(2, "\r%79s\r", ""); + DISPLAYLEVEL(2, "Successfully decoded %llu bytes \n", filesize); + return 0; } diff --git a/programs/lz4io.h b/programs/lz4io.h index bf076ee..45ae78d 100644 --- a/programs/lz4io.h +++ b/programs/lz4io.h @@ -89,3 +89,5 @@ int LZ4IO_setSparseFile(int enable); /* Default setting : 0 (disabled) */ int LZ4IO_setContentSize(int enable); + +void LZ4IO_setRemoveSrcFile(unsigned flag); -- cgit v0.12 From 2fbd7a5120da09dd520034b98830b7230c3bf6e3 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 7 Nov 2016 16:15:22 +0100 Subject: updated travis.yml --- .travis.yml | 56 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index ef8732c..19b24eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,57 +4,57 @@ matrix: include: # OS X Mavericks - os: osx - env: Ubu="OS X Mavericks" PARAMS='-C tests test-lz4 CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion"' COMPILER=clang + env: Ubu="OS X Mavericks" CMD='-C tests test-lz4 CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion"' COMPILER=clang # Container-based 12.04 LTS Server Edition 64 bit (doesn't support 32-bit includes) - os: linux sudo: false - env: Ubu="12.04cont" PARAMS="install PREFIX=~/install_test_dir" COMPILER=cc + env: Ubu="12.04cont" CMD="make install PREFIX=~/install_test_dir" COMPILER=cc - os: linux sudo: false - env: Ubu="12.04cont" PARAMS="examples" COMPILER=cc + env: Ubu="12.04cont" CMD="make examples" COMPILER=cc - os: linux sudo: false - env: Ubu="12.04cont" PARAMS="cmake" COMPILER=cc + env: Ubu="12.04cont" CMD="make cmake" COMPILER=cc - os: linux sudo: false - env: Ubu="12.04cont" PARAMS=clangtest COMPILER=clang + env: Ubu="12.04cont" CMD='make clangtest' COMPILER=clang - os: linux sudo: false - env: Ubu="12.04cont" PARAMS=gpptest COMPILER=cc + env: Ubu="12.04cont" CMD='make gpptest' COMPILER=cc - os: linux sudo: false - env: Ubu="12.04cont" PARAMS='-C tests test-lz4' COMPILER=cc + env: Ubu="12.04cont" CMD='make -C tests test-lz4' COMPILER=cc - os: linux sudo: false - env: Ubu="12.04cont" PARAMS='-C tests test-lz4 MOREFLAGS="-std=c99"' COMPILER=cc + env: Ubu="12.04cont" CMD='make -C tests test-lz4 MOREFLAGS="-std=c99"' COMPILER=cc - os: linux sudo: false - env: Ubu="12.04cont" PARAMS='-C tests test-lz4c' COMPILER=cc + env: Ubu="12.04cont" CMD='make -C tests test-lz4c' COMPILER=cc - os: linux sudo: false - env: Ubu="12.04cont" PARAMS='-C tests test-fullbench' COMPILER=cc + env: Ubu="12.04cont" CMD='make -C tests test-fullbench' COMPILER=cc - os: linux sudo: false - env: Ubu="12.04cont" PARAMS='-C tests test-fuzzer' COMPILER=cc + env: Ubu="12.04cont" CMD='make -C tests test-fuzzer' COMPILER=cc - os: linux sudo: false - env: Ubu="12.04cont" PARAMS='-C tests test-frametest' COMPILER=cc + env: Ubu="12.04cont" CMD='make -C tests test-frametest' COMPILER=cc # 14.04 LTS Server Edition 64 bit - - env: Ubu="14.04" PARAMS=sanitize COMPILER=clang + - env: Ubu="14.04" CMD='make sanitize' COMPILER=clang dist: trusty sudo: required addons: apt: packages: - valgrind - - env: Ubu="14.04" PARAMS=staticAnalyze COMPILER=clang + - env: Ubu="14.04" CMD='make staticAnalyze' COMPILER=clang dist: trusty sudo: required addons: apt: packages: - clang - - env: Ubu="14.04" PARAMS=armtest COMPILER=arm-linux-gnueabi-gcc + - env: Ubu="14.04" CMD='make armtest' COMPILER=arm-linux-gnueabi-gcc dist: trusty sudo: required addons: @@ -63,7 +63,7 @@ matrix: - gcc-arm-linux-gnueabi - libc6-dev-armel-cross - linux-libc-dev-armel-cross - - env: Ubu="14.04" PARAMS=versionsTest COMPILER=cc + - env: Ubu="14.04" CMD='make versionsTest' COMPILER=cc dist: trusty sudo: required addons: @@ -72,10 +72,10 @@ matrix: - python3 - libc6-dev-i386 - gcc-multilib - - env: Ubu="14.04" PARAMS='-C tests test-lz4' COMPILER=cc + - env: Ubu="14.04" CMD='make -C tests test-lz4' COMPILER=cc dist: trusty sudo: required - - env: Ubu="14.04" PARAMS='-C tests test-lz4c32' COMPILER=cc + - env: Ubu="14.04" CMD='make -C tests test-lz4c32' COMPILER=cc dist: trusty sudo: required addons: @@ -83,7 +83,7 @@ matrix: packages: - libc6-dev-i386 - gcc-multilib - - env: Ubu="14.04" PARAMS='-C tests test-lz4 CC=gcc-5' COMPILER=gcc-5 + - env: Ubu="14.04" CMD='make -C tests test-lz4 CC=gcc-5' COMPILER=gcc-5 dist: trusty sudo: required addons: @@ -92,7 +92,7 @@ matrix: - ubuntu-toolchain-r-test packages: - gcc-5 - - env: Ubu="14.04" PARAMS='-C tests test-lz4c32 CC=gcc-5' COMPILER=gcc-5 + - env: Ubu="14.04" CMD='make -C tests test-lz4c32 CC=gcc-5' COMPILER=gcc-5 dist: trusty sudo: required addons: @@ -104,7 +104,7 @@ matrix: - gcc-multilib - gcc-5 - gcc-5-multilib - - env: Ubu="14.04" PARAMS='-C tests test-lz4 CC=gcc-6' COMPILER=gcc-6 + - env: Ubu="14.04" CMD='make -C tests test-lz4 CC=gcc-6' COMPILER=gcc-6 dist: trusty sudo: required addons: @@ -113,7 +113,7 @@ matrix: - ubuntu-toolchain-r-test packages: - gcc-6 - - env: Ubu="14.04" PARAMS='-C tests test-lz4 CC=clang-3.8' COMPILER=clang-3.8 + - env: Ubu="14.04" CMD='make -C tests test-lz4 CC=clang-3.8' COMPILER=clang-3.8 dist: trusty sudo: required addons: @@ -123,7 +123,7 @@ matrix: - llvm-toolchain-precise-3.8 packages: - clang-3.8 - - env: Ubu="14.04" PARAMS='-C tests test-fullbench32' COMPILER=cc + - env: Ubu="14.04" CMD='make -C tests test-fullbench32' COMPILER=cc dist: trusty sudo: required addons: @@ -131,7 +131,7 @@ matrix: packages: - libc6-dev-i386 - gcc-multilib - - env: Ubu="14.04" PARAMS='-C tests test-fuzzer32' COMPILER=cc + - env: Ubu="14.04" CMD='make -C tests test-fuzzer32' COMPILER=cc dist: trusty sudo: required addons: @@ -139,7 +139,7 @@ matrix: packages: - libc6-dev-i386 - gcc-multilib - - env: Ubu="14.04" PARAMS='-C tests test-frametest32' COMPILER=cc + - env: Ubu="14.04" CMD='make -C tests test-frametest32' COMPILER=cc dist: trusty sudo: required addons: @@ -147,7 +147,7 @@ matrix: packages: - libc6-dev-i386 - gcc-multilib - - env: Ubu="14.04" PARAMS='-C tests test-mem' COMPILER=cc + - env: Ubu="14.04" CMD='make -C tests test-mem' COMPILER=cc dist: trusty sudo: required addons: @@ -156,6 +156,6 @@ matrix: - valgrind script: - - echo PARAMS=$PARAMS + - echo CMD=$CMD - $COMPILER -v - - sh -c "make $PARAMS" + - sh -c "$CMD" -- cgit v0.12 From b6c407886f6c09125478c5b8b633a26e6e3dd9b8 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 7 Nov 2016 16:46:39 +0100 Subject: condensed travis.yml --- .travis.yml | 86 +++++-------------------------------------------------------- 1 file changed, 6 insertions(+), 80 deletions(-) diff --git a/.travis.yml b/.travis.yml index 19b24eb..27b4a1f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,55 +4,25 @@ matrix: include: # OS X Mavericks - os: osx - env: Ubu="OS X Mavericks" CMD='-C tests test-lz4 CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion"' COMPILER=clang + env: Ubu="OS X Mavericks" CMD='make -C tests test-lz4 CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion"' COMPILER=clang # Container-based 12.04 LTS Server Edition 64 bit (doesn't support 32-bit includes) - os: linux sudo: false - env: Ubu="12.04cont" CMD="make install PREFIX=~/install_test_dir" COMPILER=cc - - os: linux - sudo: false - env: Ubu="12.04cont" CMD="make examples" COMPILER=cc - - os: linux - sudo: false - env: Ubu="12.04cont" CMD="make cmake" COMPILER=cc + env: Ubu="12.04cont" CMD="make gpptest && make clean && make examples && make clean && make cmake && make clean && make travis-install" COMPILER=cc - os: linux sudo: false env: Ubu="12.04cont" CMD='make clangtest' COMPILER=clang - os: linux sudo: false - env: Ubu="12.04cont" CMD='make gpptest' COMPILER=cc - - os: linux - sudo: false - env: Ubu="12.04cont" CMD='make -C tests test-lz4' COMPILER=cc - - os: linux - sudo: false - env: Ubu="12.04cont" CMD='make -C tests test-lz4 MOREFLAGS="-std=c99"' COMPILER=cc - - os: linux - sudo: false - env: Ubu="12.04cont" CMD='make -C tests test-lz4c' COMPILER=cc - - os: linux - sudo: false - env: Ubu="12.04cont" CMD='make -C tests test-fullbench' COMPILER=cc - - os: linux - sudo: false - env: Ubu="12.04cont" CMD='make -C tests test-fuzzer' COMPILER=cc - - os: linux - sudo: false - env: Ubu="12.04cont" CMD='make -C tests test-frametest' COMPILER=cc + env: Ubu="12.04cont" CMD='make -C tests test-lz4 && make clean && make -C tests test-lz4 MOREFLAGS="-std=c99" && make clean && make -C tests test-lz4c test-fullbench test-fuzzer test-frametest' COMPILER=cc # 14.04 LTS Server Edition 64 bit - - env: Ubu="14.04" CMD='make sanitize' COMPILER=clang + - env: Ubu="14.04" CMD='make staticAnalyze sanitize' COMPILER=clang dist: trusty sudo: required addons: apt: packages: - valgrind - - env: Ubu="14.04" CMD='make staticAnalyze' COMPILER=clang - dist: trusty - sudo: required - addons: - apt: - packages: - clang - env: Ubu="14.04" CMD='make armtest' COMPILER=arm-linux-gnueabi-gcc dist: trusty @@ -63,7 +33,7 @@ matrix: - gcc-arm-linux-gnueabi - libc6-dev-armel-cross - linux-libc-dev-armel-cross - - env: Ubu="14.04" CMD='make versionsTest' COMPILER=cc + - env: Ubu="14.04" CMD='make -C tests test-lz4 && make clean && make -C tests test-lz4c32 test-fullbench32 test-fuzzer32 test-frametest32 versionsTest' COMPILER=cc dist: trusty sudo: required addons: @@ -72,27 +42,7 @@ matrix: - python3 - libc6-dev-i386 - gcc-multilib - - env: Ubu="14.04" CMD='make -C tests test-lz4' COMPILER=cc - dist: trusty - sudo: required - - env: Ubu="14.04" CMD='make -C tests test-lz4c32' COMPILER=cc - dist: trusty - sudo: required - addons: - apt: - packages: - - libc6-dev-i386 - - gcc-multilib - - env: Ubu="14.04" CMD='make -C tests test-lz4 CC=gcc-5' COMPILER=gcc-5 - dist: trusty - sudo: required - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - gcc-5 - - env: Ubu="14.04" CMD='make -C tests test-lz4c32 CC=gcc-5' COMPILER=gcc-5 + - env: Ubu="14.04" CMD='make -C tests test-lz4 test-lz4c32 CC=gcc-5' COMPILER=gcc-5 dist: trusty sudo: required addons: @@ -123,30 +73,6 @@ matrix: - llvm-toolchain-precise-3.8 packages: - clang-3.8 - - env: Ubu="14.04" CMD='make -C tests test-fullbench32' COMPILER=cc - dist: trusty - sudo: required - addons: - apt: - packages: - - libc6-dev-i386 - - gcc-multilib - - env: Ubu="14.04" CMD='make -C tests test-fuzzer32' COMPILER=cc - dist: trusty - sudo: required - addons: - apt: - packages: - - libc6-dev-i386 - - gcc-multilib - - env: Ubu="14.04" CMD='make -C tests test-frametest32' COMPILER=cc - dist: trusty - sudo: required - addons: - apt: - packages: - - libc6-dev-i386 - - gcc-multilib - env: Ubu="14.04" CMD='make -C tests test-mem' COMPILER=cc dist: trusty sudo: required -- cgit v0.12 From 7fbb163f3fe39920f3c0ba96a74e9af26727f48c Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 7 Nov 2016 17:43:37 +0100 Subject: added "make c_standards" --- .travis.yml | 40 +++++++++++++++++++++------------------- Makefile | 24 +++++++++++++++++------- tests/Makefile | 4 ++-- 3 files changed, 40 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index 27b4a1f..4a18b17 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,19 +4,21 @@ matrix: include: # OS X Mavericks - os: osx - env: Ubu="OS X Mavericks" CMD='make -C tests test-lz4 CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion"' COMPILER=clang + env: Ubu=OS_X_Mavericks Cmd='make -C tests test-lz4 CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion"' COMPILER=clang + # Container-based 12.04 LTS Server Edition 64 bit (doesn't support 32-bit includes) - os: linux sudo: false - env: Ubu="12.04cont" CMD="make gpptest && make clean && make examples && make clean && make cmake && make clean && make travis-install" COMPILER=cc + env: Ubu=12.04cont Cmd="make gpptest && make clean && make examples && make clean && make cmake && make clean && make travis-install" COMPILER=cc - os: linux sudo: false - env: Ubu="12.04cont" CMD='make clangtest' COMPILER=clang + env: Ubu=12.04cont Cmd='make test && make clean' COMPILER=cc - os: linux sudo: false - env: Ubu="12.04cont" CMD='make -C tests test-lz4 && make clean && make -C tests test-lz4 MOREFLAGS="-std=c99" && make clean && make -C tests test-lz4c test-fullbench test-fuzzer test-frametest' COMPILER=cc + env: Ubu=12.04cont Cmd='make clangtest' COMPILER=clang + # 14.04 LTS Server Edition 64 bit - - env: Ubu="14.04" CMD='make staticAnalyze sanitize' COMPILER=clang + - env: Ubu=14.04 Cmd='make staticAnalyze sanitize' COMPILER=clang dist: trusty sudo: required addons: @@ -24,7 +26,7 @@ matrix: packages: - valgrind - clang - - env: Ubu="14.04" CMD='make armtest' COMPILER=arm-linux-gnueabi-gcc + - env: Ubu=14.04 Cmd='make armtest' COMPILER=arm-linux-gnueabi-gcc dist: trusty sudo: required addons: @@ -33,7 +35,14 @@ matrix: - gcc-arm-linux-gnueabi - libc6-dev-armel-cross - linux-libc-dev-armel-cross - - env: Ubu="14.04" CMD='make -C tests test-lz4 && make clean && make -C tests test-lz4c32 test-fullbench32 test-fuzzer32 test-frametest32 versionsTest' COMPILER=cc + - env: Ubu=14.04 Cmd='make c_standards && make -C tests test-lz4 test-mem' COMPILER=cc + dist: trusty + sudo: required + addons: + apt: + packages: + - valgrind + - env: Ubu=14.04 Cmd='make -C tests test32 versionsTest' COMPILER=cc dist: trusty sudo: required addons: @@ -42,7 +51,7 @@ matrix: - python3 - libc6-dev-i386 - gcc-multilib - - env: Ubu="14.04" CMD='make -C tests test-lz4 test-lz4c32 CC=gcc-5' COMPILER=gcc-5 + - env: Ubu=14.04 Cmd='make -C tests test-lz4 test-lz4c32 CC=gcc-5' COMPILER=gcc-5 dist: trusty sudo: required addons: @@ -54,7 +63,7 @@ matrix: - gcc-multilib - gcc-5 - gcc-5-multilib - - env: Ubu="14.04" CMD='make -C tests test-lz4 CC=gcc-6' COMPILER=gcc-6 + - env: Ubu=14.04 Cmd='make c_standards && make -C tests test-lz4 CC=gcc-6' COMPILER=gcc-6 dist: trusty sudo: required addons: @@ -63,7 +72,7 @@ matrix: - ubuntu-toolchain-r-test packages: - gcc-6 - - env: Ubu="14.04" CMD='make -C tests test-lz4 CC=clang-3.8' COMPILER=clang-3.8 + - env: Ubu=14.04 Cmd='make -C tests test-lz4 CC=clang-3.8' COMPILER=clang-3.8 dist: trusty sudo: required addons: @@ -73,15 +82,8 @@ matrix: - llvm-toolchain-precise-3.8 packages: - clang-3.8 - - env: Ubu="14.04" CMD='make -C tests test-mem' COMPILER=cc - dist: trusty - sudo: required - addons: - apt: - packages: - - valgrind script: - - echo CMD=$CMD + - echo Cmd=$Cmd - $COMPILER -v - - sh -c "$CMD" + - sh -c "$Cmd" diff --git a/Makefile b/Makefile index e98aafd..aeb2f4b 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,7 @@ uninstall: @$(MAKE) -C $(PRGDIR) $@ travis-install: - sudo $(MAKE) install + $(MAKE) install PREFIX=~/install_test_dir test: $(MAKE) -C $(TESTDIR) test @@ -96,19 +96,29 @@ cmake: gpptest: clean $(MAKE) all CC=g++ CFLAGS="-O3 -I../lib -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror" +c_standards: clean + $(MAKE) all CFLAGS="-std=gnu90" + $(MAKE) clean + $(MAKE) all CFLAGS="-std=c99" + $(MAKE) clean + $(MAKE) all CFLAGS="-std=gnu99" + $(MAKE) clean + $(MAKE) all CFLAGS="-std=c11" + $(MAKE) clean + clangtest: clean - CFLAGS="-O3 -Werror -Wconversion -Wno-sign-conversion" $(MAKE) all CC=clang + $(MAKE) all CC=clang CFLAGS="-O3 -Werror -Wconversion -Wno-sign-conversion" sanitize: clean - CFLAGS="-O3 -g -fsanitize=undefined" $(MAKE) test CC=clang FUZZER_TIME="-T1mn" NB_LOOPS=-i1 + $(MAKE) test CC=clang FUZZER_TIME="-T1mn" NB_LOOPS=-i1 CFLAGS="-O3 -g -fsanitize=undefined" staticAnalyze: clean - CFLAGS=-g scan-build --status-bugs -v $(MAKE) all + scan-build --status-bugs -v $(MAKE) all CFLAGS=-g armtest: clean - CFLAGS="-O3 -Werror" $(MAKE) -C $(LZ4DIR) all CC=arm-linux-gnueabi-gcc - CFLAGS="-O3 -Werror" $(MAKE) -C $(PRGDIR) bins CC=arm-linux-gnueabi-gcc - CFLAGS="-O3 -Werror" $(MAKE) -C $(TESTDIR) bins CC=arm-linux-gnueabi-gcc + $(MAKE) -C $(LZ4DIR) all CC=arm-linux-gnueabi-gcc CFLAGS="-O3 -Werror" + $(MAKE) -C $(PRGDIR) bins CC=arm-linux-gnueabi-gcc CFLAGS="-O3 -Werror" + $(MAKE) -C $(TESTDIR) bins CC=arm-linux-gnueabi-gcc CFLAGS="-O3 -Werror" versionsTest: clean $(MAKE) -C $(TESTDIR) $@ diff --git a/tests/Makefile b/tests/Makefile index 2da6408..d5aad60 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -122,9 +122,9 @@ versionsTest: #FreeBSD targets ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD)) -test: test-lz4 test-lz4c test-fasttest test-frametest test-fullbench test-fuzzer test-mem +test: test-lz4 test-lz4c test-fasttest test-frametest test-fullbench test-fuzzer -test32: test-lz4c32 test-frametest32 test-fullbench32 test-fuzzer32 test-mem32 +test32: test-lz4c32 test-frametest32 test-fullbench32 test-fuzzer32 test-all: test test32 -- cgit v0.12 From 9b3dcb325f13c4c37c25c114f0b5bca62e6e30de Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 7 Nov 2016 18:21:59 +0100 Subject: MOREFLAGS="-Werror" --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4a18b17..4d6bdc4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ matrix: env: Ubu=12.04cont Cmd="make gpptest && make clean && make examples && make clean && make cmake && make clean && make travis-install" COMPILER=cc - os: linux sudo: false - env: Ubu=12.04cont Cmd='make test && make clean' COMPILER=cc + env: Ubu=12.04cont Cmd='make test' COMPILER=cc - os: linux sudo: false env: Ubu=12.04cont Cmd='make clangtest' COMPILER=clang @@ -51,7 +51,7 @@ matrix: - python3 - libc6-dev-i386 - gcc-multilib - - env: Ubu=14.04 Cmd='make -C tests test-lz4 test-lz4c32 CC=gcc-5' COMPILER=gcc-5 + - env: Ubu=14.04 Cmd='make -C tests test-lz4 test-lz4c32 CC=gcc-5 MOREFLAGS="-Werror"' COMPILER=gcc-5 dist: trusty sudo: required addons: @@ -63,7 +63,7 @@ matrix: - gcc-multilib - gcc-5 - gcc-5-multilib - - env: Ubu=14.04 Cmd='make c_standards && make -C tests test-lz4 CC=gcc-6' COMPILER=gcc-6 + - env: Ubu=14.04 Cmd='make c_standards CC=gcc-6 && make -C tests test-lz4 CC=gcc-6 MOREFLAGS="-Werror"' COMPILER=gcc-6 dist: trusty sudo: required addons: -- cgit v0.12