summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Partin <tristan@partin.io>2022-08-16 07:36:48 (GMT)
committerTristan Partin <tristan@partin.io>2022-10-20 04:27:05 (GMT)
commit198e532300f253ada3acac3ab5428ed991adb085 (patch)
treeb5c04cd31e42772751dac47bc6a0780b581b871d
parente312412c60140b3d061526499cef22e5e99d7751 (diff)
downloadlz4-198e532300f253ada3acac3ab5428ed991adb085.zip
lz4-198e532300f253ada3acac3ab5428ed991adb085.tar.gz
lz4-198e532300f253ada3acac3ab5428ed991adb085.tar.bz2
Update Meson build to 1.9.4
Specifically this adds support for the following options: - LZ4_ALIGN_TEST - LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION - LZ4_DISTANCE_MAX - LZ4_FAST_DEC_LOOP - LZ4_FORCE_SW_BITCOUNT - LZ4_FREESTANDING - LZ4_USER_MEMORY_FUNCTIONS - compiling ossfuzz targets - compiling more test targets - registering some tests
-rw-r--r--.github/workflows/ci.yml7
-rw-r--r--contrib/meson/GetLz4LibraryVersion.py (renamed from contrib/meson/meson/GetLz4LibraryVersion.py)0
-rw-r--r--contrib/meson/meson.build10
-rw-r--r--contrib/meson/meson/contrib/gen_manual/meson.build4
-rw-r--r--contrib/meson/meson/lib/meson.build24
-rw-r--r--contrib/meson/meson/meson.build99
-rw-r--r--contrib/meson/meson/ossfuzz/meson.build35
-rw-r--r--contrib/meson/meson/programs/meson.build30
-rw-r--r--contrib/meson/meson/tests/meson.build139
-rw-r--r--contrib/meson/meson_options.txt36
-rw-r--r--tests/Makefile303
-rwxr-xr-xtests/test-lz4-basic.sh73
-rwxr-xr-xtests/test-lz4-contentSize.sh27
-rwxr-xr-xtests/test-lz4-dict.sh35
-rwxr-xr-xtests/test-lz4-fast-hugefile.sh21
-rwxr-xr-xtests/test-lz4-frame-concatenation.sh21
-rwxr-xr-xtests/test-lz4-multiple-legacy.sh49
-rwxr-xr-xtests/test-lz4-multiple.sh58
-rwxr-xr-xtests/test-lz4-opt-parser.sh16
-rwxr-xr-xtests/test-lz4-skippable.sh19
-rwxr-xr-xtests/test-lz4-sparse.sh42
-rwxr-xr-xtests/test-lz4-testmode.sh38
-rwxr-xr-xtests/test-lz4hc-hugefile.sh6
23 files changed, 746 insertions, 346 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index adeaccc..bf8f94c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -695,10 +695,11 @@ jobs:
echo && type python && which python && python --version
echo && type meson && which meson && meson --version
- - name: meson
+ - name: setup
# 'run: >' replaces all newlines in the following block with spaces
run: >
meson setup
+ --fatal-meson-warnings
--buildtype=debug
-Db_lundef=false
-Dauto_features=enabled
@@ -708,6 +709,10 @@ jobs:
-Dexamples=true
contrib/meson build
+ - name: test
+ run: |
+ meson test -C build
+
- name: staging
run: |
cd build
diff --git a/contrib/meson/meson/GetLz4LibraryVersion.py b/contrib/meson/GetLz4LibraryVersion.py
index d8abfcb..d8abfcb 100644
--- a/contrib/meson/meson/GetLz4LibraryVersion.py
+++ b/contrib/meson/GetLz4LibraryVersion.py
diff --git a/contrib/meson/meson.build b/contrib/meson/meson.build
index 39672c8..fc6408a 100644
--- a/contrib/meson/meson.build
+++ b/contrib/meson/meson.build
@@ -13,15 +13,19 @@
project(
'lz4',
- ['c'],
+ 'c',
license: 'BSD-2-Clause-Patent AND GPL-2.0-or-later',
default_options: [
'c_std=c99',
'buildtype=release',
'warning_level=3'
],
- version: 'DUMMY',
- meson_version: '>=0.49.0'
+ version: run_command(
+ find_program('GetLz4LibraryVersion.py'),
+ '../../lib/lz4.h',
+ check: true
+ ).stdout().strip(),
+ meson_version: '>=0.58.0'
)
subdir('meson')
diff --git a/contrib/meson/meson/contrib/gen_manual/meson.build b/contrib/meson/meson/contrib/gen_manual/meson.build
index 84a95a9..c4349aa 100644
--- a/contrib/meson/meson/contrib/gen_manual/meson.build
+++ b/contrib/meson/meson/contrib/gen_manual/meson.build
@@ -10,7 +10,7 @@
lz4_source_root = '../../../../..'
-add_languages('cpp')
+add_languages('cpp', native: true)
sources = files(
lz4_source_root / 'contrib/gen_manual/gen_manual.cpp'
@@ -33,7 +33,7 @@ foreach mp : manual_pages
output: '@0@_manual.html'.format(mp),
command: [
gen_manual,
- lz4_version,
+ meson.project_version(),
'@INPUT@',
'@OUTPUT@',
],
diff --git a/contrib/meson/meson/lib/meson.build b/contrib/meson/meson/lib/meson.build
index 469cd09..f37eec2 100644
--- a/contrib/meson/meson/lib/meson.build
+++ b/contrib/meson/meson/lib/meson.build
@@ -17,33 +17,32 @@ sources = files(
lz4_source_root / 'lib/xxhash.c'
)
+if get_option('unstable')
+ sources += files(lz4_source_root / 'lib/lz4file.c')
+endif
+
c_args = []
if host_machine.system() == 'windows' and get_option('default_library') != 'static'
c_args += '-DLZ4_DLL_EXPORT=1'
endif
-if get_option('unstable')
- compile_args += '-DLZ4_STATIC_LINKING_ONLY'
- if get_option('default_library') != 'static'
- c_args += '-DLZ4_PUBLISH_STATIC_FUNCTIONS'
- endif
-endif
-
liblz4 = library(
'lz4',
sources,
+ c_args: c_args,
install: true,
- version: lz4_version,
+ version: meson.project_version(),
gnu_symbol_visibility: 'hidden'
)
liblz4_dep = declare_dependency(
link_with: liblz4,
+ compile_args: compile_args,
include_directories: include_directories(lz4_source_root / 'lib')
)
-if get_option('tests') or get_option('programs') or get_option('examples')
+if get_option('tests') or get_option('programs') or get_option('examples') or get_option('ossfuzz')
liblz4_internal = static_library(
'lz4-internal',
objects: liblz4.extract_all_objects(recursive: true),
@@ -52,6 +51,7 @@ if get_option('tests') or get_option('programs') or get_option('examples')
liblz4_internal_dep = declare_dependency(
link_with: liblz4_internal,
+ compile_args: compile_args,
include_directories: include_directories(lz4_source_root / 'lib')
)
endif
@@ -61,7 +61,7 @@ pkgconfig.generate(
name: 'lz4',
filebase: 'liblz4',
description: 'extremely fast lossless compression algorithm library',
- version: lz4_version,
+ version: meson.project_version(),
url: 'http://www.lz4.org/'
)
@@ -74,3 +74,7 @@ install_headers(
if get_option('default_library') != 'shared'
install_headers(lz4_source_root / 'lib/lz4frame_static.h')
endif
+
+if get_option('unstable')
+ install_headers(lz4_source_root / 'lib/lz4file.h')
+endif
diff --git a/contrib/meson/meson/meson.build b/contrib/meson/meson/meson.build
index 9e8b8c6..3bea06d 100644
--- a/contrib/meson/meson/meson.build
+++ b/contrib/meson/meson/meson.build
@@ -10,48 +10,103 @@
cc = meson.get_compiler('c')
+fs = import('fs')
pkgconfig = import('pkgconfig')
lz4_source_root = '../../..'
-lz4_version = meson.project_version()
-
-lz4_h_file = lz4_source_root / 'lib/lz4.h'
-GetLz4LibraryVersion_py = find_program('GetLz4LibraryVersion.py')
-lz4_version = run_command(GetLz4LibraryVersion_py, lz4_h_file, check: true).stdout().strip()
-message('Project version is now: @0@'.format(lz4_version))
-
add_project_arguments('-DXXH_NAMESPACE=LZ4_', language: 'c')
if get_option('debug')
- add_project_arguments(cc.get_supported_arguments([
- '-Wcast-qual',
- '-Wcast-align',
- '-Wshadow',
- '-Wswitch-enum',
- '-Wdeclaration-after-statement',
- '-Wstrict-prototypes',
- '-Wundef',
- '-Wpointer-arith',
- '-Wstrict-aliasing=1',
- '-DLZ4_DEBUG=@0@'.format(get_option('debug-level')),
- ]
+ add_project_arguments(cc.get_supported_arguments(
+ '-Wcast-qual',
+ '-Wcast-align',
+ '-Wshadow',
+ '-Wswitch-enum',
+ '-Wdeclaration-after-statement',
+ '-Wstrict-prototypes',
+ '-Wundef',
+ '-Wpointer-arith',
+ '-Wstrict-aliasing=1',
+ '-DLZ4_DEBUG=@0@'.format(get_option('debug-level'))
+ ),
+ language: 'c'
+ )
+endif
+
+compile_args = []
+
+if not get_option('align-test')
+ add_project_arguments('-DLZ4_ALIGN_TEST=0', language: 'c')
+endif
+
+if get_option('disable-memory-allocation')
+ if get_option('default_library') != 'static'
+ error('Memory allocation can only be disabled in static builds')
+ endif
+
+ add_project_arguments('-DLZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION')
+ compile_args += '-DLZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION'
+endif
+
+add_project_arguments(
+ '-DLZ4_DISTANCE_MAX=@0@'.format(get_option('distance-max')),
+ language: 'c'
+)
+compile_args += '-DLZ4_DISTANCE_MAX=@0@'.format(get_option('distance-max'))
+
+if not get_option('fast-dec-loop').auto()
+ add_project_arguments(
+ '-DLZ4_FAST_DEC_LOOP=@0@'.format(
+ get_option('fast-dec-loop').enabled() ? 1 : 0
),
- language: 'c',
+ language: 'c'
)
endif
+if get_option('force-sw-bitcount')
+ add_project_arguments('-DLZ4_FORCE_SW_BITCOUNT', language: 'c')
+endif
+
+if get_option('freestanding')
+ add_project_arguments('-DLZ4_FREESTANDING=1', language: 'c')
+ compile_args += '-DLZ4_FREESTANDING=1'
+endif
+
if get_option('memory-usage') > 0
add_project_arguments(
'-DLZ4_MEMORY_USAGE=@0@'.format(get_option('memory-usage')),
language: 'c'
)
+ compile_args += '-DLZ4_MEMORY_USAGE=@0@'.format(get_option('memory-usage'))
+endif
+
+if get_option('unstable')
+ add_project_arguments('-DLZ4_STATIC_LINKING_ONLY', language: 'c')
+ compile_args += '-DLZ4_STATIC_LINKING_ONLY'
+ if get_option('default_library') != 'static'
+ add_project_arguments('-DLZ4_PUBLISH_STATIC_FUNCTIONS', language: 'c')
+ compile_args += '-DLZ4_PUBLISH_STATIC_FUNCTIONS'
+
+ add_project_arguments('-DLZ4F_PUBLISH_STATIC_FUNCTIONS', language: 'c')
+ compile_args += '-DLZ4F_PUBLISH_STATIC_FUNCTIONS'
+ endif
+endif
+
+if get_option('user-memory-functions')
+ add_project_arguments('-DLZ4_USER_MEMORY_FUNCTIONS', language: 'c')
endif
+run_env = environment()
+
subdir('lib')
if get_option('programs')
subdir('programs')
+else
+ lz4 = disabler()
+ lz4cat = disabler()
+ unlz4 = disabler()
endif
if get_option('tests')
@@ -65,3 +120,7 @@ endif
if get_option('examples')
subdir('examples')
endif
+
+if get_option('ossfuzz')
+ subdir('ossfuzz')
+endif
diff --git a/contrib/meson/meson/ossfuzz/meson.build b/contrib/meson/meson/ossfuzz/meson.build
new file mode 100644
index 0000000..9945d8c
--- /dev/null
+++ b/contrib/meson/meson/ossfuzz/meson.build
@@ -0,0 +1,35 @@
+fuzzers = [
+ 'compress_frame_fuzzer',
+ 'compress_fuzzer',
+ 'compress_hc_fuzzer',
+ 'decompress_frame_fuzzer',
+ 'decompress_fuzzer',
+ 'round_trip_frame_uncompressed_fuzzer',
+ 'round_trip_fuzzer',
+ 'round_trip_hc_fuzzer',
+ 'round_trip_stream_fuzzer'
+]
+
+c_args = cc.get_supported_arguments(
+ '-Wno-unused-function',
+ '-Wno-sign-compare',
+ '-Wno-declaration-after-statement'
+)
+
+foreach f : fuzzers
+ lib = static_library(
+ f,
+ lz4_source_root / 'ossfuzz/@0@.c'.format(f),
+ lz4_source_root / 'ossfuzz/lz4_helpers.c',
+ lz4_source_root / 'ossfuzz/fuzz_data_producer.c',
+ c_args: c_args,
+ dependencies: [liblz4_internal_dep]
+ )
+
+ executable(
+ f,
+ lz4_source_root / 'ossfuzz/standaloneengine.c',
+ link_with: lib,
+ dependencies: [liblz4_internal_dep]
+ )
+endforeach
diff --git a/contrib/meson/meson/programs/meson.build b/contrib/meson/meson/programs/meson.build
index f9d5bf1..a8bc18a 100644
--- a/contrib/meson/meson/programs/meson.build
+++ b/contrib/meson/meson/programs/meson.build
@@ -26,6 +26,36 @@ lz4 = executable(
install: true
)
+lz4cat = custom_target(
+ 'lz4cat',
+ input: lz4,
+ output: 'lz4cat',
+ command: [
+ 'ln',
+ '--symbolic',
+ '--force',
+ fs.name(lz4.full_path()),
+ '@OUTPUT@'
+ ]
+)
+
+unlz4 = custom_target(
+ 'unlz4',
+ input: lz4,
+ output: 'unlz4',
+ command: [
+ 'ln',
+ '--symbolic',
+ '--force',
+ fs.name(lz4.full_path()),
+ '@OUTPUT@'
+ ]
+)
+
+meson.override_find_program('lz4', lz4)
+
+run_env.prepend('PATH', meson.current_build_dir())
+
install_man(lz4_source_root / 'programs/lz4.1')
if meson.version().version_compare('>=0.61.0')
diff --git a/contrib/meson/meson/tests/meson.build b/contrib/meson/meson/tests/meson.build
index 18479e4..71db2e6 100644
--- a/contrib/meson/meson/tests/meson.build
+++ b/contrib/meson/meson/tests/meson.build
@@ -10,43 +10,148 @@
lz4_source_root = '../../../..'
-exes = {
- 'fullbench': {
- 'sources': files(lz4_source_root / 'tests/fullbench.c'),
+fuzzer_time = 90
+test_exes = {
+ 'abiTest': {
+ 'sources': files(lz4_source_root / 'tests/abiTest.c'),
+ 'test': false,
+ },
+ 'checkFrame': {
+ 'sources': files(lz4_source_root / 'tests/checkFrame.c'),
'include_directories': include_directories(lz4_source_root / 'programs'),
},
- 'fuzzer': {
- 'sources': files(lz4_source_root / 'tests/fuzzer.c'),
+ 'checkTag': {
+ 'sources': files(lz4_source_root / 'tests/checkTag.c'),
+ 'test': false,
+ },
+ 'datagen': {
+ 'sources': files(lz4_source_root / 'tests/datagencli.c'),
+ 'objects': lz4.extract_objects(lz4_source_root / 'programs/datagen.c'),
'include_directories': include_directories(lz4_source_root / 'programs'),
},
+ 'decompress-partial-usingDict.c': {
+ 'sources': files(lz4_source_root / 'tests/decompress-partial-usingDict.c'),
+ },
+ 'decompress-partial.c': {
+ 'sources': files(lz4_source_root / 'tests/decompress-partial.c'),
+ },
'frametest': {
'sources': files(lz4_source_root / 'tests/frametest.c'),
'include_directories': include_directories(lz4_source_root / 'programs'),
+ 'args': ['-v', '-T@0@s'.format(fuzzer_time)],
+ 'test': false,
},
- 'roundTripTest': {
- 'sources': files(lz4_source_root / 'tests/roundTripTest.c'),
+ 'freestanding': {
+ 'sources': files(lz4_source_root / 'tests/freestanding.c'),
+ 'c_args': ['-ffreestanding', '-Wno-unused-parameter', '-Wno-declaration-after-statement'],
+ 'link_args': ['-nostdlib'],
+ 'build': cc.get_id() in ['gcc', 'clang'],
+ 'override_options': ['optimization=1']
},
- 'datagen': {
- 'sources': files(lz4_source_root / 'tests/datagencli.c'),
- 'objects': lz4.extract_objects(lz4_source_root / 'programs/datagen.c'),
+ 'fullbench': {
+ 'sources': files(lz4_source_root / 'tests/fullbench.c'),
'include_directories': include_directories(lz4_source_root / 'programs'),
+ 'args': ['--no-prompt', '-i1', files(lz4_source_root / 'tests/COPYING')],
+ 'test': false,
},
- 'checkFrame': {
- 'sources': files(lz4_source_root / 'tests/checkFrame.c'),
+ 'fuzzer': {
+ 'sources': files(lz4_source_root / 'tests/fuzzer.c'),
'include_directories': include_directories(lz4_source_root / 'programs'),
+ 'args': ['-T@0@s'.format(fuzzer_time)],
+ 'test': false,
},
- 'checkTag': {
- 'sources': files(lz4_source_root / 'tests/checkTag.c'),
+ 'roundTripTest': {
+ 'sources': files(lz4_source_root / 'tests/roundTripTest.c'),
+ 'test': false,
},
}
-foreach e, attrs : exes
- executable(
+targets = {}
+
+foreach e, attrs : test_exes
+ if not attrs.get('build', true)
+ targets += {e: disabler()}
+ continue
+ endif
+
+ t = executable(
e,
attrs.get('sources'),
+ c_args: attrs.get('c_args', []),
+ link_args: attrs.get('link_args', []),
objects: attrs.get('objects', []),
dependencies: [liblz4_internal_dep],
include_directories: attrs.get('include_directories', []),
- install: false
+ install: false,
+ override_options: attrs.get('override_options', [])
+ )
+
+ targets += {e: t}
+
+ if not attrs.get('test', true)
+ continue
+ endif
+
+ test(
+ e,
+ t,
+ args: attrs.get('params', []),
+ timeout: 120
+ )
+endforeach
+
+fs = import('fs')
+
+run_env.prepend('PATH', meson.current_build_dir())
+
+test_scripts = {
+ 'lz4-basic': {
+ 'depends': [lz4, lz4cat, unlz4, targets['datagen']],
+ },
+ 'lz4-dict': {
+ 'depends': [lz4, targets['datagen']],
+ },
+ 'lz4-contentSize': {
+ 'depends': [lz4, targets['datagen']],
+ },
+ 'lz4-fast-hugefile': {
+ 'depends': [lz4, targets['datagen']],
+ },
+ 'lz4-frame-concatenation': {
+ 'depends': [lz4, targets['datagen']],
+ },
+ 'lz4-multiple': {
+ 'depends': [lz4, targets['datagen']],
+ },
+ 'lz4-multiple-legacy': {
+ 'depends': [lz4, targets['datagen']],
+ },
+ 'lz4-opt-parser': {
+ 'depends': [lz4, targets['datagen']],
+ },
+ 'lz4-skippable': {
+ 'depends': [lz4],
+ },
+ 'lz4-sparse': {
+ 'depends': [lz4, targets['datagen']],
+ },
+ 'lz4-testmode': {
+ 'depends': [lz4, targets['datagen']],
+ },
+ 'lz4hc-hugefile': {
+ 'depends': [lz4, targets['datagen']],
+ },
+}
+
+foreach s, attrs : test_scripts
+ script = find_program(lz4_source_root / 'tests/test-@0@.sh'.format(s))
+
+ test(
+ '@0@'.format(s),
+ script,
+ depends: attrs.get('depends', []),
+ workdir: fs.parent(script.full_path()),
+ env: run_env,
+ timeout: 360
)
endforeach
diff --git a/contrib/meson/meson_options.txt b/contrib/meson/meson_options.txt
index ccb32de..36eedbb 100644
--- a/contrib/meson/meson_options.txt
+++ b/contrib/meson/meson_options.txt
@@ -8,17 +8,33 @@
# in the COPYING file in the root directory of this source tree).
# #############################################################################
+option('align-test', type: 'boolean', value: true,
+ description: 'See LZ4_ALIGN_TEST')
+option('contrib', type: 'boolean', value: false,
+ description: 'Enable contrib')
option('debug-level', type: 'integer', min: 0, max: 7, value: 1,
description: 'Enable run-time debug. See lib/lz4hc.c')
-option('unstable', type: 'boolean', value: false,
- description: 'Expose unstable interfaces')
-option('programs', type: 'boolean', value: false,
- description: 'Enable programs build')
-option('tests', type: 'boolean', value: false,
- description: 'Enable tests build')
-option('contrib', type: 'boolean', value: false,
- description: 'Enable contrib build')
+option('disable-memory-allocation', type: 'boolean', value: false,
+ description: 'See LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION. Static builds only')
+option('distance-max', type: 'integer', min: 0, max: 65535, value: 65535,
+ description: 'See LZ4_DISTANCE_MAX')
option('examples', type: 'boolean', value: false,
- description: 'Enable examples build')
-option('memory-usage', type: 'integer', min: 0, value: 0,
+ description: 'Enable examples')
+option('fast-dec-loop', type: 'feature', value: 'auto',
+ description: 'See LZ4_FAST_DEC_LOOP')
+option('force-sw-bitcount', type: 'boolean', value: false,
+ description: 'See LZ4_FORCE_SW_BITCOUNT')
+option('freestanding', type: 'boolean', value: false,
+ description: 'See LZ4_FREESTANDING')
+option('memory-usage', type: 'integer', min: 0, max: 20, value: 0,
description: 'See LZ4_MEMORY_USAGE. 0 means use the LZ4 default')
+option('ossfuzz', type: 'boolean', value: true,
+ description: 'Enable ossfuzz')
+option('programs', type: 'boolean', value: false,
+ description: 'Enable programs')
+option('tests', type: 'boolean', value: false,
+ description: 'Enable tests')
+option('unstable', type: 'boolean', value: false,
+ description: 'Expose unstable interfaces')
+option('user-memory-functions', type: 'boolean', value: false,
+ description: 'See LZ4_USER_MEMORY_FUNCTIONS')
diff --git a/tests/Makefile b/tests/Makefile
index 85bf495..b446e4e 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -173,6 +173,7 @@ endif
CAT:=cat
DD:=dd
DATAGEN:=./datagen
+PATH:=../programs:$(shell pwd):$(PATH)
.PHONY: list
list:
@@ -211,319 +212,55 @@ test-compile-with-lz4-memory-usage:
# All FPREFIX must start with `tmp`, for `make clean`
# All tests must clean their temporary test files on successful completion,
# and only their test files : do not employ sweeping statements such `rm tmp*` or `rm *.lz4`
-test-lz4-sparse: FPREFIX = tmp-tls
test-lz4-sparse: lz4 datagen
@echo "\n ---- test sparse file support ----"
- $(DATAGEN) -g5M -P100 > $(FPREFIX)dg5M
- $(LZ4) -B4D $(FPREFIX)dg5M -c | $(LZ4) -dv --sparse > $(FPREFIX)cB4
- $(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)cB4
- $(LZ4) -B5D $(FPREFIX)dg5M -c | $(LZ4) -dv --sparse > $(FPREFIX)cB5
- $(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)cB5
- $(LZ4) -B6D $(FPREFIX)dg5M -c | $(LZ4) -dv --sparse > $(FPREFIX)cB6
- $(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)cB6
- $(LZ4) -B7D $(FPREFIX)dg5M -c | $(LZ4) -dv --sparse > $(FPREFIX)cB7
- $(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)cB7
- $(LZ4) $(FPREFIX)dg5M -c | $(LZ4) -dv --no-sparse > $(FPREFIX)nosparse
- $(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)nosparse
- ls -ls $(FPREFIX)*
- $(DATAGEN) -s1 -g1200007 -P100 | $(LZ4) | $(LZ4) -dv --sparse > $(FPREFIX)odd # Odd size file (to generate non-full last block)
- $(DATAGEN) -s1 -g1200007 -P100 | $(DIFF) -s - $(FPREFIX)odd
- ls -ls $(FPREFIX)odd
- @$(RM) $(FPREFIX)*
- @echo "\n Compatibility with Console :"
- echo "Hello World 1 !" | $(LZ4) | $(LZ4) -d -c
- echo "Hello World 2 !" | $(LZ4) | $(LZ4) -d | $(CAT)
- echo "Hello World 3 !" | $(LZ4) --no-frame-crc | $(LZ4) -d -c
- @echo "\n Compatibility with Append :"
- $(DATAGEN) -P100 -g1M > $(FPREFIX)dg1M
- $(CAT) $(FPREFIX)dg1M $(FPREFIX)dg1M > $(FPREFIX)2M
- $(LZ4) -B5 -v $(FPREFIX)dg1M $(FPREFIX)c
- $(LZ4) -d -v $(FPREFIX)c $(FPREFIX)r
- $(LZ4) -d -v $(FPREFIX)c -c >> $(FPREFIX)r
- ls -ls $(FPREFIX)*
- $(DIFF) $(FPREFIX)2M $(FPREFIX)r
- @$(RM) $(FPREFIX)*
-
-test-lz4-contentSize: FPREFIX = tmp-lzc
+ PATH=$(PATH) ./test-lz4-sparse.sh
+
test-lz4-contentSize: lz4 datagen
@echo "\n ---- test original size support ----"
- $(DATAGEN) -g15M > $(FPREFIX)
- $(LZ4) -v $(FPREFIX) -c | $(LZ4) -t
- $(LZ4) -v --content-size $(FPREFIX) -c | $(LZ4) -d > $(FPREFIX)-dup
- $(DIFF) $(FPREFIX) $(FPREFIX)-dup
- $(LZ4) -f $(FPREFIX) -c > $(FPREFIX).lz4 # compressed with content size
- $(LZ4) --content-size $(FPREFIX) -c > $(FPREFIX)-wcz.lz4
- ! $(DIFF) $(FPREFIX).lz4 $(FPREFIX)-wcz.lz4 # must differ, due to content size
- $(LZ4) --content-size < $(FPREFIX) > $(FPREFIX)-wcz2.lz4 # can determine content size because stdin is just a file
- $(DIFF) $(FPREFIX)-wcz.lz4 $(FPREFIX)-wcz2.lz4 # both must contain content size
- $(CAT) $(FPREFIX) | $(LZ4) > $(FPREFIX)-ncz.lz4
- $(DIFF) $(FPREFIX).lz4 $(FPREFIX)-ncz.lz4 # both don't have content size
- $(CAT) $(FPREFIX) | $(LZ4) --content-size > $(FPREFIX)-ncz2.lz4 # can't determine content size
- $(DIFF) $(FPREFIX).lz4 $(FPREFIX)-ncz2.lz4 # both don't have content size
- @$(RM) $(FPREFIX)*
-
-test-lz4-frame-concatenation: FPREFIX = tmp-lfc
+ PATH=$(PATH) ./test-lz4-contentSize.sh
+
test-lz4-frame-concatenation: lz4 datagen
@echo "\n ---- test frame concatenation ----"
- @echo -n > $(FPREFIX)-empty
- @echo hi > $(FPREFIX)-nonempty
- $(CAT) $(FPREFIX)-nonempty $(FPREFIX)-empty $(FPREFIX)-nonempty > $(FPREFIX)-src
- $(LZ4) -zq $(FPREFIX)-empty -c > $(FPREFIX)-empty.lz4
- $(LZ4) -zq $(FPREFIX)-nonempty -c > $(FPREFIX)-nonempty.lz4
- $(CAT) $(FPREFIX)-nonempty.lz4 $(FPREFIX)-empty.lz4 $(FPREFIX)-nonempty.lz4 > $(FPREFIX)-concat.lz4
- $(LZ4) -d $(FPREFIX)-concat.lz4 -c > $(FPREFIX)-result
- $(CMP) $(FPREFIX)-src $(FPREFIX)-result
- @$(RM) $(FPREFIX)*
- @echo frame concatenation test completed
-
-test-lz4-multiple: FPREFIX = tmp-tml
+ PATH=$(PATH) ./test-lz4-frame-concatenation.sh
+
test-lz4-multiple: lz4 datagen
@echo "\n ---- test multiple files ----"
- @$(DATAGEN) -s1 > $(FPREFIX)1 2> $(VOID)
- @$(DATAGEN) -s2 -g100K > $(FPREFIX)2 2> $(VOID)
- @$(DATAGEN) -s3 -g200K > $(FPREFIX)3 2> $(VOID)
- # compress multiple files : one .lz4 per source file
- $(LZ4) -f -m $(FPREFIX)*
- test -f $(FPREFIX)1.lz4
- test -f $(FPREFIX)2.lz4
- test -f $(FPREFIX)3.lz4
- # decompress multiple files : one output file per .lz4
- mv $(FPREFIX)1 $(FPREFIX)1-orig
- mv $(FPREFIX)2 $(FPREFIX)2-orig
- mv $(FPREFIX)3 $(FPREFIX)3-orig
- $(LZ4) -d -f -m $(FPREFIX)*.lz4
- $(CMP) $(FPREFIX)1 $(FPREFIX)1-orig # must be identical
- $(CMP) $(FPREFIX)2 $(FPREFIX)2-orig
- $(CMP) $(FPREFIX)3 $(FPREFIX)3-orig
- # compress multiple files into stdout
- $(CAT) $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 > $(FPREFIX)-concat1
- $(RM) $(FPREFIX)*.lz4
- $(LZ4) -m $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 -c > $(FPREFIX)-concat2
- test ! -f $(FPREFIX)1.lz4 # must not create .lz4 artefact
- $(CMP) $(FPREFIX)-concat1 $(FPREFIX)-concat2 # must be equivalent
- # decompress multiple files into stdout
- $(RM) $(FPREFIX)-concat1 $(FPREFIX)-concat2
- $(LZ4) -f -m $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 # generate .lz4 to decompress
- $(CAT) $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 > $(FPREFIX)-concat1 # create concatenated reference
- $(RM) $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3
- $(LZ4) -d -m $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 -c > $(FPREFIX)-concat2
- test ! -f $(FPREFIX)1 # must not create file artefact
- $(CMP) $(FPREFIX)-concat1 $(FPREFIX)-concat2 # must be equivalent
- # compress multiple files, one of which is absent (must fail)
- ! $(LZ4) -f -m $(FPREFIX)-concat1 notHere $(FPREFIX)-concat2 # must fail : notHere not present
- # test lz4-compressed file
- $(RM) $(FPREFIX)-concat1 $(FPREFIX)-concat2
- $(LZ4) -tm $(FPREFIX)-concat1.lz4
- # ensure the test doesn't create artifact
- test ! -f $(FPREFIX)-concat1 # must not create file artefact
- # test multiple lz4-compressed file
- $(LZ4) -tm $(FPREFIX)-concat1.lz4 $(FPREFIX)-concat2.lz4
- test ! -f $(FPREFIX)-concat1 # must not create file artefact
- test ! -f $(FPREFIX)-concat2 # must not create file artefact
- # test multiple lz4 files, one of which is absent (must fail)
- ! $(LZ4) -tm $(FPREFIX)-concat1.lz4 notHere.lz4 $(FPREFIX)-concat2.lz4
- @$(RM) $(FPREFIX)*
-
-test-lz4-multiple-legacy: FPREFIX = tmp-lml
+ PATH=$(PATH) ./test-lz4-multiple.sh
+
test-lz4-multiple-legacy: lz4 datagen
@echo "\n ---- test multiple files (Legacy format) ----"
- @$(DATAGEN) -s1 > $(FPREFIX)1 2> $(VOID)
- @$(DATAGEN) -s2 -g100K > $(FPREFIX)2 2> $(VOID)
- @$(DATAGEN) -s3 -g200K > $(FPREFIX)3 2> $(VOID)
- # compress multiple files using legacy format: one .lz4 per source file
- $(LZ4) -f -l -m $(FPREFIX)*
- test -f $(FPREFIX)1.lz4
- test -f $(FPREFIX)2.lz4
- test -f $(FPREFIX)3.lz4
- # decompress multiple files compressed using legacy format: one output file per .lz4
- mv $(FPREFIX)1 $(FPREFIX)1-orig
- mv $(FPREFIX)2 $(FPREFIX)2-orig
- mv $(FPREFIX)3 $(FPREFIX)3-orig
- $(LZ4) -d -f -m $(FPREFIX)*.lz4
- $(LZ4) -l -d -f -m $(FPREFIX)*.lz4 # -l mustn't impact -d option
- $(CMP) $(FPREFIX)1 $(FPREFIX)1-orig # must be identical
- $(CMP) $(FPREFIX)2 $(FPREFIX)2-orig
- $(CMP) $(FPREFIX)3 $(FPREFIX)3-orig
- # compress multiple files into stdout using legacy format
- $(CAT) $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 > $(FPREFIX)-concat1
- $(RM) $(FPREFIX)*.lz4
- $(LZ4) -l -m $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 -c > $(FPREFIX)-concat2
- test ! -f $(FPREFIX)1.lz4 # must not create .lz4 artefact
- $(CMP) $(FPREFIX)-concat1 $(FPREFIX)-concat2 # must be equivalent
- # # # decompress multiple files into stdout using legacy format
- $(RM) $(FPREFIX)-concat1 $(FPREFIX)-concat2
- $(LZ4) -l -f -m $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 # generate .lz4 to decompress
- $(CAT) $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 > $(FPREFIX)-concat1 # create concatenated reference
- $(RM) $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3
- $(LZ4) -d -m $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 -c > $(FPREFIX)-concat2
- $(LZ4) -d -l -m $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 -c > $(FPREFIX)-concat2 # -l mustn't impact option -d
- test ! -f $(FPREFIX)1 # must not create file artefact
- $(CMP) $(FPREFIX)-concat1 $(FPREFIX)-concat2 # must be equivalent
- # # # compress multiple files, one of which is absent (must fail)
- ! $(LZ4) -f -l -m $(FPREFIX)-concat1 notHere-legacy $(FPREFIX)-concat2 # must fail : notHere-legacy not present
- @$(RM) $(FPREFIX)*
-
-SKIPFILE = goldenSamples/skip.bin
-test-lz4-skippable: FPREFIX = tmp-lsk
-test-lz4-skippable: lz4 datagen
+ PATH=$(PATH) ./test-lz4-multiple-legacy.sh
+
+test-lz4-skippable: lz4
@echo "\n ---- test lz4 with skippable frames ----"
- $(LZ4) -dc $(SKIPFILE)
- $(LZ4) -dc < $(SKIPFILE)
- cat $(SKIPFILE) | $(LZ4) -dc
- echo "Hello from Valid Frame!\n" | $(LZ4) -c > $(FPREFIX).lz4
- cat $(SKIPFILE) $(FPREFIX).lz4 $(SKIPFILE) | $(LZ4) -dc
- $(RM) $(FPREFIX)*
+ PATH=$(PATH) ./test-lz4-skippable.sh
-test-lz4-basic: FPREFIX = tmp-tlb
test-lz4-basic: lz4 datagen unlz4 lz4cat
@echo "\n ---- test lz4 basic compression/decompression ----"
- $(DATAGEN) -g0 | $(LZ4) -v | $(LZ4) -t
- $(DATAGEN) -g16KB | $(LZ4) -9 | $(LZ4) -t
- $(DATAGEN) -g20KB > $(FPREFIX)-dg20k
- $(LZ4) < $(FPREFIX)-dg20k | $(LZ4) -d > $(FPREFIX)-dec
- $(DIFF) -q $(FPREFIX)-dg20k $(FPREFIX)-dec
- $(LZ4) --no-frame-crc < $(FPREFIX)-dg20k | $(LZ4) -d > $(FPREFIX)-dec
- $(DIFF) -q $(FPREFIX)-dg20k $(FPREFIX)-dec
- $(DATAGEN) | $(LZ4) -BI | $(LZ4) -t
- $(DATAGEN) | $(LZ4) --no-crc | $(LZ4) -t
- $(DATAGEN) -g6M -P99 | $(LZ4) -9BD | $(LZ4) -t
- $(DATAGEN) -g17M | $(LZ4) -9v | $(LZ4) -qt
- $(DATAGEN) -g33M | $(LZ4) --no-frame-crc | $(LZ4) -t
- $(DATAGEN) -g256MB | $(LZ4) -vqB4D | $(LZ4) -t --no-crc
- @echo "hello world" > $(FPREFIX)-hw
- $(LZ4) --rm -f $(FPREFIX)-hw $(FPREFIX)-hw.lz4
- test ! -f $(FPREFIX)-hw # must fail (--rm)
- test -f $(FPREFIX)-hw.lz4
- $(PRGDIR)/lz4cat $(FPREFIX)-hw.lz4 | $(GREP) "hello world"
- $(PRGDIR)/unlz4 --rm $(FPREFIX)-hw.lz4 $(FPREFIX)-hw
- test -f $(FPREFIX)-hw
- test ! -f $(FPREFIX)-hw.lz4 # must fail (--rm)
- test ! -f $(FPREFIX)-hw.lz4.lz4 # must fail (unlz4)
- $(PRGDIR)/lz4cat $(FPREFIX)-hw # pass-through mode
- test -f $(FPREFIX)-hw
- test ! -f $(FPREFIX)-hw.lz4 # must fail (lz4cat)
- $(LZ4) $(FPREFIX)-hw $(FPREFIX)-hw.lz4 # creates $(FPREFIX)-hw.lz4
- $(PRGDIR)/lz4cat < $(FPREFIX)-hw.lz4 > $(FPREFIX)3 # checks lz4cat works with stdin (#285)
- $(DIFF) -q $(FPREFIX)-hw $(FPREFIX)3
- $(PRGDIR)/lz4cat < $(FPREFIX)-hw > $(FPREFIX)2 # checks lz4cat works in pass-through mode
- $(DIFF) -q $(FPREFIX)-hw $(FPREFIX)2
- cp $(FPREFIX)-hw ./-d
- $(LZ4) --rm -- -d -d.lz4 # compresses ./d into ./-d.lz4
- test -f ./-d.lz4
- test ! -f ./-d
- mv ./-d.lz4 ./-z
- $(LZ4) -d --rm -- -z $(FPREFIX)4 # uncompresses ./-z into $(FPREFIX)4
- test ! -f ./-z
- $(DIFF) -q $(FPREFIX)-hw $(FPREFIX)4
- ! $(LZ4) $(FPREFIX)2 $(FPREFIX)3 $(FPREFIX)4 # must fail: refuse to handle 3+ file names
- $(LZ4) -f $(FPREFIX)-hw # create $(FPREFIX)-hw.lz4, for next tests
- $(LZ4) --list $(FPREFIX)-hw.lz4 # test --list on valid single-frame file
- $(LZ4) --list < $(FPREFIX)-hw.lz4 # test --list from stdin (file only)
- $(CAT) $(FPREFIX)-hw >> $(FPREFIX)-hw.lz4
- ! $(LZ4) -f $(FPREFIX)-hw.lz4 # uncompress valid frame followed by invalid data (must fail now)
- $(LZ4) -BX $(FPREFIX)-hw -c -q | $(LZ4) -tv # test block checksum
- # $(DATAGEN) -g20KB generates the same file every single time
- # cannot save output of $(DATAGEN) -g20KB as input file to lz4 because the following shell commands are run before $(DATAGEN) -g20KB
- test "$(shell $(DATAGEN) -g20KB | $(LZ4) -c --fast | wc -c)" -lt "$(shell $(DATAGEN) -g20KB | $(LZ4) -c --fast=9 | wc -c)" # -1 vs -9
- test "$(shell $(DATAGEN) -g20KB | $(LZ4) -c -1 | wc -c)" -lt "$(shell $(DATAGEN) -g20KB| $(LZ4) -c --fast=1 | wc -c)" # 1 vs -1
- 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
- ! $(LZ4) -c --fast=0 $(FPREFIX)-dg20K # lz4 should fail when fast=0
- ! $(LZ4) -c --fast=-1 $(FPREFIX)-dg20K # lz4 should fail when fast=-1
- # High --fast values can result in out-of-bound dereferences #876
- $(DATAGEN) -g1M | $(LZ4) -c --fast=999999999 > /dev/null
- # Test for #596
- @echo "TEST" > $(FPREFIX)-test
- $(LZ4) -m $(FPREFIX)-test
- $(LZ4) $(FPREFIX)-test.lz4 $(FPREFIX)-test2
- $(DIFF) -q $(FPREFIX)-test $(FPREFIX)-test2
- @$(RM) $(FPREFIX)*
-
-
-test-lz4-dict: FPREFIX = tmp-dict
+ PATH=$(PATH) ./test-lz4-basic.sh
+
test-lz4-dict: lz4 datagen
@echo "\n ---- test lz4 compression/decompression with dictionary ----"
- $(DATAGEN) -g16KB > $(FPREFIX)
- $(DATAGEN) -g32KB > $(FPREFIX)-sample-32k
- < $(FPREFIX)-sample-32k $(LZ4) -D $(FPREFIX) | $(LZ4) -dD $(FPREFIX) | diff - $(FPREFIX)-sample-32k
- $(DATAGEN) -g128MB > $(FPREFIX)-sample-128m
- < $(FPREFIX)-sample-128m $(LZ4) -D $(FPREFIX) | $(LZ4) -dD $(FPREFIX) | diff - $(FPREFIX)-sample-128m
- touch $(FPREFIX)-sample-0
- < $(FPREFIX)-sample-0 $(LZ4) -D $(FPREFIX) | $(LZ4) -dD $(FPREFIX) | diff - $(FPREFIX)-sample-0
-
- < $(FPREFIX)-sample-32k $(LZ4) -D $(FPREFIX)-sample-0 | $(LZ4) -dD $(FPREFIX)-sample-0 | diff - $(FPREFIX)-sample-32k
- < $(FPREFIX)-sample-0 $(LZ4) -D $(FPREFIX)-sample-0 | $(LZ4) -dD $(FPREFIX)-sample-0 | diff - $(FPREFIX)-sample-0
- $(LZ4) -bi0 -D $(FPREFIX) $(FPREFIX)-sample-32k $(FPREFIX)-sample-32k
-
- @echo "\n ---- test lz4 dictionary loading ----"
- $(DATAGEN) -g128KB > $(FPREFIX)-data-128KB
- set -e; \
- for l in 0 1 4 128 32767 32768 32769 65535 65536 65537 98303 98304 98305 131071 131072 131073; do \
- $(DATAGEN) -g$$l > $(FPREFIX)-$$l; \
- $(DD) if=$(FPREFIX)-$$l of=$(FPREFIX)-$$l-tail bs=1 count=65536 skip=$$((l > 65536 ? l - 65536 : 0)); \
- < $(FPREFIX)-$$l $(LZ4) -D stdin $(FPREFIX)-data-128KB -c | $(LZ4) -dD $(FPREFIX)-$$l-tail | $(DIFF) - $(FPREFIX)-data-128KB; \
- < $(FPREFIX)-$$l-tail $(LZ4) -D stdin $(FPREFIX)-data-128KB -c | $(LZ4) -dD $(FPREFIX)-$$l | $(DIFF) - $(FPREFIX)-data-128KB; \
- done
- @$(RM) $(FPREFIX)*
+ PATH=$(PATH) ./test-lz4-dict.sh
test-lz4hc-hugefile: lz4 datagen
@echo "\n ---- test HC compression/decompression of huge files ----"
- $(DATAGEN) -g4200MB | $(LZ4) -v3BD | $(LZ4) -qt
+ PATH=$(PATH) ./test-lz4hc-hugefile.sh
-test-lz4-fast-hugefile: FPREFIX = tmp-lfh
test-lz4-fast-hugefile: lz4 datagen
@echo "\n ---- test huge files compression/decompression ----"
- $(DATAGEN) -g6GB | $(LZ4) -vB5D | $(LZ4) -qt
- # test large file size [2-4] GB
- @$(DATAGEN) -g3G -P100 | $(LZ4) -vv | $(LZ4) --decompress --force --sparse - $(FPREFIX)1
- @ls -ls $(FPREFIX)1
- @$(DATAGEN) -g3G -P100 | $(LZ4) --quiet --content-size | $(LZ4) --verbose --decompress --force --sparse - $(FPREFIX)2
- @ls -ls $(FPREFIX)2
- $(DIFF) -s $(FPREFIX)1 $(FPREFIX)2
- @$(RM) $(FPREFIX)*
+ PATH=$(PATH) ./test-lz4-fast-hugefile.sh
test-lz4-hugefile: test-lz4-fast-hugefile test-lz4hc-hugefile
-test-lz4-testmode: FPREFIX = tmp-ltm
test-lz4-testmode: lz4 datagen
@echo "\n ---- bench mode ----"
- $(LZ4) -bi0
- $(DATAGEN) > $(FPREFIX)
- $(LZ4) -f $(FPREFIX) -c > $(FPREFIX).lz4
- $(LZ4) -bdi0 $(FPREFIX).lz4 # test benchmark decode-only mode
- $(LZ4) -bdi0 --no-crc $(FPREFIX).lz4 # test benchmark decode-only mode
- @echo "\n ---- test mode ----"
- ! $(DATAGEN) | $(LZ4) -t
- ! $(DATAGEN) | $(LZ4) -tf
- @echo "\n ---- pass-through mode ----"
- @echo "Why hello there " > $(FPREFIX)2.lz4
- ! $(LZ4) -f $(FPREFIX)2.lz4 > $(VOID)
- ! $(DATAGEN) | $(LZ4) -dc > $(VOID)
- ! $(DATAGEN) | $(LZ4) -df > $(VOID)
- $(DATAGEN) | $(LZ4) -dcf > $(VOID)
- @echo "Hello World !" > $(FPREFIX)1
- $(LZ4) -dcf $(FPREFIX)1
- @echo "from underground..." > $(FPREFIX)2
- $(LZ4) -dcfm $(FPREFIX)1 $(FPREFIX)2
- @echo "\n ---- non-existing source (must fail cleanly) ----"
- ! $(LZ4) file-does-not-exist
- ! $(LZ4) -f file-does-not-exist
- ! $(LZ4) -t file-does-not-exist
- ! $(LZ4) -fm file1-dne file2-dne
- @$(RM) $(FPREFIX)*
+ PATH=$(PATH) ./test-lz4-testmode.sh
test-lz4-opt-parser: lz4 datagen
@echo "\n ---- test opt-parser ----"
- $(DATAGEN) -g16KB | $(LZ4) -12 | $(LZ4) -t
- $(DATAGEN) -P10 | $(LZ4) -12B4 | $(LZ4) -t
- $(DATAGEN) -g256K | $(LZ4) -12B4D | $(LZ4) -t
- $(DATAGEN) -g512K -P25 | $(LZ4) -12BD | $(LZ4) -t
- $(DATAGEN) -g1M | $(LZ4) -12B5 | $(LZ4) -t
- $(DATAGEN) -g1M -s2 | $(LZ4) -12B4D | $(LZ4) -t
- $(DATAGEN) -g2M -P99 | $(LZ4) -11B4D | $(LZ4) -t
- $(DATAGEN) -g4M | $(LZ4) -11vq | $(LZ4) -qt
- $(DATAGEN) -g8M | $(LZ4) -11B4 | $(LZ4) -t
- $(DATAGEN) -g16M -P90 | $(LZ4) -11B5 | $(LZ4) -t
- $(DATAGEN) -g32M -P10 | $(LZ4) -11B5D | $(LZ4) -t
+ PATH=$(PATH) ./test-lz4-opt-parser.sh
test-lz4-essentials : lz4 datagen test-lz4-basic test-lz4-multiple test-lz4-multiple-legacy \
test-lz4-frame-concatenation test-lz4-testmode \
diff --git a/tests/test-lz4-basic.sh b/tests/test-lz4-basic.sh
new file mode 100755
index 0000000..1767827
--- /dev/null
+++ b/tests/test-lz4-basic.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+FPREFIX="tmp-tlb"
+
+set -e
+
+remove () {
+ rm $FPREFIX*
+}
+
+trap remove EXIT
+
+set -x
+
+datagen -g0 | lz4 -v | lz4 -t
+datagen -g16KB | lz4 -9 | lz4 -t
+datagen -g20KB > $FPREFIX-dg20k
+lz4 < $FPREFIX-dg20k | lz4 -d > $FPREFIX-dec
+diff -q $FPREFIX-dg20k $FPREFIX-dec
+lz4 --no-frame-crc < $FPREFIX-dg20k | lz4 -d > $FPREFIX-dec
+diff -q $FPREFIX-dg20k $FPREFIX-dec
+datagen | lz4 -BI | lz4 -t
+datagen | lz4 --no-crc | lz4 -t
+datagen -g6M -P99 | lz4 -9BD | lz4 -t
+datagen -g17M | lz4 -9v | lz4 -qt
+datagen -g33M | lz4 --no-frame-crc | lz4 -t
+datagen -g256MB | lz4 -vqB4D | lz4 -t --no-crc
+echo "hello world" > $FPREFIX-hw
+lz4 --rm -f $FPREFIX-hw $FPREFIX-hw.lz4
+test ! -f $FPREFIX-hw # must fail (--rm)
+test -f $FPREFIX-hw.lz4
+lz4cat $FPREFIX-hw.lz4 | grep "hello world"
+unlz4 --rm $FPREFIX-hw.lz4 $FPREFIX-hw
+test -f $FPREFIX-hw
+test ! -f $FPREFIX-hw.lz4 # must fail (--rm)
+test ! -f $FPREFIX-hw.lz4.lz4 # must fail (unlz4)
+lz4cat $FPREFIX-hw # pass-through mode
+test -f $FPREFIX-hw
+test ! -f $FPREFIX-hw.lz4 # must fail (lz4cat)
+lz4 $FPREFIX-hw $FPREFIX-hw.lz4 # creates $FPREFIX-hw.lz4
+lz4cat < $FPREFIX-hw.lz4 > ${FPREFIX}3 # checks lz4cat works with stdin (#285)
+diff -q $FPREFIX-hw ${FPREFIX}3
+lz4cat < $FPREFIX-hw > ${FPREFIX}2 # checks lz4cat works in pass-through mode
+diff -q $FPREFIX-hw ${FPREFIX}2
+cp $FPREFIX-hw ./-d
+lz4 --rm -- -d -d.lz4 # compresses ./d into ./-d.lz4
+test -f ./-d.lz4
+test ! -f ./-d
+mv ./-d.lz4 ./-z
+lz4 -d --rm -- -z ${FPREFIX}4 # uncompresses ./-z into $FPREFIX4
+test ! -f ./-z
+diff -q $FPREFIX-hw ${FPREFIX}4
+lz4 ${FPREFIX}2 ${FPREFIX}3 ${FPREFIX}4 && exit 1 # must fail: refuse to handle 3+ file names
+lz4 -f $FPREFIX-hw # create $FPREFIX-hw.lz4, for next tests
+lz4 --list $FPREFIX-hw.lz4 # test --list on valid single-frame file
+lz4 --list < $FPREFIX-hw.lz4 # test --list from stdin (file only)
+cat $FPREFIX-hw >> $FPREFIX-hw.lz4
+lz4 -f $FPREFIX-hw.lz4 && exit 1 # uncompress valid frame followed by invalid data (must fail now)
+lz4 -BX $FPREFIX-hw -c -q | lz4 -tv # test block checksum
+# datagen -g20KB generates the same file every single time
+# cannot save output of datagen -g20KB as input file to lz4 because the following shell commands are run before datagen -g20KB
+test "$(datagen -g20KB | lz4 -c --fast | wc -c)" -lt "$(datagen -g20KB | lz4 -c --fast=9 | wc -c)" # -1 vs -9
+test "$(datagen -g20KB | lz4 -c -1 | wc -c)" -lt "$(datagen -g20KB| lz4 -c --fast=1 | wc -c)" # 1 vs -1
+test "$(datagen -g20KB | lz4 -c --fast=1 | wc -c)" -eq "$(datagen -g20KB| lz4 -c --fast| wc -c)" # checks default fast compression is -1
+lz4 -c --fast=0 $FPREFIX-dg20K && exit 1 # lz4 should fail when fast=0
+lz4 -c --fast=-1 $FPREFIX-dg20K && exit 1 # lz4 should fail when fast=-1
+# High --fast values can result in out-of-bound dereferences #876
+datagen -g1M | lz4 -c --fast=999999999 > $FPREFIX-trash
+# Test for #596
+echo "TEST" > $FPREFIX-test
+lz4 -m $FPREFIX-test
+lz4 $FPREFIX-test.lz4 $FPREFIX-test2
+diff -q $FPREFIX-test $FPREFIX-test2
diff --git a/tests/test-lz4-contentSize.sh b/tests/test-lz4-contentSize.sh
new file mode 100755
index 0000000..b2d8e1b
--- /dev/null
+++ b/tests/test-lz4-contentSize.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+FPREFIX="tmp-lzc"
+
+set -e
+
+remove () {
+ rm $FPREFIX*
+}
+
+trap remove EXIT
+
+set -x
+
+datagen -g15M > $FPREFIX
+lz4 -v $FPREFIX -c | lz4 -t
+lz4 -v --content-size $FPREFIX -c | lz4 -d > $FPREFIX-dup
+diff $FPREFIX $FPREFIX-dup
+lz4 -f $FPREFIX -c > $FPREFIX.lz4 # compressed with content size
+lz4 --content-size $FPREFIX -c > $FPREFIX-wcz.lz4
+diff $FPREFIX.lz4 $FPREFIX-wcz.lz4 && exit 1 # must differ, due to content size
+lz4 --content-size < $FPREFIX > $FPREFIX-wcz2.lz4 # can determine content size because stdin is just a file
+diff $FPREFIX-wcz.lz4 $FPREFIX-wcz2.lz4 # both must contain content size
+cat $FPREFIX | lz4 > $FPREFIX-ncz.lz4
+diff $FPREFIX.lz4 $FPREFIX-ncz.lz4 # both don't have content size
+cat $FPREFIX | lz4 --content-size > $FPREFIX-ncz2.lz4 # can't determine content size
+diff $FPREFIX.lz4 $FPREFIX-ncz2.lz4 # both don't have content size
diff --git a/tests/test-lz4-dict.sh b/tests/test-lz4-dict.sh
new file mode 100755
index 0000000..347cf92
--- /dev/null
+++ b/tests/test-lz4-dict.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+FPREFIX="tmp-dict"
+
+set -e
+
+remove () {
+ rm $FPREFIX*
+}
+
+trap remove EXIT
+
+set -x
+
+datagen -g16KB > $FPREFIX
+datagen -g32KB > $FPREFIX-sample-32k
+< $FPREFIX-sample-32k lz4 -D $FPREFIX | lz4 -dD $FPREFIX | diff - $FPREFIX-sample-32k
+datagen -g128MB > $FPREFIX-sample-128m
+< $FPREFIX-sample-128m lz4 -D $FPREFIX | lz4 -dD $FPREFIX | diff - $FPREFIX-sample-128m
+touch $FPREFIX-sample-0
+< $FPREFIX-sample-0 lz4 -D $FPREFIX | lz4 -dD $FPREFIX | diff - $FPREFIX-sample-0
+
+< $FPREFIX-sample-32k lz4 -D $FPREFIX-sample-0 | lz4 -dD $FPREFIX-sample-0 | diff - $FPREFIX-sample-32k
+< $FPREFIX-sample-0 lz4 -D $FPREFIX-sample-0 | lz4 -dD $FPREFIX-sample-0 | diff - $FPREFIX-sample-0
+lz4 -bi0 -D $FPREFIX $FPREFIX-sample-32k $FPREFIX-sample-32k
+
+echo "---- test lz4 dictionary loading ----"
+datagen -g128KB > $FPREFIX-data-128KB
+set -e; \
+for l in 0 1 4 128 32767 32768 32769 65535 65536 65537 98303 98304 98305 131071 131072 131073; do \
+ datagen -g$$l > $FPREFIX-$$l; \
+ dd if=$FPREFIX-$$l of=$FPREFIX-$$l-tail bs=1 count=65536 skip=$((l > 65536 ? l - 65536 : 0)); \
+ < $FPREFIX-$$l lz4 -D stdin $FPREFIX-data-128KB -c | lz4 -dD $FPREFIX-$$l-tail | diff - $FPREFIX-data-128KB; \
+ < $FPREFIX-$$l-tail lz4 -D stdin $FPREFIX-data-128KB -c | lz4 -dD $FPREFIX-$$l | diff - $FPREFIX-data-128KB; \
+done
diff --git a/tests/test-lz4-fast-hugefile.sh b/tests/test-lz4-fast-hugefile.sh
new file mode 100755
index 0000000..c777b91
--- /dev/null
+++ b/tests/test-lz4-fast-hugefile.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+FPREFIX="tmp-lfh"
+
+set -e
+
+remove () {
+ rm $FPREFIX*
+}
+
+trap remove EXIT
+
+set -x
+
+datagen -g6GB | lz4 -vB5D | lz4 -qt
+# test large file size [2-4] GB
+datagen -g3G -P100 | lz4 -vv | lz4 --decompress --force --sparse - ${FPREFIX}1
+ls -ls ${FPREFIX}1
+datagen -g3G -P100 | lz4 --quiet --content-size | lz4 --verbose --decompress --force --sparse - ${FPREFIX}2
+ls -ls ${FPREFIX}2
+diff -s ${FPREFIX}1 ${FPREFIX}2
diff --git a/tests/test-lz4-frame-concatenation.sh b/tests/test-lz4-frame-concatenation.sh
new file mode 100755
index 0000000..94165c1
--- /dev/null
+++ b/tests/test-lz4-frame-concatenation.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+FPREFIX="tmp-lfc"
+
+set -e
+remove () {
+ rm $FPREFIX*
+}
+
+trap remove EXIT
+
+set -x
+
+echo > $FPREFIX-empty
+echo hi > $FPREFIX-nonempty
+cat $FPREFIX-nonempty $FPREFIX-empty $FPREFIX-nonempty > $FPREFIX-src
+lz4 -zq $FPREFIX-empty -c > $FPREFIX-empty.lz4
+lz4 -zq $FPREFIX-nonempty -c > $FPREFIX-nonempty.lz4
+cat $FPREFIX-nonempty.lz4 $FPREFIX-empty.lz4 $FPREFIX-nonempty.lz4 > $FPREFIX-concat.lz4
+lz4 -d $FPREFIX-concat.lz4 -c > $FPREFIX-result
+cmp $FPREFIX-src $FPREFIX-result
diff --git a/tests/test-lz4-multiple-legacy.sh b/tests/test-lz4-multiple-legacy.sh
new file mode 100755
index 0000000..da3896d
--- /dev/null
+++ b/tests/test-lz4-multiple-legacy.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+FPREFIX="tmp-lml"
+
+set -e
+
+remove () {
+ rm $FPREFIX*
+}
+
+trap remove EXIT
+
+set -x
+
+datagen -s1 > "${FPREFIX}1" 2> $FPREFIX-trash
+datagen -s2 -g100K > "${FPREFIX}2" 2> $FPREFIX-trash
+datagen -s3 -g200K > "${FPREFIX}3" 2> $FPREFIX-trash
+# compress multiple files using legacy format: one .lz4 per source file
+lz4 -f -l -m $FPREFIX*
+test -f ${FPREFIX}1.lz4
+test -f ${FPREFIX}2.lz4
+test -f ${FPREFIX}3.lz4
+# decompress multiple files compressed using legacy format: one output file per .lz4
+mv ${FPREFIX}1 ${FPREFIX}1-orig
+mv ${FPREFIX}2 ${FPREFIX}2-orig
+mv ${FPREFIX}3 ${FPREFIX}3-orig
+lz4 -d -f -m $FPREFIX*.lz4
+lz4 -l -d -f -m $FPREFIX*.lz4 # -l mustn't impact -d option
+cmp ${FPREFIX}1 ${FPREFIX}1-orig # must be identical
+cmp ${FPREFIX}2 ${FPREFIX}2-orig
+cmp ${FPREFIX}3 ${FPREFIX}3-orig
+# compress multiple files into stdout using legacy format
+cat ${FPREFIX}1.lz4 ${FPREFIX}2.lz4 ${FPREFIX}3.lz4 > $FPREFIX-concat1
+rm $FPREFIX*.lz4
+lz4 -l -m ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3 -c > $FPREFIX-concat2
+test ! -f ${FPREFIX}1.lz4 # must not create .lz4 artefact
+cmp $FPREFIX-concat1 $FPREFIX-concat2 # must be equivalent
+# # # decompress multiple files into stdout using legacy format
+rm $FPREFIX-concat1 $FPREFIX-concat2
+lz4 -l -f -m ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3 # generate .lz4 to decompress
+cat ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3 > ${FPREFIX}-concat1 # create concatenated reference
+rm ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3
+lz4 -d -m ${FPREFIX}1.lz4 ${FPREFIX}2.lz4 ${FPREFIX}3.lz4 -c > $FPREFIX-concat2
+lz4 -d -l -m ${FPREFIX}1.lz4 ${FPREFIX}2.lz4 ${FPREFIX}3.lz4 -c > $FPREFIX-concat2 # -l mustn't impact option -d
+test ! -f ${FPREFIX}1 # must not create file artefact
+cmp $FPREFIX-concat1 $FPREFIX-concat2 # must be equivalent
+# # # compress multiple files, one of which is absent (must fail)
+lz4 -f -l -m $FPREFIX-concat1 notHere-legacy $FPREFIX-concat2 && exit 1 # must fail : notHere-legacy not present
+true
diff --git a/tests/test-lz4-multiple.sh b/tests/test-lz4-multiple.sh
new file mode 100755
index 0000000..3c854d4
--- /dev/null
+++ b/tests/test-lz4-multiple.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+FPREFIX="tmp-tml"
+
+set -e
+
+remove () {
+ rm $FPREFIX*
+}
+
+trap remove EXIT
+
+set -x
+
+datagen -s1 > ${FPREFIX}1 2> $FPREFIX-trash
+datagen -s2 -g100K > ${FPREFIX}2 2> $FPREFIX-trash
+datagen -s3 -g200K > ${FPREFIX}3 2> $FPREFIX-trash
+# compress multiple files : one .lz4 per source file
+lz4 -f -m $FPREFIX*
+test -f ${FPREFIX}1.lz4
+test -f ${FPREFIX}2.lz4
+test -f ${FPREFIX}3.lz4
+# decompress multiple files : one output file per .lz4
+mv ${FPREFIX}1 ${FPREFIX}1-orig
+mv ${FPREFIX}2 ${FPREFIX}2-orig
+mv ${FPREFIX}3 ${FPREFIX}3-orig
+lz4 -d -f -m $FPREFIX*.lz4
+cmp ${FPREFIX}1 ${FPREFIX}1-orig # must be identical
+cmp ${FPREFIX}2 ${FPREFIX}2-orig
+cmp ${FPREFIX}3 ${FPREFIX}3-orig
+# compress multiple files into stdout
+cat ${FPREFIX}1.lz4 ${FPREFIX}2.lz4 ${FPREFIX}3.lz4 > $FPREFIX-concat1
+rm $FPREFIX*.lz4
+lz4 -m ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3 -c > $FPREFIX-concat2
+test ! -f ${FPREFIX}1.lz4 # must not create .lz4 artefact
+cmp $FPREFIX-concat1 $FPREFIX-concat2 # must be equivalent
+# decompress multiple files into stdout
+rm $FPREFIX-concat1 $FPREFIX-concat2
+lz4 -f -m ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3 # generate .lz4 to decompress
+cat ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3 > $FPREFIX-concat1 # create concatenated reference
+rm ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3
+lz4 -d -m ${FPREFIX}1.lz4 ${FPREFIX}2.lz4 ${FPREFIX}3.lz4 -c > $FPREFIX-concat2
+test ! -f ${FPREFIX}1 # must not create file artefact
+cmp $FPREFIX-concat1 $FPREFIX-concat2 # must be equivalent
+# compress multiple files, one of which is absent (must fail)
+lz4 -f -m $FPREFIX-concat1 notHere $FPREFIX-concat2 && exit 1 # must fail : notHere not present
+# test lz4-compressed file
+rm $FPREFIX-concat1 $FPREFIX-concat2
+lz4 -tm $FPREFIX-concat1.lz4
+# ensure the test doesn't create artifact
+test ! -f $FPREFIX-concat1 # must not create file artefact
+# test multiple lz4-compressed file
+lz4 -tm $FPREFIX-concat1.lz4 $FPREFIX-concat2.lz4
+test ! -f $FPREFIX-concat1 # must not create file artefact
+test ! -f $FPREFIX-concat2 # must not create file artefact
+# test multiple lz4 files, one of which is absent (must fail)
+lz4 -tm $FPREFIX-concat1.lz4 notHere.lz4 $FPREFIX-concat2.lz4 && exit 1
+true
diff --git a/tests/test-lz4-opt-parser.sh b/tests/test-lz4-opt-parser.sh
new file mode 100755
index 0000000..5b8d1dc
--- /dev/null
+++ b/tests/test-lz4-opt-parser.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+set -x
+
+datagen -g16KB | lz4 -12 | lz4 -t
+datagen -P10 | lz4 -12B4 | lz4 -t
+datagen -g256K | lz4 -12B4D | lz4 -t
+datagen -g512K -P25 | lz4 -12BD | lz4 -t
+datagen -g1M | lz4 -12B5 | lz4 -t
+datagen -g1M -s2 | lz4 -12B4D | lz4 -t
+datagen -g2M -P99 | lz4 -11B4D | lz4 -t
+datagen -g4M | lz4 -11vq | lz4 -qt
+datagen -g8M | lz4 -11B4 | lz4 -t
+datagen -g16M -P90 | lz4 -11B5 | lz4 -t
+datagen -g32M -P10 | lz4 -11B5D | lz4 -t
diff --git a/tests/test-lz4-skippable.sh b/tests/test-lz4-skippable.sh
new file mode 100755
index 0000000..e34a33f
--- /dev/null
+++ b/tests/test-lz4-skippable.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+SKIPFILE="goldenSamples/skip.bin"
+FPREFIX="tmp-lsk"
+
+set -e
+
+remove () {
+ rm "$FPREFIX"*
+}
+
+trap remove EXIT
+
+set -x
+
+lz4 -dc $SKIPFILE
+lz4 -dc < $SKIPFILE
+printf "Hello from Valid Frame!\n" | lz4 -c > $FPREFIX.lz4
+cat $SKIPFILE $FPREFIX.lz4 $SKIPFILE | lz4 -dc
diff --git a/tests/test-lz4-sparse.sh b/tests/test-lz4-sparse.sh
new file mode 100755
index 0000000..99297ff
--- /dev/null
+++ b/tests/test-lz4-sparse.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+FPREFIX="tmp-tls"
+
+set -e
+
+remove () {
+ rm $FPREFIX*
+}
+
+trap remove EXIT
+
+set -x
+
+datagen -g5M -P100 > ${FPREFIX}dg5M
+lz4 -B4D ${FPREFIX}dg5M -c | lz4 -dv --sparse > ${FPREFIX}cB4
+diff -s ${FPREFIX}dg5M ${FPREFIX}cB4
+lz4 -B5D ${FPREFIX}dg5M -c | lz4 -dv --sparse > ${FPREFIX}cB5
+diff -s ${FPREFIX}dg5M ${FPREFIX}cB5
+lz4 -B6D ${FPREFIX}dg5M -c | lz4 -dv --sparse > ${FPREFIX}cB6
+diff -s ${FPREFIX}dg5M ${FPREFIX}cB6
+lz4 -B7D ${FPREFIX}dg5M -c | lz4 -dv --sparse > ${FPREFIX}cB7
+diff -s ${FPREFIX}dg5M ${FPREFIX}cB7
+lz4 ${FPREFIX}dg5M -c | lz4 -dv --no-sparse > ${FPREFIX}nosparse
+diff -s ${FPREFIX}dg5M ${FPREFIX}nosparse
+ls -ls $FPREFIX*
+datagen -s1 -g1200007 -P100 | lz4 | lz4 -dv --sparse > ${FPREFIX}odd # Odd size file (to generate non-full last block)
+datagen -s1 -g1200007 -P100 | diff -s - ${FPREFIX}odd
+ls -ls ${FPREFIX}odd
+rm $FPREFIX*
+printf "\n Compatibility with Console :"
+echo "Hello World 1 !" | lz4 | lz4 -d -c
+echo "Hello World 2 !" | lz4 | lz4 -d | cat
+echo "Hello World 3 !" | lz4 --no-frame-crc | lz4 -d -c
+printf "\n Compatibility with Append :"
+datagen -P100 -g1M > ${FPREFIX}dg1M
+cat ${FPREFIX}dg1M ${FPREFIX}dg1M > ${FPREFIX}2M
+lz4 -B5 -v ${FPREFIX}dg1M ${FPREFIX}c
+lz4 -d -v ${FPREFIX}c ${FPREFIX}r
+lz4 -d -v ${FPREFIX}c -c >> ${FPREFIX}r
+ls -ls $FPREFIX*
+diff ${FPREFIX}2M ${FPREFIX}r
diff --git a/tests/test-lz4-testmode.sh b/tests/test-lz4-testmode.sh
new file mode 100755
index 0000000..d37eaad
--- /dev/null
+++ b/tests/test-lz4-testmode.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+FPREFIX="tmp-ltm"
+
+set -e
+
+remove () {
+ rm $FPREFIX*
+}
+
+trap remove EXIT
+
+set -x
+
+lz4 -bi0
+datagen > $FPREFIX
+lz4 -f $FPREFIX -c > $FPREFIX.lz4
+lz4 -bdi0 $FPREFIX.lz4 # test benchmark decode-only mode
+lz4 -bdi0 --no-crc $FPREFIX.lz4 # test benchmark decode-only mode
+echo "---- test mode ----"
+datagen | lz4 -t && exit 1
+datagen | lz4 -tf && exit 1
+echo "---- pass-through mode ----"
+echo "Why hello there " > ${FPREFIX}2.lz4
+lz4 -f ${FPREFIX}2.lz4 > $FPREFIX-trash && exit 1
+datagen | lz4 -dc > $FPREFIX-trash && exit 1
+datagen | lz4 -df > $FPREFIX-trash && exit 1
+datagen | lz4 -dcf > $FPREFIX-trash
+echo "Hello World !" > ${FPREFIX}1
+lz4 -dcf ${FPREFIX}1
+echo "from underground..." > ${FPREFIX}2
+lz4 -dcfm ${FPREFIX}1 ${FPREFIX}2
+echo "---- non-existing source (must fail cleanly) ----"
+lz4 file-does-not-exist && exit 1
+lz4 -f file-does-not-exist && exit 1
+lz4 -t file-does-not-exist && exit 1
+lz4 -fm file1-dne file2-dne && exit 1
+true
diff --git a/tests/test-lz4hc-hugefile.sh b/tests/test-lz4hc-hugefile.sh
new file mode 100755
index 0000000..74eb5c9
--- /dev/null
+++ b/tests/test-lz4hc-hugefile.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+set -e
+set -x
+
+datagen -g4200MB | lz4 -v3BD | lz4 -qt