summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-08-25 00:03:03 (GMT)
committerYann Collet <cyan@fb.com>2017-08-25 00:03:03 (GMT)
commit517dd95d92980cb709f8ad176ca17c2b7e79e709 (patch)
tree550fd7510844477028c02851bd095899b8a2ebd2
parent82ccdec2fb04316ae51ddf2666eecc397f2b1fd9 (diff)
downloadlz4-517dd95d92980cb709f8ad176ca17c2b7e79e709.zip
lz4-517dd95d92980cb709f8ad176ca17c2b7e79e709.tar.gz
lz4-517dd95d92980cb709f8ad176ca17c2b7e79e709.tar.bz2
removed fasttest
-rw-r--r--tests/Makefile10
-rw-r--r--tests/fasttest.c155
2 files changed, 2 insertions, 163 deletions
diff --git a/tests/Makefile b/tests/Makefile
index d2d05af..fc4b143 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -63,7 +63,7 @@ NB_LOOPS ?= -i1
default: all
-all: fullbench fuzzer frametest datagen fasttest
+all: fullbench fuzzer frametest datagen
all32: CFLAGS+=-m32
all32: all
@@ -94,9 +94,6 @@ fuzzer : $(LZ4DIR)/lz4.o $(LZ4DIR)/lz4hc.o $(LZ4DIR)/xxhash.o fuzzer.c
frametest: $(LZ4DIR)/lz4frame.o $(LZ4DIR)/lz4.o $(LZ4DIR)/lz4hc.o $(LZ4DIR)/xxhash.o frametest.c
$(CC) $(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)
@@ -133,7 +130,7 @@ DIFF:=gdiff
endif
-test: test-lz4 test-lz4c test-fasttest test-frametest test-fullbench test-fuzzer
+test: test-lz4 test-lz4c test-frametest test-fullbench test-fuzzer
test32: CFLAGS+=-m32
test32: test
@@ -355,9 +352,6 @@ test-frametest: frametest
test-frametest32: CFLAGS += -m32
test-frametest32: test-frametest
-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
deleted file mode 100644
index 07811f6..0000000
--- a/tests/fasttest.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- fasttest.c -
- Copyright (C) Yann Collet 2012-2017
-
- GPL v2 License
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
- You can contact the author at :
- - LZ4 homepage : http://www.lz4.org
- - LZ4 source repo : https://github.com/lz4/lz4
-*/
-
-/**************************************
- * 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 <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#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_fast_continue(
- lz4Stream, input + inOffset, output + outOffset + 8,
- length, outSize-outOffset, 1);
- 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;
-}
-
-/* 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 const r = memcmp(uncompressed + unOffset, output, unBytes);
- if (r) return 3;
- }
- { char* const tmp = output; output = lastOutput; lastOutput = tmp; }
- 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;
-}