mirror of
https://github.com/facebook/zstd.git
synced 2025-07-30 22:23:13 +03:00
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
# This Makefile presumes libzstd is installed, using `sudo make install`
|
# This Makefile presumes libzstd is installed, using `sudo make install`
|
||||||
|
|
||||||
LDFLAGS+= -lzstd
|
LDFLAGS += -lzstd
|
||||||
|
|
||||||
.PHONY: default all clean test
|
.PHONY: default all clean test
|
||||||
|
|
||||||
@ -52,16 +52,23 @@ clean:
|
|||||||
test: all
|
test: all
|
||||||
cp README.md tmp
|
cp README.md tmp
|
||||||
cp Makefile tmp2
|
cp Makefile tmp2
|
||||||
@echo starting simple compression
|
@echo -- Simple compression tests
|
||||||
./simple_compression tmp
|
./simple_compression tmp
|
||||||
./simple_decompression tmp.zst
|
./simple_decompression tmp.zst
|
||||||
./streaming_decompression tmp.zst > /dev/null
|
./streaming_decompression tmp.zst > /dev/null
|
||||||
@echo starting streaming compression
|
@echo -- Streaming compression tests
|
||||||
./streaming_compression tmp
|
./streaming_compression tmp
|
||||||
./streaming_decompression tmp.zst > /dev/null
|
./streaming_decompression tmp.zst > /dev/null
|
||||||
@echo starting multiple streaming compression
|
@echo -- Edge cases detection
|
||||||
|
! ./streaming_decompression tmp # invalid input, must fail
|
||||||
|
! ./simple_decompression tmp # invalid input, must fail
|
||||||
|
! ./simple_decompression tmp.zst # unknown input size, must fail
|
||||||
|
touch tmpNull # create 0-size file
|
||||||
|
./simple_compression tmpNull
|
||||||
|
./simple_decompression tmpNull.zst # 0-size frame : must work
|
||||||
|
@echo -- Multiple streaming tests
|
||||||
./multiple_streaming_compression *.c
|
./multiple_streaming_compression *.c
|
||||||
@echo starting dictionary compression
|
@echo -- Dictionary compression tests
|
||||||
./dictionary_compression tmp2 tmp README.md
|
./dictionary_compression tmp2 tmp README.md
|
||||||
./dictionary_decompression tmp2.zst tmp.zst README.md
|
./dictionary_decompression tmp2.zst tmp.zst README.md
|
||||||
$(RM) tmp* *.zst
|
$(RM) tmp* *.zst
|
||||||
|
@ -35,7 +35,7 @@ static FILE* fopen_orDie(const char *filename, const char *instruction)
|
|||||||
|
|
||||||
static void* malloc_orDie(size_t size)
|
static void* malloc_orDie(size_t size)
|
||||||
{
|
{
|
||||||
void* const buff = malloc(size);
|
void* const buff = malloc(size + !size); /* avoid allocating size of 0 : may return NULL (implementation dependent) */
|
||||||
if (buff) return buff;
|
if (buff) return buff;
|
||||||
/* error */
|
/* error */
|
||||||
fprintf(stderr, "malloc: %s \n", strerror(errno));
|
fprintf(stderr, "malloc: %s \n", strerror(errno));
|
||||||
|
Reference in New Issue
Block a user