• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ##########################################################################
2# LZ4 programs - Makefile
3# Copyright (C) Yann Collet 2011-present
4#
5# GPL v2 License
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License along
18# with this program; if not, write to the Free Software Foundation, Inc.,
19# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# You can contact the author at :
22#  - LZ4 homepage : http://www.lz4.org
23#  - LZ4 source repository : https://github.com/lz4/lz4
24# ##########################################################################
25# fuzzer  : Test tool, to check lz4 integrity on target platform
26# frametest  : Test tool, to check lz4frame integrity on target platform
27# fullbench  : Precisely measure speed for each LZ4 function variant
28# datagen : generates synthetic data samples for tests & benchmarks
29# ##########################################################################
30
31LZ4DIR  := ../lib
32PRGDIR  := ../programs
33TESTDIR := versionsTest
34PYTHON  ?= python3
35
36DEBUGLEVEL?= 1
37DEBUGFLAGS = -g -DLZ4_DEBUG=$(DEBUGLEVEL)
38CFLAGS  ?= -O3 # can select custom optimization flags. For example : CFLAGS=-O2 make
39CFLAGS  += -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow \
40           -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes \
41           -Wpointer-arith -Wstrict-aliasing=1
42CFLAGS  += $(DEBUGFLAGS) $(MOREFLAGS)
43CPPFLAGS+= -I$(LZ4DIR) -I$(PRGDIR) -DXXH_NAMESPACE=LZ4_
44FLAGS    = $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
45
46include ../Makefile.inc
47
48LZ4 := $(PRGDIR)/lz4$(EXT)
49
50
51# Default test parameters
52TEST_FILES   := COPYING
53FUZZER_TIME  := -T90s
54NB_LOOPS     ?= -i1
55
56default: all
57
58all: fullbench fuzzer frametest roundTripTest datagen checkFrame
59
60all32: CFLAGS+=-m32
61all32: all
62
63lz4:
64	$(MAKE) -C $(PRGDIR) $@ CFLAGS="$(CFLAGS)"
65
66lib liblz4.pc:
67	$(MAKE) -C $(LZ4DIR) $@ CFLAGS="$(CFLAGS)"
68
69lz4c unlz4 lz4cat: lz4
70	$(LN_SF) $(LZ4) $(PRGDIR)/$@
71
72lz4c32:   # create a 32-bits version for 32/64 interop tests
73	$(MAKE) -C $(PRGDIR) $@ CFLAGS="-m32 $(CFLAGS)"
74
75%.o : $(LZ4DIR)/%.c $(LZ4DIR)/%.h
76	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
77
78fullbench : DEBUGLEVEL=0
79fullbench : lz4.o lz4hc.o lz4frame.o xxhash.o fullbench.c
80	$(CC) $(FLAGS) $^ -o $@$(EXT)
81
82$(LZ4DIR)/liblz4.a:
83	$(MAKE) -C $(LZ4DIR) liblz4.a
84
85fullbench-lib: fullbench.c $(LZ4DIR)/liblz4.a
86	$(CC) $(FLAGS) $^ -o $@$(EXT)
87
88fullbench-dll: fullbench.c $(LZ4DIR)/xxhash.c
89	$(MAKE) -C $(LZ4DIR) liblz4
90	$(CC) $(FLAGS) $^ -o $@$(EXT) -DLZ4_DLL_IMPORT=1 $(LZ4DIR)/dll/$(LIBLZ4).dll
91
92fuzzer  : lz4.o lz4hc.o xxhash.o fuzzer.c
93	$(CC) $(FLAGS) $^ -o $@$(EXT)
94
95frametest: lz4frame.o lz4.o lz4hc.o xxhash.o frametest.c
96	$(CC) $(FLAGS) $^ -o $@$(EXT)
97
98roundTripTest : lz4.o lz4hc.o xxhash.o roundTripTest.c
99	$(CC) $(FLAGS) $^ -o $@$(EXT)
100
101datagen : $(PRGDIR)/datagen.c datagencli.c
102	$(CC) $(FLAGS) -I$(PRGDIR) $^ -o $@$(EXT)
103
104checkFrame : lz4frame.o lz4.o lz4hc.o xxhash.o checkFrame.c
105	$(CC) $(FLAGS) $^ -o $@$(EXT)
106
107clean:
108	@$(MAKE) -C $(LZ4DIR) $@ > $(VOID)
109	@$(MAKE) -C $(PRGDIR) $@ > $(VOID)
110	@$(RM) -rf core *.o *.test tmp* \
111        fullbench-dll$(EXT) fullbench-lib$(EXT) \
112        fullbench$(EXT) fullbench32$(EXT) \
113        fuzzer$(EXT) fuzzer32$(EXT) \
114        frametest$(EXT) frametest32$(EXT) \
115        fasttest$(EXT) roundTripTest$(EXT) \
116        datagen$(EXT) checkTag$(EXT) \
117        frameTest$(EXT) lz4_all.c
118	@$(RM) -rf $(TESTDIR)
119	@echo Cleaning completed
120
121.PHONY: versionsTest
122versionsTest:
123	$(PYTHON) test-lz4-versions.py
124
125.PHONY: listTest
126listTest: lz4
127	QEMU_SYS=$(QEMU_SYS) $(PYTHON) test-lz4-list.py
128
129checkTag: checkTag.c $(LZ4DIR)/lz4.h
130	$(CC) $(FLAGS) $< -o $@$(EXT)
131
132#-----------------------------------------------------------------------------
133# validated only for Linux, OSX, BSD, Hurd and Solaris targets
134#-----------------------------------------------------------------------------
135ifeq ($(POSIX_ENV),Yes)
136
137MD5:=md5sum
138ifneq (,$(filter $(shell uname), Darwin ))
139MD5:=md5 -r
140endif
141
142# note : we should probably settle on a single compare utility
143CMP:=cmp
144DIFF:=diff
145ifneq (,$(filter $(shell uname),SunOS))
146DIFF:=gdiff
147endif
148
149DD:=dd
150
151.PHONY: list
152list:
153	@$(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
154
155.PHONY: test
156test: test-lz4 test-lz4c test-frametest test-fullbench test-fuzzer test-install test-amalgamation listTest
157
158.PHONY: test32
159test32: CFLAGS+=-m32
160test32: test
161
162test-amalgamation: lz4_all.o
163
164lz4_all.o: lz4_all.c
165	$(CC) $(CFLAGS) $(CPPFLAGS) -c $^ -o $@
166
167lz4_all.c: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c $(LZ4DIR)/lz4frame.c
168	cat $^ > $@
169
170test-install: lz4 lib liblz4.pc
171	lz4_root=.. ./test_install.sh
172
173test-lz4-sparse: lz4 datagen
174	@echo "\n ---- test sparse file support ----"
175	./datagen -g5M  -P100 > tmplsdg5M
176	$(LZ4) -B4D tmplsdg5M -c | $(LZ4) -dv --sparse > tmplscB4
177	$(DIFF) -s tmplsdg5M tmplscB4
178	$(LZ4) -B5D tmplsdg5M -c | $(LZ4) -dv --sparse > tmplscB5
179	$(DIFF) -s tmplsdg5M tmplscB5
180	$(LZ4) -B6D tmplsdg5M -c | $(LZ4) -dv --sparse > tmplscB6
181	$(DIFF) -s tmplsdg5M tmplscB6
182	$(LZ4) -B7D tmplsdg5M -c | $(LZ4) -dv --sparse > tmplscB7
183	$(DIFF) -s tmplsdg5M tmplscB7
184	$(LZ4) tmplsdg5M -c | $(LZ4) -dv --no-sparse > tmplsnosparse
185	$(DIFF) -s tmplsdg5M tmplsnosparse
186	ls -ls tmpls*
187	./datagen -s1 -g1200007 -P100 | $(LZ4) | $(LZ4) -dv --sparse > tmplsodd   # Odd size file (to generate non-full last block)
188	./datagen -s1 -g1200007 -P100 | $(DIFF) -s - tmplsodd
189	ls -ls tmplsodd
190	@$(RM) tmpls*
191	@echo "\n Compatibility with Console :"
192	echo "Hello World 1 !" | $(LZ4) | $(LZ4) -d -c
193	echo "Hello World 2 !" | $(LZ4) | $(LZ4) -d | cat
194	echo "Hello World 3 !" | $(LZ4) --no-frame-crc | $(LZ4) -d -c
195	@echo "\n Compatibility with Append :"
196	./datagen -P100 -g1M > tmplsdg1M
197	cat tmplsdg1M tmplsdg1M > tmpls2M
198	$(LZ4) -B5 -v tmplsdg1M tmplsc
199	$(LZ4) -d -v tmplsc tmplsr
200	$(LZ4) -d -v tmplsc -c >> tmplsr
201	ls -ls tmp*
202	$(DIFF) tmpls2M tmplsr
203	@$(RM) tmpls*
204
205test-lz4-contentSize: lz4 datagen
206	@echo "\n ---- test original size support ----"
207	./datagen -g15M > tmplc1
208	$(LZ4) -v tmplc1 -c | $(LZ4) -t
209	$(LZ4) -v --content-size tmplc1 -c | $(LZ4) -d > tmplc2
210	$(DIFF) -s tmplc1 tmplc2
211	@$(RM) tmplc*
212
213test-lz4-frame-concatenation: lz4 datagen
214	@echo "\n ---- test frame concatenation ----"
215	@echo -n > tmp-lfc-empty
216	@echo hi > tmp-lfc-nonempty
217	cat tmp-lfc-nonempty tmp-lfc-empty tmp-lfc-nonempty > tmp-lfc-src
218	$(LZ4) -zq tmp-lfc-empty -c > tmp-lfc-empty.lz4
219	$(LZ4) -zq tmp-lfc-nonempty -c > tmp-lfc-nonempty.lz4
220	cat tmp-lfc-nonempty.lz4 tmp-lfc-empty.lz4 tmp-lfc-nonempty.lz4 > tmp-lfc-concat.lz4
221	$(LZ4) -d tmp-lfc-concat.lz4 -c > tmp-lfc-result
222	$(CMP) tmp-lfc-src tmp-lfc-result
223	@$(RM) tmp-lfc-*
224	@echo frame concatenation test completed
225
226test-lz4-multiple: lz4 datagen
227	@echo "\n ---- test multiple files ----"
228	@./datagen -s1        > tmp-tlm1 2> $(VOID)
229	@./datagen -s2 -g100K > tmp-tlm2 2> $(VOID)
230	@./datagen -s3 -g200K > tmp-tlm3 2> $(VOID)
231	# compress multiple files : one .lz4 per source file
232	$(LZ4) -f -m tmp-tlm*
233	test -f tmp-tlm1.lz4
234	test -f tmp-tlm2.lz4
235	test -f tmp-tlm3.lz4
236	# decompress multiple files : one output file per .lz4
237	mv tmp-tlm1 tmp-tlm1-orig
238	mv tmp-tlm2 tmp-tlm2-orig
239	mv tmp-tlm3 tmp-tlm3-orig
240	$(LZ4) -d -f -m tmp-tlm*.lz4
241	$(CMP) tmp-tlm1 tmp-tlm1-orig   # must be identical
242	$(CMP) tmp-tlm2 tmp-tlm2-orig
243	$(CMP) tmp-tlm3 tmp-tlm3-orig
244	# compress multiple files into stdout
245	cat tmp-tlm1.lz4 tmp-tlm2.lz4 tmp-tlm3.lz4 > tmp-tlm-concat1
246	$(RM) *.lz4
247	$(LZ4) -m tmp-tlm1 tmp-tlm2 tmp-tlm3 -c > tmp-tlm-concat2
248	test ! -f tmp-tlm1.lz4  # must not create .lz4 artefact
249	$(CMP) tmp-tlm-concat1 tmp-tlm-concat2  # must be equivalent
250	# decompress multiple files into stdout
251	$(RM) tmp-tlm-concat1 tmp-tlm-concat2
252	$(LZ4) -f -m tmp-tlm1 tmp-tlm2 tmp-tlm3   # generate .lz4 to decompress
253	cat tmp-tlm1 tmp-tlm2 tmp-tlm3 > tmp-tlm-concat1   # create concatenated reference
254	$(RM) tmp-tlm1 tmp-tlm2 tmp-tlm3
255	$(LZ4) -d -m tmp-tlm1.lz4 tmp-tlm2.lz4 tmp-tlm3.lz4 -c > tmp-tlm-concat2
256	test ! -f tmp-tlm1  # must not create file artefact
257	$(CMP) tmp-tlm-concat1 tmp-tlm-concat2  # must be equivalent
258	# compress multiple files, one of which is absent (must fail)
259	! $(LZ4) -f -m tmp-tlm-concat1 notHere tmp-tlm-concat2  # must fail : notHere not present
260	@$(RM) tmp-tlm*
261
262test-lz4-basic: lz4 datagen unlz4 lz4cat
263	@echo "\n ---- test lz4 basic compression/decompression ----"
264	./datagen -g0       | $(LZ4) -v     | $(LZ4) -t
265	./datagen -g16KB    | $(LZ4) -9     | $(LZ4) -t
266	./datagen -g20KB > tmp-tlb-dg20k
267	$(LZ4) < tmp-tlb-dg20k | $(LZ4) -d > tmp-tlb-dec
268	$(DIFF) -q tmp-tlb-dg20k tmp-tlb-dec
269	$(LZ4) --no-frame-crc < tmp-tlb-dg20k | $(LZ4) -d > tmp-tlb-dec
270	$(DIFF) -q tmp-tlb-dg20k tmp-tlb-dec
271	./datagen           | $(LZ4) -BI    | $(LZ4) -t
272	./datagen -g6M -P99 | $(LZ4) -9BD   | $(LZ4) -t
273	./datagen -g17M     | $(LZ4) -9v    | $(LZ4) -qt
274	./datagen -g33M     | $(LZ4) --no-frame-crc | $(LZ4) -t
275	./datagen -g256MB   | $(LZ4) -vqB4D | $(LZ4) -t
276	@echo "hello world" > tmp-tlb-hw
277	$(LZ4) --rm -f tmp-tlb-hw tmp-tlb-hw.lz4
278	test ! -f tmp-tlb-hw                      # must fail (--rm)
279	test   -f tmp-tlb-hw.lz4
280	$(PRGDIR)/lz4cat tmp-tlb-hw.lz4           # must display hello world
281	test   -f tmp-tlb-hw.lz4
282	$(PRGDIR)/unlz4 --rm tmp-tlb-hw.lz4 tmp-tlb-hw
283	test   -f tmp-tlb-hw
284	test ! -f tmp-tlb-hw.lz4                  # must fail (--rm)
285	test ! -f tmp-tlb-hw.lz4.lz4              # must fail (unlz4)
286	$(PRGDIR)/lz4cat tmp-tlb-hw               # pass-through mode
287	test   -f tmp-tlb-hw
288	test ! -f tmp-tlb-hw.lz4                  # must fail (lz4cat)
289	$(LZ4) tmp-tlb-hw tmp-tlb-hw.lz4          # creates tmp-tlb-hw.lz4
290	$(PRGDIR)/lz4cat < tmp-tlb-hw.lz4 > tmp-tlb3  # checks lz4cat works with stdin (#285)
291	$(DIFF) -q tmp-tlb-hw tmp-tlb3
292	$(PRGDIR)/lz4cat < tmp-tlb-hw > tmp-tlb2      # checks lz4cat works in pass-through mode
293	$(DIFF) -q tmp-tlb-hw tmp-tlb2
294	cp tmp-tlb-hw ./-d
295	$(LZ4) --rm -- -d -d.lz4               # compresses ./d into ./-d.lz4
296	test   -f ./-d.lz4
297	test ! -f ./-d
298	mv ./-d.lz4 ./-z
299	$(LZ4) -d --rm -- -z tmp-tlb4          # uncompresses ./-z into tmp-tlb4
300	test ! -f ./-z
301	$(DIFF) -q tmp-tlb-hw tmp-tlb4
302	$(LZ4) -f tmp-tlb-hw
303	$(LZ4) --list tmp-tlb-hw.lz4           # test --list on valid single-frame file
304	cat tmp-tlb-hw >> tmp-tlb-hw.lz4
305	$(LZ4) -f tmp-tlb-hw.lz4               # uncompress valid frame followed by invalid data
306	$(LZ4) -BX tmp-tlb-hw -c -q | $(LZ4) -tv  # test block checksum
307	# ./datagen -g20KB generates the same file every single time
308	# cannot save output of ./datagen -g20KB as input file to lz4 because the following shell commands are run before ./datagen -g20KB
309	test "$(shell ./datagen -g20KB | $(LZ4) -c --fast | wc -c)" -lt "$(shell ./datagen -g20KB | $(LZ4) -c --fast=9 | wc -c)" # -1 vs -9
310	test "$(shell ./datagen -g20KB | $(LZ4) -c -1 | wc -c)" -lt "$(shell ./datagen -g20KB| $(LZ4) -c --fast=1 | wc -c)" # 1 vs -1
311	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
312	! $(LZ4) -c --fast=0 tmp-tlb-dg20K # lz4 should fail when fast=0
313	! $(LZ4) -c --fast=-1 tmp-tlb-dg20K # lz4 should fail when fast=-1
314	# Test for #596
315	@echo "TEST" > tmp-tlb-test
316	$(LZ4) -m tmp-tlb-test
317	$(LZ4) tmp-tlb-test.lz4 tmp-tlb-test2
318	$(DIFF) -q tmp-tlb-test tmp-tlb-test2
319	@$(RM) tmp-tlb*
320
321
322
323test-lz4-dict: lz4 datagen
324	@echo "\n ---- test lz4 compression/decompression with dictionary ----"
325	./datagen -g16KB > tmp-dict
326	./datagen -g32KB > tmp-dict-sample-32k
327	< tmp-dict-sample-32k $(LZ4) -D tmp-dict | $(LZ4) -dD tmp-dict | diff - tmp-dict-sample-32k
328	./datagen -g128MB > tmp-dict-sample-128m
329	< tmp-dict-sample-128m $(LZ4) -D tmp-dict | $(LZ4) -dD tmp-dict | diff - tmp-dict-sample-128m
330	touch tmp-dict-sample-0
331	< tmp-dict-sample-0 $(LZ4) -D tmp-dict | $(LZ4) -dD tmp-dict | diff - tmp-dict-sample-0
332
333	< tmp-dict-sample-32k $(LZ4) -D tmp-dict-sample-0 | $(LZ4) -dD tmp-dict-sample-0 | diff - tmp-dict-sample-32k
334	< tmp-dict-sample-0 $(LZ4) -D tmp-dict-sample-0 | $(LZ4) -dD tmp-dict-sample-0 | diff - tmp-dict-sample-0
335
336	@echo "\n ---- test lz4 dictionary loading ----"
337	./datagen -g128KB > tmp-dict-data-128KB
338	set -e; \
339	for l in 0 1 4 128 32767 32768 32769 65535 65536 65537 98303 98304 98305 131071 131072 131073; do \
340		./datagen -g$$l > tmp-dict-$$l; \
341		$(DD) if=tmp-dict-$$l of=tmp-dict-$$l-tail bs=1 count=65536 skip=$$((l > 65536 ? l - 65536 : 0)); \
342		< tmp-dict-$$l      $(LZ4) -D stdin tmp-dict-data-128KB -c | $(LZ4) -dD tmp-dict-$$l-tail | $(DIFF) - tmp-dict-data-128KB; \
343		< tmp-dict-$$l-tail $(LZ4) -D stdin tmp-dict-data-128KB -c | $(LZ4) -dD tmp-dict-$$l      | $(DIFF) - tmp-dict-data-128KB; \
344	done
345
346	@$(RM) tmp-dict*
347
348test-lz4-hugefile: lz4 datagen
349	@echo "\n ---- test huge files compression/decompression ----"
350	./datagen -g6GB   | $(LZ4) -vB5D  | $(LZ4) -qt
351	./datagen -g5GB   | $(LZ4) -v4BD  | $(LZ4) -qt
352	# test large file size [2-4] GB
353	@./datagen -g3G -P100 | $(LZ4) -vv | $(LZ4) --decompress --force --sparse - tmphf1
354	@ls -ls tmphf1
355	@./datagen -g3G -P100 | $(LZ4) --quiet --content-size | $(LZ4) --verbose --decompress --force --sparse - tmphf2
356	@ls -ls tmphf2
357	$(DIFF) -s tmphf1 tmphf2
358	@$(RM) tmphf*
359
360test-lz4-testmode: lz4 datagen
361	@echo "\n ---- bench mode ----"
362	$(LZ4) -bi1
363	@echo "\n ---- test mode ----"
364	! ./datagen | $(LZ4) -t
365	! ./datagen | $(LZ4) -tf
366	@echo "\n ---- pass-through mode ----"
367	@echo "Why hello there " > tmp-tlt2.lz4
368	! $(LZ4) -f tmp-tlt2.lz4 > $(VOID)
369	! ./datagen | $(LZ4) -dc  > $(VOID)
370	! ./datagen | $(LZ4) -df > $(VOID)
371	./datagen | $(LZ4) -dcf > $(VOID)
372	@echo "Hello World !" > tmp-tlt1
373	$(LZ4) -dcf tmp-tlt1
374	@echo "from underground..." > tmp-tlt2
375	$(LZ4) -dcfm tmp-tlt1 tmp-tlt2
376	@echo "\n ---- non-existing source ----"
377	! $(LZ4)     file-does-not-exist
378	! $(LZ4) -f  file-does-not-exist
379	! $(LZ4) -t  file-does-not-exist
380	! $(LZ4) -fm file1-dne file2-dne
381	@$(RM) tmp-tlt tmp-tlt1 tmp-tlt2 tmp-tlt2.lz4
382
383test-lz4-opt-parser: lz4 datagen
384	@echo "\n ---- test opt-parser ----"
385	./datagen -g16KB      | $(LZ4) -12      | $(LZ4) -t
386	./datagen -P10        | $(LZ4) -12B4    | $(LZ4) -t
387	./datagen -g256K      | $(LZ4) -12B4D   | $(LZ4) -t
388	./datagen -g512K -P25 | $(LZ4) -12BD    | $(LZ4) -t
389	./datagen -g1M        | $(LZ4) -12B5    | $(LZ4) -t
390	./datagen -g2M -P99   | $(LZ4) -11B4D   | $(LZ4) -t
391	./datagen -g4M        | $(LZ4) -11vq    | $(LZ4) -qt
392	./datagen -g8M        | $(LZ4) -11B4    | $(LZ4) -t
393	./datagen -g16M -P90  | $(LZ4) -11B5    | $(LZ4) -t
394	./datagen -g32M -P10  | $(LZ4) -11B5D   | $(LZ4) -t
395
396test-lz4-essentials : lz4 datagen test-lz4-basic test-lz4-multiple \
397                      test-lz4-frame-concatenation test-lz4-testmode \
398                      test-lz4-contentSize test-lz4-dict
399	@$(RM) tmp*
400
401test-lz4: lz4 datagen test-lz4-essentials test-lz4-opt-parser \
402          test-lz4-sparse test-lz4-hugefile test-lz4-dict
403	@$(RM) tmp*
404
405test-lz4c: lz4c datagen
406	@echo "\n ---- test lz4c variant ----"
407	./datagen -g256MB | $(LZ4)c -l -v    | $(LZ4)c   -t
408
409test-lz4c32: CFLAGS+=-m32
410test-lz4c32: test-lz4
411
412test-interop-32-64: lz4 lz4c32 datagen
413	@echo "\n ---- test interoperability 32-bits -vs- 64 bits ----"
414	./datagen -g16KB  | $(LZ4)c32 -9     | $(LZ4)    -t
415	./datagen -P10    | $(LZ4)    -9B4   | $(LZ4)c32 -t
416	./datagen         | $(LZ4)c32        | $(LZ4)    -t
417	./datagen -g1M    | $(LZ4)    -3B5   | $(LZ4)c32 -t
418	./datagen -g256MB | $(LZ4)c32 -vqB4D | $(LZ4)    -qt
419	./datagen -g1G -P90 | $(LZ4)         | $(LZ4)c32 -t
420	./datagen -g6GB   | $(LZ4)c32 -vq9BD | $(LZ4)    -qt
421
422test-lz4c32-basic: lz4c32 datagen
423	@echo "\n ---- test lz4c32 32-bits version ----"
424	./datagen -g16KB  | $(LZ4)c32 -9     | $(LZ4)c32 -t
425	./datagen         | $(LZ4)c32        | $(LZ4)c32 -t
426	./datagen -g256MB | $(LZ4)c32 -vqB4D | $(LZ4)c32 -qt
427	./datagen -g6GB   | $(LZ4)c32 -vqB5D | $(LZ4)c32 -qt
428
429test-platform:
430	@echo "\n ---- test lz4 $(QEMU_SYS) platform ----"
431	$(QEMU_SYS) ./datagen -g16KB  | $(QEMU_SYS) $(LZ4) -9     | $(QEMU_SYS) $(LZ4) -t
432	$(QEMU_SYS) ./datagen         | $(QEMU_SYS) $(LZ4)        | $(QEMU_SYS) $(LZ4) -t
433	$(QEMU_SYS) ./datagen -g256MB | $(QEMU_SYS) $(LZ4) -vqB4D | $(QEMU_SYS) $(LZ4) -qt
434ifneq ($(QEMU_SYS),qemu-arm-static)
435	$(QEMU_SYS) ./datagen -g3GB   | $(QEMU_SYS) $(LZ4) -vqB5D | $(QEMU_SYS) $(LZ4) -qt
436endif
437
438test-fullbench: fullbench
439	./fullbench --no-prompt $(NB_LOOPS) $(TEST_FILES)
440
441test-fullbench32: CFLAGS += -m32
442test-fullbench32: test-fullbench
443
444test-fuzzer: fuzzer
445	./fuzzer $(FUZZER_TIME)
446
447test-fuzzer32: CFLAGS += -m32
448test-fuzzer32: test-fuzzer
449
450test-frametest: frametest
451	./frametest -v $(FUZZER_TIME)
452
453test-frametest32: CFLAGS += -m32
454test-frametest32: test-frametest
455
456test-mem: lz4 datagen fuzzer frametest fullbench
457	@echo "\n ---- valgrind tests : memory analyzer ----"
458	valgrind --leak-check=yes --error-exitcode=1 ./datagen -g50M > $(VOID)
459	./datagen -g16KB > ftmdg16K
460	valgrind --leak-check=yes --error-exitcode=1 $(LZ4) -9 -BD -f ftmdg16K $(VOID)
461	./datagen -g16KB -s2 > ftmdg16K2
462	./datagen -g16KB -s3 > ftmdg16K3
463	valgrind --leak-check=yes --error-exitcode=1 $(LZ4) --force --multiple ftmdg16K ftmdg16K2 ftmdg16K3
464	./datagen -g7MB > ftmdg7M
465	valgrind --leak-check=yes --error-exitcode=1 $(LZ4) -9 -B5D -f ftmdg7M ftmdg16K2
466	valgrind --leak-check=yes --error-exitcode=1 $(LZ4) -t ftmdg16K2
467	valgrind --leak-check=yes --error-exitcode=1 $(LZ4) -bi1 ftmdg7M
468	valgrind --leak-check=yes --error-exitcode=1 ./fullbench -i1 ftmdg7M ftmdg16K2
469	valgrind --leak-check=yes --error-exitcode=1 $(LZ4) -B4D -f -vq ftmdg7M $(VOID)
470	valgrind --leak-check=yes --error-exitcode=1 $(LZ4) --list -m ftm*.lz4
471	valgrind --leak-check=yes --error-exitcode=1 $(LZ4) --list -m -v ftm*.lz4
472	$(RM) ftm*
473	valgrind --leak-check=yes --error-exitcode=1 ./fuzzer -i64 -t1
474	valgrind --leak-check=yes --error-exitcode=1 ./frametest -i256
475
476test-mem32: lz4c32 datagen
477# unfortunately, valgrind doesn't seem to work with non-native binary...
478
479endif
480