127b27ec6Sopenharmony_ci# ########################################################################## 227b27ec6Sopenharmony_ci# LZ4 programs - Makefile 327b27ec6Sopenharmony_ci# Copyright (C) Yann Collet 2011-2020 427b27ec6Sopenharmony_ci# 527b27ec6Sopenharmony_ci# GPL v2 License 627b27ec6Sopenharmony_ci# 727b27ec6Sopenharmony_ci# This program is free software; you can redistribute it and/or modify 827b27ec6Sopenharmony_ci# it under the terms of the GNU General Public License as published by 927b27ec6Sopenharmony_ci# the Free Software Foundation; either version 2 of the License, or 1027b27ec6Sopenharmony_ci# (at your option) any later version. 1127b27ec6Sopenharmony_ci# 1227b27ec6Sopenharmony_ci# This program is distributed in the hope that it will be useful, 1327b27ec6Sopenharmony_ci# but WITHOUT ANY WARRANTY; without even the implied warranty of 1427b27ec6Sopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1527b27ec6Sopenharmony_ci# GNU General Public License for more details. 1627b27ec6Sopenharmony_ci# 1727b27ec6Sopenharmony_ci# You should have received a copy of the GNU General Public License along 1827b27ec6Sopenharmony_ci# with this program; if not, write to the Free Software Foundation, Inc., 1927b27ec6Sopenharmony_ci# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 2027b27ec6Sopenharmony_ci# 2127b27ec6Sopenharmony_ci# You can contact the author at : 2227b27ec6Sopenharmony_ci# - LZ4 homepage : http://www.lz4.org 2327b27ec6Sopenharmony_ci# - LZ4 source repository : https://github.com/lz4/lz4 2427b27ec6Sopenharmony_ci# ########################################################################## 2527b27ec6Sopenharmony_ci# fuzzer : Test tool, to check lz4 integrity on target platform 2627b27ec6Sopenharmony_ci# frametest : Test tool, to check lz4frame integrity on target platform 2727b27ec6Sopenharmony_ci# fullbench : Precisely measure speed for each LZ4 function variant 2827b27ec6Sopenharmony_ci# datagen : generates synthetic data samples for tests & benchmarks 2927b27ec6Sopenharmony_ci# ########################################################################## 3027b27ec6Sopenharmony_ci 3127b27ec6Sopenharmony_ciLZ4DIR := ../lib 3227b27ec6Sopenharmony_ciPRGDIR := ../programs 3327b27ec6Sopenharmony_ciTESTDIR := versionsTest 3427b27ec6Sopenharmony_ciPYTHON ?= python3 3527b27ec6Sopenharmony_ci 3627b27ec6Sopenharmony_ciDEBUGLEVEL?= 1 3727b27ec6Sopenharmony_ciDEBUGFLAGS = -g -DLZ4_DEBUG=$(DEBUGLEVEL) 3827b27ec6Sopenharmony_ciCFLAGS ?= -O3 # can select custom optimization flags. Example : CFLAGS=-O2 make 3927b27ec6Sopenharmony_ciCFLAGS += -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow \ 4027b27ec6Sopenharmony_ci -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes \ 4127b27ec6Sopenharmony_ci -Wpointer-arith -Wstrict-aliasing=1 4227b27ec6Sopenharmony_ciCFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) 4327b27ec6Sopenharmony_ciCPPFLAGS+= -I$(LZ4DIR) -I$(PRGDIR) -DXXH_NAMESPACE=LZ4_ 4427b27ec6Sopenharmony_ciFLAGS = $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) 4527b27ec6Sopenharmony_ci 4627b27ec6Sopenharmony_ciinclude ../Makefile.inc 4727b27ec6Sopenharmony_ci 4827b27ec6Sopenharmony_ciLZ4 := $(PRGDIR)/lz4$(EXT) 4927b27ec6Sopenharmony_ci 5027b27ec6Sopenharmony_ci 5127b27ec6Sopenharmony_ci# Default test parameters 5227b27ec6Sopenharmony_ciTEST_FILES := COPYING 5327b27ec6Sopenharmony_ciFUZZER_TIME := -T90s 5427b27ec6Sopenharmony_ciNB_LOOPS ?= -i1 5527b27ec6Sopenharmony_ci 5627b27ec6Sopenharmony_ci.PHONY: default 5727b27ec6Sopenharmony_cidefault: all 5827b27ec6Sopenharmony_ci 5927b27ec6Sopenharmony_ciall: fullbench fuzzer frametest roundTripTest datagen checkFrame decompress-partial 6027b27ec6Sopenharmony_ci 6127b27ec6Sopenharmony_ciall32: CFLAGS+=-m32 6227b27ec6Sopenharmony_ciall32: all 6327b27ec6Sopenharmony_ci 6427b27ec6Sopenharmony_cilz4: 6527b27ec6Sopenharmony_ci $(MAKE) -C $(PRGDIR) $@ CFLAGS="$(CFLAGS)" 6627b27ec6Sopenharmony_ci 6727b27ec6Sopenharmony_cilib liblz4.pc: 6827b27ec6Sopenharmony_ci $(MAKE) -C $(LZ4DIR) $@ CFLAGS="$(CFLAGS)" 6927b27ec6Sopenharmony_ci 7027b27ec6Sopenharmony_cilz4c unlz4 lz4cat: lz4 7127b27ec6Sopenharmony_ci $(LN_SF) $(LZ4) $(PRGDIR)/$@ 7227b27ec6Sopenharmony_ci 7327b27ec6Sopenharmony_cilz4c32: # create a 32-bits version for 32/64 interop tests 7427b27ec6Sopenharmony_ci $(MAKE) -C $(PRGDIR) $@ CFLAGS="-m32 $(CFLAGS)" 7527b27ec6Sopenharmony_ci 7627b27ec6Sopenharmony_ci%.o : $(LZ4DIR)/%.c $(LZ4DIR)/%.h 7727b27ec6Sopenharmony_ci $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ 7827b27ec6Sopenharmony_ci 7927b27ec6Sopenharmony_cifullbench : DEBUGLEVEL=0 8027b27ec6Sopenharmony_cifullbench : lz4.o lz4hc.o lz4frame.o xxhash.o fullbench.c 8127b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 8227b27ec6Sopenharmony_ci 8327b27ec6Sopenharmony_ci$(LZ4DIR)/liblz4.a: 8427b27ec6Sopenharmony_ci $(MAKE) -C $(LZ4DIR) liblz4.a 8527b27ec6Sopenharmony_ci 8627b27ec6Sopenharmony_cifullbench-lib: fullbench.c $(LZ4DIR)/liblz4.a 8727b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 8827b27ec6Sopenharmony_ci 8927b27ec6Sopenharmony_cifullbench-dll: fullbench.c $(LZ4DIR)/xxhash.c 9027b27ec6Sopenharmony_ci $(MAKE) -C $(LZ4DIR) liblz4 9127b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) -DLZ4_DLL_IMPORT=1 $(LZ4DIR)/dll/$(LIBLZ4).dll 9227b27ec6Sopenharmony_ci 9327b27ec6Sopenharmony_ci# test LZ4_USER_MEMORY_FUNCTIONS 9427b27ec6Sopenharmony_cifullbench-wmalloc: CPPFLAGS += -DLZ4_USER_MEMORY_FUNCTIONS 9527b27ec6Sopenharmony_cifullbench-wmalloc: fullbench 9627b27ec6Sopenharmony_ci 9727b27ec6Sopenharmony_cifuzzer : lz4.o lz4hc.o xxhash.o fuzzer.c 9827b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 9927b27ec6Sopenharmony_ci 10027b27ec6Sopenharmony_ciframetest: lz4frame.o lz4.o lz4hc.o xxhash.o frametest.c 10127b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 10227b27ec6Sopenharmony_ci 10327b27ec6Sopenharmony_ciroundTripTest : lz4.o lz4hc.o xxhash.o roundTripTest.c 10427b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 10527b27ec6Sopenharmony_ci 10627b27ec6Sopenharmony_cidatagen : $(PRGDIR)/datagen.c datagencli.c 10727b27ec6Sopenharmony_ci $(CC) $(FLAGS) -I$(PRGDIR) $^ -o $@$(EXT) 10827b27ec6Sopenharmony_ci 10927b27ec6Sopenharmony_cicheckFrame : lz4frame.o lz4.o lz4hc.o xxhash.o checkFrame.c 11027b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 11127b27ec6Sopenharmony_ci 11227b27ec6Sopenharmony_cidecompress-partial: lz4.o decompress-partial.c 11327b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 11427b27ec6Sopenharmony_ci 11527b27ec6Sopenharmony_cidecompress-partial-usingDict: lz4.o decompress-partial-usingDict.c 11627b27ec6Sopenharmony_ci $(CC) $(FLAGS) $^ -o $@$(EXT) 11727b27ec6Sopenharmony_ci 11827b27ec6Sopenharmony_cifreestanding: freestanding.c 11927b27ec6Sopenharmony_ci $(CC) -ffreestanding -nostdlib $^ -o $@$(EXT) 12027b27ec6Sopenharmony_ci 12127b27ec6Sopenharmony_ci.PHONY: clean 12227b27ec6Sopenharmony_ciclean: 12327b27ec6Sopenharmony_ci @$(MAKE) -C $(LZ4DIR) $@ > $(VOID) 12427b27ec6Sopenharmony_ci @$(MAKE) -C $(PRGDIR) $@ > $(VOID) 12527b27ec6Sopenharmony_ci @$(RM) -rf core *.o *.test tmp* \ 12627b27ec6Sopenharmony_ci fullbench-dll$(EXT) fullbench-lib$(EXT) \ 12727b27ec6Sopenharmony_ci fullbench$(EXT) fullbench32$(EXT) \ 12827b27ec6Sopenharmony_ci fuzzer$(EXT) fuzzer32$(EXT) \ 12927b27ec6Sopenharmony_ci frametest$(EXT) frametest32$(EXT) \ 13027b27ec6Sopenharmony_ci fasttest$(EXT) roundTripTest$(EXT) \ 13127b27ec6Sopenharmony_ci datagen$(EXT) checkTag$(EXT) \ 13227b27ec6Sopenharmony_ci frameTest$(EXT) decompress-partial$(EXT) \ 13327b27ec6Sopenharmony_ci abiTest$(EXT) freestanding$(EXT) \ 13427b27ec6Sopenharmony_ci lz4_all.c 13527b27ec6Sopenharmony_ci @$(RM) -rf $(TESTDIR) 13627b27ec6Sopenharmony_ci @echo Cleaning completed 13727b27ec6Sopenharmony_ci 13827b27ec6Sopenharmony_ci.PHONY: versionsTest 13927b27ec6Sopenharmony_civersionsTest: 14027b27ec6Sopenharmony_ci $(PYTHON) test-lz4-versions.py 14127b27ec6Sopenharmony_ci 14227b27ec6Sopenharmony_ci.PHONY: listTest 14327b27ec6Sopenharmony_cilistTest: lz4 14427b27ec6Sopenharmony_ci QEMU_SYS=$(QEMU_SYS) $(PYTHON) test-lz4-list.py 14527b27ec6Sopenharmony_ci 14627b27ec6Sopenharmony_ciabiTest: LDLIBS += -llz4 14727b27ec6Sopenharmony_ci 14827b27ec6Sopenharmony_ci.PHONY: abiTests 14927b27ec6Sopenharmony_ciabiTests: 15027b27ec6Sopenharmony_ci $(PYTHON) test-lz4-abi.py 15127b27ec6Sopenharmony_ci 15227b27ec6Sopenharmony_cicheckTag: checkTag.c $(LZ4DIR)/lz4.h 15327b27ec6Sopenharmony_ci $(CC) $(FLAGS) $< -o $@$(EXT) 15427b27ec6Sopenharmony_ci 15527b27ec6Sopenharmony_ci#----------------------------------------------------------------------------- 15627b27ec6Sopenharmony_ci# validated only for Linux, OSX, BSD, Hurd and Solaris targets 15727b27ec6Sopenharmony_ci#----------------------------------------------------------------------------- 15827b27ec6Sopenharmony_ciifeq ($(POSIX_ENV),Yes) 15927b27ec6Sopenharmony_ci 16027b27ec6Sopenharmony_ciMD5:=md5sum 16127b27ec6Sopenharmony_ciifneq (,$(filter $(shell $(UNAME)), Darwin )) 16227b27ec6Sopenharmony_ciMD5:=md5 -r 16327b27ec6Sopenharmony_ciendif 16427b27ec6Sopenharmony_ci 16527b27ec6Sopenharmony_ci# note : we should probably settle on a single compare utility 16627b27ec6Sopenharmony_ciCMP:=cmp 16727b27ec6Sopenharmony_ciGREP:=grep 16827b27ec6Sopenharmony_ciDIFF:=diff 16927b27ec6Sopenharmony_ciifneq (,$(filter $(shell $(UNAME)),SunOS)) 17027b27ec6Sopenharmony_ciDIFF:=gdiff 17127b27ec6Sopenharmony_ciendif 17227b27ec6Sopenharmony_ci 17327b27ec6Sopenharmony_ciCAT:=cat 17427b27ec6Sopenharmony_ciDD:=dd 17527b27ec6Sopenharmony_ciDATAGEN:=./datagen 17627b27ec6Sopenharmony_ci 17727b27ec6Sopenharmony_ci.PHONY: list 17827b27ec6Sopenharmony_cilist: 17927b27ec6Sopenharmony_ci @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs 18027b27ec6Sopenharmony_ci 18127b27ec6Sopenharmony_ci.PHONY: check 18227b27ec6Sopenharmony_cicheck: test-lz4-essentials 18327b27ec6Sopenharmony_ci 18427b27ec6Sopenharmony_ci.PHONY: test 18527b27ec6Sopenharmony_citest: test-lz4 test-lz4c test-frametest test-fullbench test-fuzzer test-amalgamation listTest test-decompress-partial 18627b27ec6Sopenharmony_ci 18727b27ec6Sopenharmony_ci.PHONY: test32 18827b27ec6Sopenharmony_citest32: CFLAGS+=-m32 18927b27ec6Sopenharmony_citest32: test 19027b27ec6Sopenharmony_ci 19127b27ec6Sopenharmony_ci.PHONY: test-amalgamation 19227b27ec6Sopenharmony_citest-amalgamation: lz4_all.o 19327b27ec6Sopenharmony_ci 19427b27ec6Sopenharmony_cilz4_all.c: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c $(LZ4DIR)/lz4frame.c 19527b27ec6Sopenharmony_ci $(CAT) $^ > $@ 19627b27ec6Sopenharmony_ci 19727b27ec6Sopenharmony_ci.PHONY: test-install 19827b27ec6Sopenharmony_citest-install: lz4 lib liblz4.pc 19927b27ec6Sopenharmony_ci lz4_root=.. ./test_install.sh 20027b27ec6Sopenharmony_ci 20127b27ec6Sopenharmony_ci.PHONY: test-compile-with-lz4-memory-usage 20227b27ec6Sopenharmony_citest-compile-with-lz4-memory-usage: 20327b27ec6Sopenharmony_ci $(MAKE) clean; CFLAGS=-O0 CPPFLAGS=-D'LZ4_MEMORY_USAGE=LZ4_MEMORY_USAGE_MIN' $(MAKE) all 20427b27ec6Sopenharmony_ci $(MAKE) clean; CFLAGS=-O0 CPPFLAGS=-D'LZ4_MEMORY_USAGE=LZ4_MEMORY_USAGE_MAX' $(MAKE) all 20527b27ec6Sopenharmony_ci 20627b27ec6Sopenharmony_ci.PHONY: test-lz4-sparse 20727b27ec6Sopenharmony_ci# Rules regarding Temporary test files : 20827b27ec6Sopenharmony_ci# Each test must use its own unique set of names during execution. 20927b27ec6Sopenharmony_ci# Each temporary test file must begin by an FPREFIX. 21027b27ec6Sopenharmony_ci# Each FPREFIX must be unique for each test. 21127b27ec6Sopenharmony_ci# All FPREFIX must start with `tmp`, for `make clean` 21227b27ec6Sopenharmony_ci# All tests must clean their temporary test files on successful completion, 21327b27ec6Sopenharmony_ci# and only their test files : do not employ sweeping statements such `rm tmp*` or `rm *.lz4` 21427b27ec6Sopenharmony_citest-lz4-sparse: FPREFIX = tmp-tls 21527b27ec6Sopenharmony_citest-lz4-sparse: lz4 datagen 21627b27ec6Sopenharmony_ci @echo "\n ---- test sparse file support ----" 21727b27ec6Sopenharmony_ci $(DATAGEN) -g5M -P100 > $(FPREFIX)dg5M 21827b27ec6Sopenharmony_ci $(LZ4) -B4D $(FPREFIX)dg5M -c | $(LZ4) -dv --sparse > $(FPREFIX)cB4 21927b27ec6Sopenharmony_ci $(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)cB4 22027b27ec6Sopenharmony_ci $(LZ4) -B5D $(FPREFIX)dg5M -c | $(LZ4) -dv --sparse > $(FPREFIX)cB5 22127b27ec6Sopenharmony_ci $(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)cB5 22227b27ec6Sopenharmony_ci $(LZ4) -B6D $(FPREFIX)dg5M -c | $(LZ4) -dv --sparse > $(FPREFIX)cB6 22327b27ec6Sopenharmony_ci $(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)cB6 22427b27ec6Sopenharmony_ci $(LZ4) -B7D $(FPREFIX)dg5M -c | $(LZ4) -dv --sparse > $(FPREFIX)cB7 22527b27ec6Sopenharmony_ci $(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)cB7 22627b27ec6Sopenharmony_ci $(LZ4) $(FPREFIX)dg5M -c | $(LZ4) -dv --no-sparse > $(FPREFIX)nosparse 22727b27ec6Sopenharmony_ci $(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)nosparse 22827b27ec6Sopenharmony_ci ls -ls $(FPREFIX)* 22927b27ec6Sopenharmony_ci $(DATAGEN) -s1 -g1200007 -P100 | $(LZ4) | $(LZ4) -dv --sparse > $(FPREFIX)odd # Odd size file (to generate non-full last block) 23027b27ec6Sopenharmony_ci $(DATAGEN) -s1 -g1200007 -P100 | $(DIFF) -s - $(FPREFIX)odd 23127b27ec6Sopenharmony_ci ls -ls $(FPREFIX)odd 23227b27ec6Sopenharmony_ci @$(RM) $(FPREFIX)* 23327b27ec6Sopenharmony_ci @echo "\n Compatibility with Console :" 23427b27ec6Sopenharmony_ci echo "Hello World 1 !" | $(LZ4) | $(LZ4) -d -c 23527b27ec6Sopenharmony_ci echo "Hello World 2 !" | $(LZ4) | $(LZ4) -d | $(CAT) 23627b27ec6Sopenharmony_ci echo "Hello World 3 !" | $(LZ4) --no-frame-crc | $(LZ4) -d -c 23727b27ec6Sopenharmony_ci @echo "\n Compatibility with Append :" 23827b27ec6Sopenharmony_ci $(DATAGEN) -P100 -g1M > $(FPREFIX)dg1M 23927b27ec6Sopenharmony_ci $(CAT) $(FPREFIX)dg1M $(FPREFIX)dg1M > $(FPREFIX)2M 24027b27ec6Sopenharmony_ci $(LZ4) -B5 -v $(FPREFIX)dg1M $(FPREFIX)c 24127b27ec6Sopenharmony_ci $(LZ4) -d -v $(FPREFIX)c $(FPREFIX)r 24227b27ec6Sopenharmony_ci $(LZ4) -d -v $(FPREFIX)c -c >> $(FPREFIX)r 24327b27ec6Sopenharmony_ci ls -ls $(FPREFIX)* 24427b27ec6Sopenharmony_ci $(DIFF) $(FPREFIX)2M $(FPREFIX)r 24527b27ec6Sopenharmony_ci @$(RM) $(FPREFIX)* 24627b27ec6Sopenharmony_ci 24727b27ec6Sopenharmony_citest-lz4-contentSize: FPREFIX = tmp-lzc 24827b27ec6Sopenharmony_citest-lz4-contentSize: lz4 datagen 24927b27ec6Sopenharmony_ci @echo "\n ---- test original size support ----" 25027b27ec6Sopenharmony_ci $(DATAGEN) -g15M > $(FPREFIX) 25127b27ec6Sopenharmony_ci $(LZ4) -v $(FPREFIX) -c | $(LZ4) -t 25227b27ec6Sopenharmony_ci $(LZ4) -v --content-size $(FPREFIX) -c | $(LZ4) -d > $(FPREFIX)-dup 25327b27ec6Sopenharmony_ci $(DIFF) $(FPREFIX) $(FPREFIX)-dup 25427b27ec6Sopenharmony_ci $(LZ4) -f $(FPREFIX) -c > $(FPREFIX).lz4 # compressed with content size 25527b27ec6Sopenharmony_ci $(LZ4) --content-size $(FPREFIX) -c > $(FPREFIX)-wcz.lz4 25627b27ec6Sopenharmony_ci ! $(DIFF) $(FPREFIX).lz4 $(FPREFIX)-wcz.lz4 # must differ, due to content size 25727b27ec6Sopenharmony_ci $(LZ4) --content-size < $(FPREFIX) > $(FPREFIX)-wcz2.lz4 # can determine content size because stdin is just a file 25827b27ec6Sopenharmony_ci $(DIFF) $(FPREFIX)-wcz.lz4 $(FPREFIX)-wcz2.lz4 # both must contain content size 25927b27ec6Sopenharmony_ci $(CAT) $(FPREFIX) | $(LZ4) > $(FPREFIX)-ncz.lz4 26027b27ec6Sopenharmony_ci $(DIFF) $(FPREFIX).lz4 $(FPREFIX)-ncz.lz4 # both don't have content size 26127b27ec6Sopenharmony_ci $(CAT) $(FPREFIX) | $(LZ4) --content-size > $(FPREFIX)-ncz2.lz4 # can't determine content size 26227b27ec6Sopenharmony_ci $(DIFF) $(FPREFIX).lz4 $(FPREFIX)-ncz2.lz4 # both don't have content size 26327b27ec6Sopenharmony_ci @$(RM) $(FPREFIX)* 26427b27ec6Sopenharmony_ci 26527b27ec6Sopenharmony_citest-lz4-frame-concatenation: FPREFIX = tmp-lfc 26627b27ec6Sopenharmony_citest-lz4-frame-concatenation: lz4 datagen 26727b27ec6Sopenharmony_ci @echo "\n ---- test frame concatenation ----" 26827b27ec6Sopenharmony_ci @echo -n > $(FPREFIX)-empty 26927b27ec6Sopenharmony_ci @echo hi > $(FPREFIX)-nonempty 27027b27ec6Sopenharmony_ci $(CAT) $(FPREFIX)-nonempty $(FPREFIX)-empty $(FPREFIX)-nonempty > $(FPREFIX)-src 27127b27ec6Sopenharmony_ci $(LZ4) -zq $(FPREFIX)-empty -c > $(FPREFIX)-empty.lz4 27227b27ec6Sopenharmony_ci $(LZ4) -zq $(FPREFIX)-nonempty -c > $(FPREFIX)-nonempty.lz4 27327b27ec6Sopenharmony_ci $(CAT) $(FPREFIX)-nonempty.lz4 $(FPREFIX)-empty.lz4 $(FPREFIX)-nonempty.lz4 > $(FPREFIX)-concat.lz4 27427b27ec6Sopenharmony_ci $(LZ4) -d $(FPREFIX)-concat.lz4 -c > $(FPREFIX)-result 27527b27ec6Sopenharmony_ci $(CMP) $(FPREFIX)-src $(FPREFIX)-result 27627b27ec6Sopenharmony_ci @$(RM) $(FPREFIX)* 27727b27ec6Sopenharmony_ci @echo frame concatenation test completed 27827b27ec6Sopenharmony_ci 27927b27ec6Sopenharmony_citest-lz4-multiple: FPREFIX = tmp-tml 28027b27ec6Sopenharmony_citest-lz4-multiple: lz4 datagen 28127b27ec6Sopenharmony_ci @echo "\n ---- test multiple files ----" 28227b27ec6Sopenharmony_ci @$(DATAGEN) -s1 > $(FPREFIX)1 2> $(VOID) 28327b27ec6Sopenharmony_ci @$(DATAGEN) -s2 -g100K > $(FPREFIX)2 2> $(VOID) 28427b27ec6Sopenharmony_ci @$(DATAGEN) -s3 -g200K > $(FPREFIX)3 2> $(VOID) 28527b27ec6Sopenharmony_ci # compress multiple files : one .lz4 per source file 28627b27ec6Sopenharmony_ci $(LZ4) -f -m $(FPREFIX)* 28727b27ec6Sopenharmony_ci test -f $(FPREFIX)1.lz4 28827b27ec6Sopenharmony_ci test -f $(FPREFIX)2.lz4 28927b27ec6Sopenharmony_ci test -f $(FPREFIX)3.lz4 29027b27ec6Sopenharmony_ci # decompress multiple files : one output file per .lz4 29127b27ec6Sopenharmony_ci mv $(FPREFIX)1 $(FPREFIX)1-orig 29227b27ec6Sopenharmony_ci mv $(FPREFIX)2 $(FPREFIX)2-orig 29327b27ec6Sopenharmony_ci mv $(FPREFIX)3 $(FPREFIX)3-orig 29427b27ec6Sopenharmony_ci $(LZ4) -d -f -m $(FPREFIX)*.lz4 29527b27ec6Sopenharmony_ci $(CMP) $(FPREFIX)1 $(FPREFIX)1-orig # must be identical 29627b27ec6Sopenharmony_ci $(CMP) $(FPREFIX)2 $(FPREFIX)2-orig 29727b27ec6Sopenharmony_ci $(CMP) $(FPREFIX)3 $(FPREFIX)3-orig 29827b27ec6Sopenharmony_ci # compress multiple files into stdout 29927b27ec6Sopenharmony_ci $(CAT) $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 > $(FPREFIX)-concat1 30027b27ec6Sopenharmony_ci $(RM) $(FPREFIX)*.lz4 30127b27ec6Sopenharmony_ci $(LZ4) -m $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 -c > $(FPREFIX)-concat2 30227b27ec6Sopenharmony_ci test ! -f $(FPREFIX)1.lz4 # must not create .lz4 artefact 30327b27ec6Sopenharmony_ci $(CMP) $(FPREFIX)-concat1 $(FPREFIX)-concat2 # must be equivalent 30427b27ec6Sopenharmony_ci # decompress multiple files into stdout 30527b27ec6Sopenharmony_ci $(RM) $(FPREFIX)-concat1 $(FPREFIX)-concat2 30627b27ec6Sopenharmony_ci $(LZ4) -f -m $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 # generate .lz4 to decompress 30727b27ec6Sopenharmony_ci $(CAT) $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 > $(FPREFIX)-concat1 # create concatenated reference 30827b27ec6Sopenharmony_ci $(RM) $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 30927b27ec6Sopenharmony_ci $(LZ4) -d -m $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 -c > $(FPREFIX)-concat2 31027b27ec6Sopenharmony_ci test ! -f $(FPREFIX)1 # must not create file artefact 31127b27ec6Sopenharmony_ci $(CMP) $(FPREFIX)-concat1 $(FPREFIX)-concat2 # must be equivalent 31227b27ec6Sopenharmony_ci # compress multiple files, one of which is absent (must fail) 31327b27ec6Sopenharmony_ci ! $(LZ4) -f -m $(FPREFIX)-concat1 notHere $(FPREFIX)-concat2 # must fail : notHere not present 31427b27ec6Sopenharmony_ci # test lz4-compressed file 31527b27ec6Sopenharmony_ci $(LZ4) -tm $(FPREFIX)-concat1.lz4 31627b27ec6Sopenharmony_ci $(LZ4) -tm $(FPREFIX)-concat1.lz4 $(FPREFIX)-concat2.lz4 31727b27ec6Sopenharmony_ci # test multiple lz4 files, one of which is absent (must fail) 31827b27ec6Sopenharmony_ci ! $(LZ4) -tm $(FPREFIX)-concat1.lz4 notHere.lz4 $(FPREFIX)-concat2.lz4 31927b27ec6Sopenharmony_ci @$(RM) $(FPREFIX)* 32027b27ec6Sopenharmony_ci 32127b27ec6Sopenharmony_citest-lz4-multiple-legacy: FPREFIX = tmp-lml 32227b27ec6Sopenharmony_citest-lz4-multiple-legacy: lz4 datagen 32327b27ec6Sopenharmony_ci @echo "\n ---- test multiple files (Legacy format) ----" 32427b27ec6Sopenharmony_ci @$(DATAGEN) -s1 > $(FPREFIX)1 2> $(VOID) 32527b27ec6Sopenharmony_ci @$(DATAGEN) -s2 -g100K > $(FPREFIX)2 2> $(VOID) 32627b27ec6Sopenharmony_ci @$(DATAGEN) -s3 -g200K > $(FPREFIX)3 2> $(VOID) 32727b27ec6Sopenharmony_ci # compress multiple files using legacy format: one .lz4 per source file 32827b27ec6Sopenharmony_ci $(LZ4) -f -l -m $(FPREFIX)* 32927b27ec6Sopenharmony_ci test -f $(FPREFIX)1.lz4 33027b27ec6Sopenharmony_ci test -f $(FPREFIX)2.lz4 33127b27ec6Sopenharmony_ci test -f $(FPREFIX)3.lz4 33227b27ec6Sopenharmony_ci # decompress multiple files compressed using legacy format: one output file per .lz4 33327b27ec6Sopenharmony_ci mv $(FPREFIX)1 $(FPREFIX)1-orig 33427b27ec6Sopenharmony_ci mv $(FPREFIX)2 $(FPREFIX)2-orig 33527b27ec6Sopenharmony_ci mv $(FPREFIX)3 $(FPREFIX)3-orig 33627b27ec6Sopenharmony_ci $(LZ4) -d -f -m $(FPREFIX)*.lz4 33727b27ec6Sopenharmony_ci $(LZ4) -l -d -f -m $(FPREFIX)*.lz4 # -l mustn't impact -d option 33827b27ec6Sopenharmony_ci $(CMP) $(FPREFIX)1 $(FPREFIX)1-orig # must be identical 33927b27ec6Sopenharmony_ci $(CMP) $(FPREFIX)2 $(FPREFIX)2-orig 34027b27ec6Sopenharmony_ci $(CMP) $(FPREFIX)3 $(FPREFIX)3-orig 34127b27ec6Sopenharmony_ci # compress multiple files into stdout using legacy format 34227b27ec6Sopenharmony_ci $(CAT) $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 > $(FPREFIX)-concat1 34327b27ec6Sopenharmony_ci $(RM) $(FPREFIX)*.lz4 34427b27ec6Sopenharmony_ci $(LZ4) -l -m $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 -c > $(FPREFIX)-concat2 34527b27ec6Sopenharmony_ci test ! -f $(FPREFIX)1.lz4 # must not create .lz4 artefact 34627b27ec6Sopenharmony_ci $(CMP) $(FPREFIX)-concat1 $(FPREFIX)-concat2 # must be equivalent 34727b27ec6Sopenharmony_ci # # # decompress multiple files into stdout using legacy format 34827b27ec6Sopenharmony_ci $(RM) $(FPREFIX)-concat1 $(FPREFIX)-concat2 34927b27ec6Sopenharmony_ci $(LZ4) -l -f -m $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 # generate .lz4 to decompress 35027b27ec6Sopenharmony_ci $(CAT) $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 > $(FPREFIX)-concat1 # create concatenated reference 35127b27ec6Sopenharmony_ci $(RM) $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 35227b27ec6Sopenharmony_ci $(LZ4) -d -m $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 -c > $(FPREFIX)-concat2 35327b27ec6Sopenharmony_ci $(LZ4) -d -l -m $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 -c > $(FPREFIX)-concat2 # -l mustn't impact option -d 35427b27ec6Sopenharmony_ci test ! -f $(FPREFIX)1 # must not create file artefact 35527b27ec6Sopenharmony_ci $(CMP) $(FPREFIX)-concat1 $(FPREFIX)-concat2 # must be equivalent 35627b27ec6Sopenharmony_ci # # # compress multiple files, one of which is absent (must fail) 35727b27ec6Sopenharmony_ci ! $(LZ4) -f -l -m $(FPREFIX)-concat1 notHere-legacy $(FPREFIX)-concat2 # must fail : notHere-legacy not present 35827b27ec6Sopenharmony_ci @$(RM) $(FPREFIX)* 35927b27ec6Sopenharmony_ci 36027b27ec6Sopenharmony_ciSKIPFILE = goldenSamples/skip.bin 36127b27ec6Sopenharmony_citest-lz4-skippable: FPREFIX = tmp-lsk 36227b27ec6Sopenharmony_citest-lz4-skippable: lz4 datagen 36327b27ec6Sopenharmony_ci @echo "\n ---- test lz4 with skippable frames ----" 36427b27ec6Sopenharmony_ci $(LZ4) -dc $(SKIPFILE) 36527b27ec6Sopenharmony_ci $(LZ4) -dc < $(SKIPFILE) 36627b27ec6Sopenharmony_ci cat $(SKIPFILE) | $(LZ4) -dc 36727b27ec6Sopenharmony_ci echo "Hello from Valid Frame!\n" | $(LZ4) -c > $(FPREFIX).lz4 36827b27ec6Sopenharmony_ci cat $(SKIPFILE) $(FPREFIX).lz4 $(SKIPFILE) | $(LZ4) -dc 36927b27ec6Sopenharmony_ci $(RM) $(FPREFIX)* 37027b27ec6Sopenharmony_ci 37127b27ec6Sopenharmony_citest-lz4-basic: FPREFIX = tmp-tlb 37227b27ec6Sopenharmony_citest-lz4-basic: lz4 datagen unlz4 lz4cat 37327b27ec6Sopenharmony_ci @echo "\n ---- test lz4 basic compression/decompression ----" 37427b27ec6Sopenharmony_ci $(DATAGEN) -g0 | $(LZ4) -v | $(LZ4) -t 37527b27ec6Sopenharmony_ci $(DATAGEN) -g16KB | $(LZ4) -9 | $(LZ4) -t 37627b27ec6Sopenharmony_ci $(DATAGEN) -g20KB > $(FPREFIX)-dg20k 37727b27ec6Sopenharmony_ci $(LZ4) < $(FPREFIX)-dg20k | $(LZ4) -d > $(FPREFIX)-dec 37827b27ec6Sopenharmony_ci $(DIFF) -q $(FPREFIX)-dg20k $(FPREFIX)-dec 37927b27ec6Sopenharmony_ci $(LZ4) --no-frame-crc < $(FPREFIX)-dg20k | $(LZ4) -d > $(FPREFIX)-dec 38027b27ec6Sopenharmony_ci $(DIFF) -q $(FPREFIX)-dg20k $(FPREFIX)-dec 38127b27ec6Sopenharmony_ci $(DATAGEN) | $(LZ4) -BI | $(LZ4) -t 38227b27ec6Sopenharmony_ci $(DATAGEN) | $(LZ4) --no-crc | $(LZ4) -t 38327b27ec6Sopenharmony_ci $(DATAGEN) -g6M -P99 | $(LZ4) -9BD | $(LZ4) -t 38427b27ec6Sopenharmony_ci $(DATAGEN) -g17M | $(LZ4) -9v | $(LZ4) -qt 38527b27ec6Sopenharmony_ci $(DATAGEN) -g33M | $(LZ4) --no-frame-crc | $(LZ4) -t 38627b27ec6Sopenharmony_ci $(DATAGEN) -g256MB | $(LZ4) -vqB4D | $(LZ4) -t --no-crc 38727b27ec6Sopenharmony_ci @echo "hello world" > $(FPREFIX)-hw 38827b27ec6Sopenharmony_ci $(LZ4) --rm -f $(FPREFIX)-hw $(FPREFIX)-hw.lz4 38927b27ec6Sopenharmony_ci test ! -f $(FPREFIX)-hw # must fail (--rm) 39027b27ec6Sopenharmony_ci test -f $(FPREFIX)-hw.lz4 39127b27ec6Sopenharmony_ci $(PRGDIR)/lz4cat $(FPREFIX)-hw.lz4 | $(GREP) "hello world" 39227b27ec6Sopenharmony_ci $(PRGDIR)/unlz4 --rm $(FPREFIX)-hw.lz4 $(FPREFIX)-hw 39327b27ec6Sopenharmony_ci test -f $(FPREFIX)-hw 39427b27ec6Sopenharmony_ci test ! -f $(FPREFIX)-hw.lz4 # must fail (--rm) 39527b27ec6Sopenharmony_ci test ! -f $(FPREFIX)-hw.lz4.lz4 # must fail (unlz4) 39627b27ec6Sopenharmony_ci $(PRGDIR)/lz4cat $(FPREFIX)-hw # pass-through mode 39727b27ec6Sopenharmony_ci test -f $(FPREFIX)-hw 39827b27ec6Sopenharmony_ci test ! -f $(FPREFIX)-hw.lz4 # must fail (lz4cat) 39927b27ec6Sopenharmony_ci $(LZ4) $(FPREFIX)-hw $(FPREFIX)-hw.lz4 # creates $(FPREFIX)-hw.lz4 40027b27ec6Sopenharmony_ci $(PRGDIR)/lz4cat < $(FPREFIX)-hw.lz4 > $(FPREFIX)3 # checks lz4cat works with stdin (#285) 40127b27ec6Sopenharmony_ci $(DIFF) -q $(FPREFIX)-hw $(FPREFIX)3 40227b27ec6Sopenharmony_ci $(PRGDIR)/lz4cat < $(FPREFIX)-hw > $(FPREFIX)2 # checks lz4cat works in pass-through mode 40327b27ec6Sopenharmony_ci $(DIFF) -q $(FPREFIX)-hw $(FPREFIX)2 40427b27ec6Sopenharmony_ci cp $(FPREFIX)-hw ./-d 40527b27ec6Sopenharmony_ci $(LZ4) --rm -- -d -d.lz4 # compresses ./d into ./-d.lz4 40627b27ec6Sopenharmony_ci test -f ./-d.lz4 40727b27ec6Sopenharmony_ci test ! -f ./-d 40827b27ec6Sopenharmony_ci mv ./-d.lz4 ./-z 40927b27ec6Sopenharmony_ci $(LZ4) -d --rm -- -z $(FPREFIX)4 # uncompresses ./-z into $(FPREFIX)4 41027b27ec6Sopenharmony_ci test ! -f ./-z 41127b27ec6Sopenharmony_ci $(DIFF) -q $(FPREFIX)-hw $(FPREFIX)4 41227b27ec6Sopenharmony_ci ! $(LZ4) $(FPREFIX)2 $(FPREFIX)3 $(FPREFIX)4 # must fail: refuse to handle 3+ file names 41327b27ec6Sopenharmony_ci $(LZ4) -f $(FPREFIX)-hw # create $(FPREFIX)-hw.lz4, for next tests 41427b27ec6Sopenharmony_ci $(LZ4) --list $(FPREFIX)-hw.lz4 # test --list on valid single-frame file 41527b27ec6Sopenharmony_ci $(LZ4) --list < $(FPREFIX)-hw.lz4 # test --list from stdin (file only) 41627b27ec6Sopenharmony_ci $(CAT) $(FPREFIX)-hw >> $(FPREFIX)-hw.lz4 41727b27ec6Sopenharmony_ci ! $(LZ4) -f $(FPREFIX)-hw.lz4 # uncompress valid frame followed by invalid data (must fail now) 41827b27ec6Sopenharmony_ci $(LZ4) -BX $(FPREFIX)-hw -c -q | $(LZ4) -tv # test block checksum 41927b27ec6Sopenharmony_ci # $(DATAGEN) -g20KB generates the same file every single time 42027b27ec6Sopenharmony_ci # cannot save output of $(DATAGEN) -g20KB as input file to lz4 because the following shell commands are run before $(DATAGEN) -g20KB 42127b27ec6Sopenharmony_ci test "$(shell $(DATAGEN) -g20KB | $(LZ4) -c --fast | wc -c)" -lt "$(shell $(DATAGEN) -g20KB | $(LZ4) -c --fast=9 | wc -c)" # -1 vs -9 42227b27ec6Sopenharmony_ci test "$(shell $(DATAGEN) -g20KB | $(LZ4) -c -1 | wc -c)" -lt "$(shell $(DATAGEN) -g20KB| $(LZ4) -c --fast=1 | wc -c)" # 1 vs -1 42327b27ec6Sopenharmony_ci test "$(shell $(DATAGEN) -g20KB | $(LZ4) -c --fast=1 | wc -c)" -eq "$(shell $(DATAGEN) -g20KB| $(LZ4) -c --fast| wc -c)" # checks default fast compression is -1 42427b27ec6Sopenharmony_ci ! $(LZ4) -c --fast=0 $(FPREFIX)-dg20K # lz4 should fail when fast=0 42527b27ec6Sopenharmony_ci ! $(LZ4) -c --fast=-1 $(FPREFIX)-dg20K # lz4 should fail when fast=-1 42627b27ec6Sopenharmony_ci # High --fast values can result in out-of-bound dereferences #876 42727b27ec6Sopenharmony_ci $(DATAGEN) -g1M | $(LZ4) -c --fast=999999999 > /dev/null 42827b27ec6Sopenharmony_ci # Test for #596 42927b27ec6Sopenharmony_ci @echo "TEST" > $(FPREFIX)-test 43027b27ec6Sopenharmony_ci $(LZ4) -m $(FPREFIX)-test 43127b27ec6Sopenharmony_ci $(LZ4) $(FPREFIX)-test.lz4 $(FPREFIX)-test2 43227b27ec6Sopenharmony_ci $(DIFF) -q $(FPREFIX)-test $(FPREFIX)-test2 43327b27ec6Sopenharmony_ci @$(RM) $(FPREFIX)* 43427b27ec6Sopenharmony_ci 43527b27ec6Sopenharmony_ci 43627b27ec6Sopenharmony_citest-lz4-dict: FPREFIX = tmp-dict 43727b27ec6Sopenharmony_citest-lz4-dict: lz4 datagen 43827b27ec6Sopenharmony_ci @echo "\n ---- test lz4 compression/decompression with dictionary ----" 43927b27ec6Sopenharmony_ci $(DATAGEN) -g16KB > $(FPREFIX) 44027b27ec6Sopenharmony_ci $(DATAGEN) -g32KB > $(FPREFIX)-sample-32k 44127b27ec6Sopenharmony_ci < $(FPREFIX)-sample-32k $(LZ4) -D $(FPREFIX) | $(LZ4) -dD $(FPREFIX) | diff - $(FPREFIX)-sample-32k 44227b27ec6Sopenharmony_ci $(DATAGEN) -g128MB > $(FPREFIX)-sample-128m 44327b27ec6Sopenharmony_ci < $(FPREFIX)-sample-128m $(LZ4) -D $(FPREFIX) | $(LZ4) -dD $(FPREFIX) | diff - $(FPREFIX)-sample-128m 44427b27ec6Sopenharmony_ci touch $(FPREFIX)-sample-0 44527b27ec6Sopenharmony_ci < $(FPREFIX)-sample-0 $(LZ4) -D $(FPREFIX) | $(LZ4) -dD $(FPREFIX) | diff - $(FPREFIX)-sample-0 44627b27ec6Sopenharmony_ci 44727b27ec6Sopenharmony_ci < $(FPREFIX)-sample-32k $(LZ4) -D $(FPREFIX)-sample-0 | $(LZ4) -dD $(FPREFIX)-sample-0 | diff - $(FPREFIX)-sample-32k 44827b27ec6Sopenharmony_ci < $(FPREFIX)-sample-0 $(LZ4) -D $(FPREFIX)-sample-0 | $(LZ4) -dD $(FPREFIX)-sample-0 | diff - $(FPREFIX)-sample-0 44927b27ec6Sopenharmony_ci 45027b27ec6Sopenharmony_ci @echo "\n ---- test lz4 dictionary loading ----" 45127b27ec6Sopenharmony_ci $(DATAGEN) -g128KB > $(FPREFIX)-data-128KB 45227b27ec6Sopenharmony_ci set -e; \ 45327b27ec6Sopenharmony_ci for l in 0 1 4 128 32767 32768 32769 65535 65536 65537 98303 98304 98305 131071 131072 131073; do \ 45427b27ec6Sopenharmony_ci $(DATAGEN) -g$$l > $(FPREFIX)-$$l; \ 45527b27ec6Sopenharmony_ci $(DD) if=$(FPREFIX)-$$l of=$(FPREFIX)-$$l-tail bs=1 count=65536 skip=$$((l > 65536 ? l - 65536 : 0)); \ 45627b27ec6Sopenharmony_ci < $(FPREFIX)-$$l $(LZ4) -D stdin $(FPREFIX)-data-128KB -c | $(LZ4) -dD $(FPREFIX)-$$l-tail | $(DIFF) - $(FPREFIX)-data-128KB; \ 45727b27ec6Sopenharmony_ci < $(FPREFIX)-$$l-tail $(LZ4) -D stdin $(FPREFIX)-data-128KB -c | $(LZ4) -dD $(FPREFIX)-$$l | $(DIFF) - $(FPREFIX)-data-128KB; \ 45827b27ec6Sopenharmony_ci done 45927b27ec6Sopenharmony_ci @$(RM) $(FPREFIX)* 46027b27ec6Sopenharmony_ci 46127b27ec6Sopenharmony_citest-lz4hc-hugefile: lz4 datagen 46227b27ec6Sopenharmony_ci @echo "\n ---- test HC compression/decompression of huge files ----" 46327b27ec6Sopenharmony_ci $(DATAGEN) -g4200MB | $(LZ4) -v3BD | $(LZ4) -qt 46427b27ec6Sopenharmony_ci 46527b27ec6Sopenharmony_citest-lz4-fast-hugefile: FPREFIX = tmp-lfh 46627b27ec6Sopenharmony_citest-lz4-fast-hugefile: lz4 datagen 46727b27ec6Sopenharmony_ci @echo "\n ---- test huge files compression/decompression ----" 46827b27ec6Sopenharmony_ci $(DATAGEN) -g6GB | $(LZ4) -vB5D | $(LZ4) -qt 46927b27ec6Sopenharmony_ci # test large file size [2-4] GB 47027b27ec6Sopenharmony_ci @$(DATAGEN) -g3G -P100 | $(LZ4) -vv | $(LZ4) --decompress --force --sparse - $(FPREFIX)1 47127b27ec6Sopenharmony_ci @ls -ls $(FPREFIX)1 47227b27ec6Sopenharmony_ci @$(DATAGEN) -g3G -P100 | $(LZ4) --quiet --content-size | $(LZ4) --verbose --decompress --force --sparse - $(FPREFIX)2 47327b27ec6Sopenharmony_ci @ls -ls $(FPREFIX)2 47427b27ec6Sopenharmony_ci $(DIFF) -s $(FPREFIX)1 $(FPREFIX)2 47527b27ec6Sopenharmony_ci @$(RM) $(FPREFIX)* 47627b27ec6Sopenharmony_ci 47727b27ec6Sopenharmony_citest-lz4-hugefile: test-lz4-fast-hugefile test-lz4hc-hugefile 47827b27ec6Sopenharmony_ci 47927b27ec6Sopenharmony_citest-lz4-testmode: FPREFIX = tmp-ltm 48027b27ec6Sopenharmony_citest-lz4-testmode: lz4 datagen 48127b27ec6Sopenharmony_ci @echo "\n ---- bench mode ----" 48227b27ec6Sopenharmony_ci $(LZ4) -bi0 48327b27ec6Sopenharmony_ci $(DATAGEN) > $(FPREFIX) 48427b27ec6Sopenharmony_ci $(LZ4) -f $(FPREFIX) -c > $(FPREFIX).lz4 48527b27ec6Sopenharmony_ci $(LZ4) -bdi0 $(FPREFIX).lz4 # test benchmark decode-only mode 48627b27ec6Sopenharmony_ci $(LZ4) -bdi0 --no-crc $(FPREFIX).lz4 # test benchmark decode-only mode 48727b27ec6Sopenharmony_ci @echo "\n ---- test mode ----" 48827b27ec6Sopenharmony_ci ! $(DATAGEN) | $(LZ4) -t 48927b27ec6Sopenharmony_ci ! $(DATAGEN) | $(LZ4) -tf 49027b27ec6Sopenharmony_ci @echo "\n ---- pass-through mode ----" 49127b27ec6Sopenharmony_ci @echo "Why hello there " > $(FPREFIX)2.lz4 49227b27ec6Sopenharmony_ci ! $(LZ4) -f $(FPREFIX)2.lz4 > $(VOID) 49327b27ec6Sopenharmony_ci ! $(DATAGEN) | $(LZ4) -dc > $(VOID) 49427b27ec6Sopenharmony_ci ! $(DATAGEN) | $(LZ4) -df > $(VOID) 49527b27ec6Sopenharmony_ci $(DATAGEN) | $(LZ4) -dcf > $(VOID) 49627b27ec6Sopenharmony_ci @echo "Hello World !" > $(FPREFIX)1 49727b27ec6Sopenharmony_ci $(LZ4) -dcf $(FPREFIX)1 49827b27ec6Sopenharmony_ci @echo "from underground..." > $(FPREFIX)2 49927b27ec6Sopenharmony_ci $(LZ4) -dcfm $(FPREFIX)1 $(FPREFIX)2 50027b27ec6Sopenharmony_ci @echo "\n ---- non-existing source (must fail cleanly) ----" 50127b27ec6Sopenharmony_ci ! $(LZ4) file-does-not-exist 50227b27ec6Sopenharmony_ci ! $(LZ4) -f file-does-not-exist 50327b27ec6Sopenharmony_ci ! $(LZ4) -t file-does-not-exist 50427b27ec6Sopenharmony_ci ! $(LZ4) -fm file1-dne file2-dne 50527b27ec6Sopenharmony_ci @$(RM) $(FPREFIX)* 50627b27ec6Sopenharmony_ci 50727b27ec6Sopenharmony_citest-lz4-opt-parser: lz4 datagen 50827b27ec6Sopenharmony_ci @echo "\n ---- test opt-parser ----" 50927b27ec6Sopenharmony_ci $(DATAGEN) -g16KB | $(LZ4) -12 | $(LZ4) -t 51027b27ec6Sopenharmony_ci $(DATAGEN) -P10 | $(LZ4) -12B4 | $(LZ4) -t 51127b27ec6Sopenharmony_ci $(DATAGEN) -g256K | $(LZ4) -12B4D | $(LZ4) -t 51227b27ec6Sopenharmony_ci $(DATAGEN) -g512K -P25 | $(LZ4) -12BD | $(LZ4) -t 51327b27ec6Sopenharmony_ci $(DATAGEN) -g1M | $(LZ4) -12B5 | $(LZ4) -t 51427b27ec6Sopenharmony_ci $(DATAGEN) -g1M -s2 | $(LZ4) -12B4D | $(LZ4) -t 51527b27ec6Sopenharmony_ci $(DATAGEN) -g2M -P99 | $(LZ4) -11B4D | $(LZ4) -t 51627b27ec6Sopenharmony_ci $(DATAGEN) -g4M | $(LZ4) -11vq | $(LZ4) -qt 51727b27ec6Sopenharmony_ci $(DATAGEN) -g8M | $(LZ4) -11B4 | $(LZ4) -t 51827b27ec6Sopenharmony_ci $(DATAGEN) -g16M -P90 | $(LZ4) -11B5 | $(LZ4) -t 51927b27ec6Sopenharmony_ci $(DATAGEN) -g32M -P10 | $(LZ4) -11B5D | $(LZ4) -t 52027b27ec6Sopenharmony_ci 52127b27ec6Sopenharmony_citest-lz4-essentials : lz4 datagen test-lz4-basic test-lz4-multiple test-lz4-multiple-legacy \ 52227b27ec6Sopenharmony_ci test-lz4-frame-concatenation test-lz4-testmode \ 52327b27ec6Sopenharmony_ci test-lz4-contentSize test-lz4-dict 52427b27ec6Sopenharmony_ci 52527b27ec6Sopenharmony_citest-lz4: lz4 datagen test-lz4-essentials test-lz4-opt-parser \ 52627b27ec6Sopenharmony_ci test-lz4-sparse test-lz4-hugefile test-lz4-dict \ 52727b27ec6Sopenharmony_ci test-lz4-skippable 52827b27ec6Sopenharmony_ci 52927b27ec6Sopenharmony_citest-lz4c: LZ4C = $(LZ4)c 53027b27ec6Sopenharmony_citest-lz4c: lz4c datagen 53127b27ec6Sopenharmony_ci @echo "\n ---- test lz4c variant ----" 53227b27ec6Sopenharmony_ci $(DATAGEN) -g256MB | $(LZ4C) -l -v | $(LZ4C) -t 53327b27ec6Sopenharmony_ci 53427b27ec6Sopenharmony_citest-lz4c32: CFLAGS+=-m32 53527b27ec6Sopenharmony_citest-lz4c32: test-lz4 53627b27ec6Sopenharmony_ci 53727b27ec6Sopenharmony_citest-interop-32-64: lz4 lz4c32 datagen 53827b27ec6Sopenharmony_ci @echo "\n ---- test interoperability 32-bits -vs- 64 bits ----" 53927b27ec6Sopenharmony_ci $(DATAGEN) -g16KB | $(LZ4)c32 -9 | $(LZ4) -t 54027b27ec6Sopenharmony_ci $(DATAGEN) -P10 | $(LZ4) -9B4 | $(LZ4)c32 -t 54127b27ec6Sopenharmony_ci $(DATAGEN) | $(LZ4)c32 | $(LZ4) -t 54227b27ec6Sopenharmony_ci $(DATAGEN) -g1M | $(LZ4) -3B5 | $(LZ4)c32 -t 54327b27ec6Sopenharmony_ci $(DATAGEN) -g256MB | $(LZ4)c32 -vqB4D | $(LZ4) -qt 54427b27ec6Sopenharmony_ci $(DATAGEN) -g1G -P90 | $(LZ4) | $(LZ4)c32 -t 54527b27ec6Sopenharmony_ci $(DATAGEN) -g6GB | $(LZ4)c32 -vq9BD | $(LZ4) -qt 54627b27ec6Sopenharmony_ci 54727b27ec6Sopenharmony_citest-lz4c32-basic: lz4c32 datagen 54827b27ec6Sopenharmony_ci @echo "\n ---- test lz4c32 32-bits version ----" 54927b27ec6Sopenharmony_ci $(DATAGEN) -g16KB | $(LZ4)c32 -9 | $(LZ4)c32 -t 55027b27ec6Sopenharmony_ci $(DATAGEN) | $(LZ4)c32 | $(LZ4)c32 -t 55127b27ec6Sopenharmony_ci $(DATAGEN) -g256MB | $(LZ4)c32 -vqB4D | $(LZ4)c32 -qt 55227b27ec6Sopenharmony_ci $(DATAGEN) -g6GB | $(LZ4)c32 -vqB5D | $(LZ4)c32 -qt 55327b27ec6Sopenharmony_ci 55427b27ec6Sopenharmony_citest-platform: 55527b27ec6Sopenharmony_ci @echo "\n ---- test lz4 $(QEMU_SYS) platform ----" 55627b27ec6Sopenharmony_ci $(QEMU_SYS) $(DATAGEN) -g16KB | $(QEMU_SYS) $(LZ4) -9 | $(QEMU_SYS) $(LZ4) -t 55727b27ec6Sopenharmony_ci $(QEMU_SYS) $(DATAGEN) | $(QEMU_SYS) $(LZ4) | $(QEMU_SYS) $(LZ4) -t 55827b27ec6Sopenharmony_ci $(QEMU_SYS) $(DATAGEN) -g256MB | $(QEMU_SYS) $(LZ4) -vqB4D | $(QEMU_SYS) $(LZ4) -qt 55927b27ec6Sopenharmony_ciifneq ($(QEMU_SYS),qemu-arm-static) 56027b27ec6Sopenharmony_ci $(QEMU_SYS) $(DATAGEN) -g3GB | $(QEMU_SYS) $(LZ4) -vqB5D | $(QEMU_SYS) $(LZ4) -qt 56127b27ec6Sopenharmony_ciendif 56227b27ec6Sopenharmony_ci 56327b27ec6Sopenharmony_citest-fullbench: fullbench 56427b27ec6Sopenharmony_ci ./fullbench --no-prompt $(NB_LOOPS) $(TEST_FILES) 56527b27ec6Sopenharmony_ci 56627b27ec6Sopenharmony_citest-fullbench32: CFLAGS += -m32 56727b27ec6Sopenharmony_citest-fullbench32: test-fullbench 56827b27ec6Sopenharmony_ci 56927b27ec6Sopenharmony_citest-fuzzer: fuzzer 57027b27ec6Sopenharmony_ci ./fuzzer $(FUZZER_TIME) 57127b27ec6Sopenharmony_ci 57227b27ec6Sopenharmony_citest-fuzzer32: CFLAGS += -m32 57327b27ec6Sopenharmony_citest-fuzzer32: test-fuzzer 57427b27ec6Sopenharmony_ci 57527b27ec6Sopenharmony_citest-frametest: frametest 57627b27ec6Sopenharmony_ci ./frametest -v $(FUZZER_TIME) 57727b27ec6Sopenharmony_ci 57827b27ec6Sopenharmony_citest-frametest32: CFLAGS += -m32 57927b27ec6Sopenharmony_citest-frametest32: test-frametest 58027b27ec6Sopenharmony_ci 58127b27ec6Sopenharmony_ciVALGRIND = valgrind --leak-check=yes --error-exitcode=1 58227b27ec6Sopenharmony_citest-mem: FPREFIX = tmp-tvm 58327b27ec6Sopenharmony_citest-mem: lz4 datagen fuzzer frametest fullbench 58427b27ec6Sopenharmony_ci @echo "\n ---- valgrind tests : memory analyzer ----" 58527b27ec6Sopenharmony_ci $(VALGRIND) $(DATAGEN) -g50M > $(VOID) 58627b27ec6Sopenharmony_ci $(DATAGEN) -g16KB > $(FPREFIX)dg16K 58727b27ec6Sopenharmony_ci $(VALGRIND) $(LZ4) -9 -BD -f $(FPREFIX)dg16K $(VOID) 58827b27ec6Sopenharmony_ci $(DATAGEN) -g16KB -s2 > $(FPREFIX)dg16K2 58927b27ec6Sopenharmony_ci $(DATAGEN) -g16KB -s3 > $(FPREFIX)dg16K3 59027b27ec6Sopenharmony_ci $(VALGRIND) $(LZ4) --force --multiple $(FPREFIX)dg16K $(FPREFIX)dg16K2 $(FPREFIX)dg16K3 59127b27ec6Sopenharmony_ci $(DATAGEN) -g7MB > $(FPREFIX)dg7M 59227b27ec6Sopenharmony_ci $(VALGRIND) $(LZ4) -9 -B5D -f $(FPREFIX)dg7M $(FPREFIX)dg16K2 59327b27ec6Sopenharmony_ci $(VALGRIND) $(LZ4) -t $(FPREFIX)dg16K2 59427b27ec6Sopenharmony_ci $(VALGRIND) $(LZ4) -bi1 $(FPREFIX)dg7M 59527b27ec6Sopenharmony_ci $(VALGRIND) ./fullbench -i1 $(FPREFIX)dg7M $(FPREFIX)dg16K2 59627b27ec6Sopenharmony_ci $(VALGRIND) $(LZ4) -B4D -f -vq $(FPREFIX)dg7M $(VOID) 59727b27ec6Sopenharmony_ci $(VALGRIND) $(LZ4) --list -m $(FPREFIX)*.lz4 59827b27ec6Sopenharmony_ci $(VALGRIND) $(LZ4) --list -m -v $(FPREFIX)*.lz4 59927b27ec6Sopenharmony_ci $(RM) $(FPREFIX)* 60027b27ec6Sopenharmony_ci $(VALGRIND) ./fuzzer -i64 -t1 60127b27ec6Sopenharmony_ci $(VALGRIND) ./frametest -i256 60227b27ec6Sopenharmony_ci 60327b27ec6Sopenharmony_citest-mem32: lz4c32 datagen 60427b27ec6Sopenharmony_ci# unfortunately, valgrind doesn't seem to work with non-native binary... 60527b27ec6Sopenharmony_ci 60627b27ec6Sopenharmony_citest-decompress-partial : decompress-partial decompress-partial-usingDict 60727b27ec6Sopenharmony_ci @echo "\n ---- test decompress-partial ----" 60827b27ec6Sopenharmony_ci ./decompress-partial$(EXT) 60927b27ec6Sopenharmony_ci @echo "\n ---- test decompress-partial-usingDict ----" 61027b27ec6Sopenharmony_ci ./decompress-partial-usingDict$(EXT) 61127b27ec6Sopenharmony_ci 61227b27ec6Sopenharmony_citest-freestanding: freestanding 61327b27ec6Sopenharmony_ci @echo "\n ---- test freestanding ----" 61427b27ec6Sopenharmony_ci ./freestanding$(EXT) 61527b27ec6Sopenharmony_ci -strace ./freestanding$(EXT) 61627b27ec6Sopenharmony_ci -ltrace ./freestanding$(EXT) 61727b27ec6Sopenharmony_ci 61827b27ec6Sopenharmony_ciendif 619