View | Details | Raw Unified | Return to bug 267667
Collapse All | Expand All

(-)b/archivers/liblz4/Makefile (+1 lines)
Lines 2-7 PORTNAME= lz4 Link Here
2
DISTVERSIONPREFIX=	v
2
DISTVERSIONPREFIX=	v
3
DISTVERSION=	1.9.4
3
DISTVERSION=	1.9.4
4
PORTEPOCH=	1
4
PORTEPOCH=	1
5
PORTREVISION=	1
5
CATEGORIES=	archivers
6
CATEGORIES=	archivers
6
PKGNAMEPREFIX=	lib
7
PKGNAMEPREFIX=	lib
7
8
(-)b/archivers/liblz4/files/patch-contrib-meson-meson_options.txt (+46 lines)
Added Link Here
1
--- meson_options.txt.orig	2022-08-15 22:45:31.000000000 +0000
2
+++ meson_options.txt	2022-10-25 16:06:36.060759000 +0000
3
@@ -8,17 +8,33 @@
4
 # in the COPYING file in the root directory of this source tree).
5
 # #############################################################################
6
 
7
+option('align-test', type: 'boolean', value: true,
8
+  description: 'See LZ4_ALIGN_TEST')
9
+option('contrib', type: 'boolean', value: false,
10
+  description: 'Enable contrib')
11
 option('debug-level', type: 'integer', min: 0, max: 7, value: 1,
12
   description: 'Enable run-time debug. See lib/lz4hc.c')
13
-option('unstable', type: 'boolean', value: false,
14
-  description: 'Expose unstable interfaces')
15
-option('programs', type: 'boolean', value: false,
16
-  description: 'Enable programs build')
17
-option('tests', type: 'boolean', value: false,
18
-  description: 'Enable tests build')
19
-option('contrib', type: 'boolean', value: false,
20
-  description: 'Enable contrib build')
21
+option('disable-memory-allocation', type: 'boolean', value: false,
22
+  description: 'See LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION. Static builds only')
23
+option('distance-max', type: 'integer', min: 0, max: 65535, value: 65535,
24
+  description: 'See LZ4_DISTANCE_MAX')
25
 option('examples', type: 'boolean', value: false,
26
-  description: 'Enable examples build')
27
-option('memory-usage', type: 'integer', min: 0, value: 0,
28
+  description: 'Enable examples')
29
+option('fast-dec-loop', type: 'feature', value: 'auto',
30
+  description: 'See LZ4_FAST_DEC_LOOP')
31
+option('force-sw-bitcount', type: 'boolean', value: false,
32
+  description: 'See LZ4_FORCE_SW_BITCOUNT')
33
+option('freestanding', type: 'boolean', value: false,
34
+  description: 'See LZ4_FREESTANDING')
35
+option('memory-usage', type: 'integer', min: 0, max: 20, value: 0,
36
   description: 'See LZ4_MEMORY_USAGE. 0 means use the LZ4 default')
37
+option('ossfuzz', type: 'boolean', value: true,
38
+  description: 'Enable ossfuzz')
39
+option('programs', type: 'boolean', value: false,
40
+  description: 'Enable programs')
41
+option('tests', type: 'boolean', value: false,
42
+  description: 'Enable tests')
43
+option('unstable', type: 'boolean', value: false,
44
+  description: 'Expose unstable interfaces')
45
+option('user-memory-functions', type: 'boolean', value: false,
46
+  description: 'See LZ4_USER_MEMORY_FUNCTIONS')
(-)b/archivers/liblz4/files/patch-contrib_meson_GetLz4LibraryVersion.py (+42 lines)
Added Link Here
1
--- GetLz4LibraryVersion.py.orig	2022-11-09 10:12:28.414117000 +0000
2
+++ GetLz4LibraryVersion.py	2022-10-25 16:06:36.060320000 +0000
3
@@ -0,0 +1,39 @@
4
+#!/usr/bin/env python3
5
+# #############################################################################
6
+# Copyright (c) 2018-present    lzutao <taolzu(at)gmail.com>
7
+# All rights reserved.
8
+#
9
+# This source code is licensed under both the BSD-style license (found in the
10
+# LICENSE file in the root directory of this source tree) and the GPLv2 (found
11
+# in the COPYING file in the root directory of this source tree).
12
+# #############################################################################
13
+import re
14
+
15
+
16
+def find_version_tuple(filepath):
17
+  version_file_data = None
18
+  with open(filepath) as fd:
19
+    version_file_data = fd.read()
20
+
21
+  patterns = r"""#\s*define\s+LZ4_VERSION_MAJOR\s+([0-9]+).*$
22
+#\s*define\s+LZ4_VERSION_MINOR\s+([0-9]+).*$
23
+#\s*define\s+LZ4_VERSION_RELEASE\s+([0-9]+).*$
24
+"""
25
+  regex = re.compile(patterns, re.MULTILINE)
26
+  version_match = regex.search(version_file_data)
27
+  if version_match:
28
+    return version_match.groups()
29
+  raise Exception("Unable to find version string.")
30
+
31
+
32
+def main():
33
+  import argparse
34
+  parser = argparse.ArgumentParser(description='Print lz4 version from lib/lz4.h')
35
+  parser.add_argument('file', help='path to lib/lz4.h')
36
+  args = parser.parse_args()
37
+  version_tuple = find_version_tuple(args.file)
38
+  print('.'.join(version_tuple))
39
+
40
+
41
+if __name__ == '__main__':
42
+  main()
(-)b/archivers/liblz4/files/patch-contrib_meson_meson.build (+25 lines)
Added Link Here
1
--- meson.build.orig	2022-08-15 22:45:31.000000000 +0000
2
+++ meson.build	2022-10-25 16:06:36.060399000 +0000
3
@@ -13,15 +13,19 @@
4
 
5
 project(
6
   'lz4',
7
-  ['c'],
8
+  'c',
9
   license: 'BSD-2-Clause-Patent AND GPL-2.0-or-later',
10
   default_options: [
11
     'c_std=c99',
12
     'buildtype=release',
13
     'warning_level=3'
14
   ],
15
-  version: 'DUMMY',
16
-  meson_version: '>=0.49.0'
17
+  version: run_command(
18
+    find_program('GetLz4LibraryVersion.py'),
19
+    '../../lib/lz4.h',
20
+    check: true
21
+  ).stdout().strip(),
22
+  meson_version: '>=0.58.0'
23
 )
24
 
25
 subdir('meson')
(-)b/archivers/liblz4/files/patch-contrib_meson_meson_GetLz4LibraryVersion.py (+42 lines)
Added Link Here
1
--- ./meson/GetLz4LibraryVersion.py.orig	2022-11-09 10:30:08 UTC
2
+++ ./meson/GetLz4LibraryVersion.py
3
@@ -1,39 +0,0 @@
4
-#!/usr/local/bin/python3.9
5
-# #############################################################################
6
-# Copyright (c) 2018-present    lzutao <taolzu(at)gmail.com>
7
-# All rights reserved.
8
-#
9
-# This source code is licensed under both the BSD-style license (found in the
10
-# LICENSE file in the root directory of this source tree) and the GPLv2 (found
11
-# in the COPYING file in the root directory of this source tree).
12
-# #############################################################################
13
-import re
14
-
15
-
16
-def find_version_tuple(filepath):
17
-  version_file_data = None
18
-  with open(filepath) as fd:
19
-    version_file_data = fd.read()
20
-
21
-  patterns = r"""#\s*define\s+LZ4_VERSION_MAJOR\s+([0-9]+).*$
22
-#\s*define\s+LZ4_VERSION_MINOR\s+([0-9]+).*$
23
-#\s*define\s+LZ4_VERSION_RELEASE\s+([0-9]+).*$
24
-"""
25
-  regex = re.compile(patterns, re.MULTILINE)
26
-  version_match = regex.search(version_file_data)
27
-  if version_match:
28
-    return version_match.groups()
29
-  raise Exception("Unable to find version string.")
30
-
31
-
32
-def main():
33
-  import argparse
34
-  parser = argparse.ArgumentParser(description='Print lz4 version from lib/lz4.h')
35
-  parser.add_argument('file', help='path to lib/lz4.h')
36
-  args = parser.parse_args()
37
-  version_tuple = find_version_tuple(args.file)
38
-  print('.'.join(version_tuple))
39
-
40
-
41
-if __name__ == '__main__':
42
-  main()
(-)b/archivers/liblz4/files/patch-contrib_meson_meson_contrib_gen_manual_meson.build (+20 lines)
Added Link Here
1
--- meson/contrib/gen_manual/meson.build.orig	2022-08-15 22:45:31.000000000 +0000
2
+++ meson/contrib/gen_manual/meson.build	2022-11-09 10:56:36.577680000 +0000
3
@@ -10,7 +10,7 @@
4
 
5
 lz4_source_root = '../../../../..'
6
 
7
-add_languages('cpp')
8
+add_languages('cpp', native: true)
9
 
10
 sources = files(
11
   lz4_source_root / 'contrib/gen_manual/gen_manual.cpp'
12
@@ -33,7 +33,7 @@
13
     output: '@0@_manual.html'.format(mp),
14
     command: [
15
       gen_manual,
16
-      lz4_version,
17
+      meson.project_version(),
18
       '@INPUT@',
19
       '@OUTPUT@',
20
     ],
(-)b/archivers/liblz4/files/patch-contrib_meson_meson_lib_meson.build (+70 lines)
Added Link Here
1
--- meson/lib/meson.build.orig	2022-08-15 22:45:31.000000000 +0000
2
+++ meson/lib/meson.build	2022-10-25 16:06:36.060498000 +0000
3
@@ -17,33 +17,32 @@
4
   lz4_source_root / 'lib/xxhash.c'
5
 )
6
 
7
+if get_option('unstable')
8
+  sources += files(lz4_source_root / 'lib/lz4file.c')
9
+endif
10
+
11
 c_args = []
12
 
13
 if host_machine.system() == 'windows' and get_option('default_library') != 'static'
14
   c_args += '-DLZ4_DLL_EXPORT=1'
15
 endif
16
 
17
-if get_option('unstable')
18
-  compile_args += '-DLZ4_STATIC_LINKING_ONLY'
19
-  if get_option('default_library') != 'static'
20
-    c_args += '-DLZ4_PUBLISH_STATIC_FUNCTIONS'
21
-  endif
22
-endif
23
-
24
 liblz4 = library(
25
   'lz4',
26
   sources,
27
+  c_args: c_args,
28
   install: true,
29
-  version: lz4_version,
30
+  version: meson.project_version(),
31
   gnu_symbol_visibility: 'hidden'
32
 )
33
 
34
 liblz4_dep = declare_dependency(
35
   link_with: liblz4,
36
+  compile_args: compile_args,
37
   include_directories: include_directories(lz4_source_root / 'lib')
38
 )
39
 
40
-if get_option('tests') or get_option('programs') or get_option('examples')
41
+if get_option('tests') or get_option('programs') or get_option('examples') or get_option('ossfuzz')
42
   liblz4_internal = static_library(
43
     'lz4-internal',
44
     objects: liblz4.extract_all_objects(recursive: true),
45
@@ -52,6 +51,7 @@
46
 
47
   liblz4_internal_dep = declare_dependency(
48
     link_with: liblz4_internal,
49
+    compile_args: compile_args,
50
     include_directories: include_directories(lz4_source_root / 'lib')
51
   )
52
 endif
53
@@ -61,7 +61,7 @@
54
   name: 'lz4',
55
   filebase: 'liblz4',
56
   description: 'extremely fast lossless compression algorithm library',
57
-  version: lz4_version,
58
+  version: meson.project_version(),
59
   url: 'http://www.lz4.org/'
60
 )
61
 
62
@@ -73,4 +73,8 @@
63
 
64
 if get_option('default_library') != 'shared'
65
   install_headers(lz4_source_root / 'lib/lz4frame_static.h')
66
+endif
67
+
68
+if get_option('unstable')
69
+  install_headers(lz4_source_root / 'lib/lz4file.h')
70
 endif
(-)b/archivers/liblz4/files/patch-contrib_meson_meson_meson.build (+135 lines)
Added Link Here
1
--- meson/meson.build.orig	2022-08-15 22:45:31.000000000 +0000
2
+++ meson/meson.build	2022-10-25 16:06:36.060543000 +0000
3
@@ -10,48 +10,103 @@
4
 
5
 cc = meson.get_compiler('c')
6
 
7
+fs = import('fs')
8
 pkgconfig = import('pkgconfig')
9
 
10
 lz4_source_root = '../../..'
11
 
12
-lz4_version = meson.project_version()
13
-
14
-lz4_h_file = lz4_source_root / 'lib/lz4.h'
15
-GetLz4LibraryVersion_py = find_program('GetLz4LibraryVersion.py')
16
-lz4_version = run_command(GetLz4LibraryVersion_py, lz4_h_file, check: true).stdout().strip()
17
-message('Project version is now: @0@'.format(lz4_version))
18
-
19
 add_project_arguments('-DXXH_NAMESPACE=LZ4_', language: 'c')
20
 
21
 if get_option('debug')
22
-  add_project_arguments(cc.get_supported_arguments([
23
-        '-Wcast-qual',
24
-        '-Wcast-align',
25
-        '-Wshadow',
26
-        '-Wswitch-enum',
27
-        '-Wdeclaration-after-statement',
28
-        '-Wstrict-prototypes',
29
-        '-Wundef',
30
-        '-Wpointer-arith',
31
-        '-Wstrict-aliasing=1',
32
-        '-DLZ4_DEBUG=@0@'.format(get_option('debug-level')),
33
-      ]
34
+  add_project_arguments(cc.get_supported_arguments(
35
+      '-Wcast-qual',
36
+      '-Wcast-align',
37
+      '-Wshadow',
38
+      '-Wswitch-enum',
39
+      '-Wdeclaration-after-statement',
40
+      '-Wstrict-prototypes',
41
+      '-Wundef',
42
+      '-Wpointer-arith',
43
+      '-Wstrict-aliasing=1',
44
+      '-DLZ4_DEBUG=@0@'.format(get_option('debug-level'))
45
     ),
46
-    language: 'c',
47
+    language: 'c'
48
   )
49
 endif
50
 
51
+compile_args = []
52
+
53
+if not get_option('align-test')
54
+  add_project_arguments('-DLZ4_ALIGN_TEST=0', language: 'c')
55
+endif
56
+
57
+if get_option('disable-memory-allocation')
58
+  if get_option('default_library') != 'static'
59
+    error('Memory allocation can only be disabled in static builds')
60
+  endif
61
+
62
+  add_project_arguments('-DLZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION')
63
+  compile_args += '-DLZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION'
64
+endif
65
+
66
+add_project_arguments(
67
+  '-DLZ4_DISTANCE_MAX=@0@'.format(get_option('distance-max')),
68
+  language: 'c'
69
+)
70
+compile_args += '-DLZ4_DISTANCE_MAX=@0@'.format(get_option('distance-max'))
71
+
72
+if not get_option('fast-dec-loop').auto()
73
+  add_project_arguments(
74
+    '-DLZ4_FAST_DEC_LOOP=@0@'.format(
75
+      get_option('fast-dec-loop').enabled() ? 1 : 0
76
+    ),
77
+    language: 'c'
78
+  )
79
+endif
80
+
81
+if get_option('force-sw-bitcount')
82
+  add_project_arguments('-DLZ4_FORCE_SW_BITCOUNT', language: 'c')
83
+endif
84
+
85
+if get_option('freestanding')
86
+  add_project_arguments('-DLZ4_FREESTANDING=1', language: 'c')
87
+  compile_args += '-DLZ4_FREESTANDING=1'
88
+endif
89
+
90
 if get_option('memory-usage') > 0
91
   add_project_arguments(
92
     '-DLZ4_MEMORY_USAGE=@0@'.format(get_option('memory-usage')),
93
     language: 'c'
94
   )
95
+  compile_args += '-DLZ4_MEMORY_USAGE=@0@'.format(get_option('memory-usage'))
96
 endif
97
 
98
+if get_option('unstable')
99
+  add_project_arguments('-DLZ4_STATIC_LINKING_ONLY', language: 'c')
100
+  compile_args += '-DLZ4_STATIC_LINKING_ONLY'
101
+  if get_option('default_library') != 'static'
102
+    add_project_arguments('-DLZ4_PUBLISH_STATIC_FUNCTIONS', language: 'c')
103
+    compile_args += '-DLZ4_PUBLISH_STATIC_FUNCTIONS'
104
+
105
+    add_project_arguments('-DLZ4F_PUBLISH_STATIC_FUNCTIONS', language: 'c')
106
+    compile_args += '-DLZ4F_PUBLISH_STATIC_FUNCTIONS'
107
+  endif
108
+endif
109
+
110
+if get_option('user-memory-functions')
111
+  add_project_arguments('-DLZ4_USER_MEMORY_FUNCTIONS', language: 'c')
112
+endif
113
+
114
+run_env = environment()
115
+
116
 subdir('lib')
117
 
118
 if get_option('programs')
119
   subdir('programs')
120
+else
121
+  lz4 = disabler()
122
+  lz4cat = disabler()
123
+  unlz4 = disabler()
124
 endif
125
 
126
 if get_option('tests')
127
@@ -64,4 +119,8 @@
128
 
129
 if get_option('examples')
130
   subdir('examples')
131
+endif
132
+
133
+if get_option('ossfuzz')
134
+  subdir('ossfuzz')
135
 endif
(-)b/archivers/liblz4/files/patch-contrib_meson_meson_ossfuzz_meson.build (+38 lines)
Added Link Here
1
--- ./meson/ossfuzz/meson.build.orig	2022-11-09 10:03:48 UTC
2
+++ ./meson/ossfuzz/meson.build
3
@@ -0,0 +1,35 @@
4
+fuzzers = [
5
+  'compress_frame_fuzzer',
6
+  'compress_fuzzer',
7
+  'compress_hc_fuzzer',
8
+  'decompress_frame_fuzzer',
9
+  'decompress_fuzzer',
10
+  'round_trip_frame_uncompressed_fuzzer',
11
+  'round_trip_fuzzer',
12
+  'round_trip_hc_fuzzer',
13
+  'round_trip_stream_fuzzer'
14
+]
15
+
16
+c_args = cc.get_supported_arguments(
17
+  '-Wno-unused-function',
18
+  '-Wno-sign-compare',
19
+  '-Wno-declaration-after-statement'
20
+)
21
+
22
+foreach f : fuzzers
23
+  lib = static_library(
24
+    f,
25
+    lz4_source_root / 'ossfuzz/@0@.c'.format(f),
26
+    lz4_source_root / 'ossfuzz/lz4_helpers.c',
27
+    lz4_source_root / 'ossfuzz/fuzz_data_producer.c',
28
+    c_args: c_args,
29
+    dependencies: [liblz4_internal_dep]
30
+  )
31
+
32
+  executable(
33
+    f,
34
+    lz4_source_root / 'ossfuzz/standaloneengine.c',
35
+    link_with: lib,
36
+    dependencies: [liblz4_internal_dep]
37
+  )
38
+endforeach
(-)b/archivers/liblz4/files/patch-contrib_meson_meson_programs_meson.build (+39 lines)
Added Link Here
1
--- meson/programs/meson.build.orig	2022-08-15 22:45:31.000000000 +0000
2
+++ meson/programs/meson.build	2022-11-09 11:25:21.385180000 +0000
3
@@ -26,6 +26,36 @@
4
   install: true
5
 )
6
 
7
+lz4cat = custom_target(
8
+  'lz4cat',
9
+  input: lz4,
10
+  output: 'lz4cat',
11
+  command: [
12
+    'ln',
13
+    '-s',
14
+    '-f',
15
+    fs.name(lz4.full_path()),
16
+    '@OUTPUT@'
17
+  ]
18
+)
19
+
20
+unlz4 = custom_target(
21
+  'unlz4',
22
+  input: lz4,
23
+  output: 'unlz4',
24
+  command: [
25
+    'ln',
26
+    '-s',
27
+    '-f',
28
+    fs.name(lz4.full_path()),
29
+    '@OUTPUT@'
30
+  ]
31
+)
32
+
33
+meson.override_find_program('lz4', lz4)
34
+
35
+run_env.prepend('PATH', meson.current_build_dir())
36
+
37
 install_man(lz4_source_root / 'programs/lz4.1')
38
 
39
 if meson.version().version_compare('>=0.61.0')
(-)b/archivers/liblz4/files/patch-contrib_meson_meson_tests_meson.build (+168 lines)
Added Link Here
1
--- meson/tests/meson.build.orig	2022-08-15 22:45:31.000000000 +0000
2
+++ meson/tests/meson.build	2022-10-25 16:06:36.060705000 +0000
3
@@ -10,43 +10,148 @@
4
 
5
 lz4_source_root = '../../../..'
6
 
7
-exes = {
8
-  'fullbench': {
9
-    'sources': files(lz4_source_root / 'tests/fullbench.c'),
10
+fuzzer_time = 90
11
+test_exes = {
12
+  'abiTest': {
13
+    'sources': files(lz4_source_root / 'tests/abiTest.c'),
14
+    'test': false,
15
+  },
16
+  'checkFrame': {
17
+    'sources': files(lz4_source_root / 'tests/checkFrame.c'),
18
     'include_directories': include_directories(lz4_source_root / 'programs'),
19
   },
20
-  'fuzzer': {
21
-    'sources': files(lz4_source_root / 'tests/fuzzer.c'),
22
+  'checkTag': {
23
+    'sources': files(lz4_source_root / 'tests/checkTag.c'),
24
+    'test': false,
25
+  },
26
+  'datagen': {
27
+    'sources': files(lz4_source_root / 'tests/datagencli.c'),
28
+    'objects': lz4.extract_objects(lz4_source_root / 'programs/datagen.c'),
29
     'include_directories': include_directories(lz4_source_root / 'programs'),
30
   },
31
+  'decompress-partial-usingDict.c': {
32
+    'sources': files(lz4_source_root / 'tests/decompress-partial-usingDict.c'),
33
+  },
34
+  'decompress-partial.c': {
35
+    'sources': files(lz4_source_root / 'tests/decompress-partial.c'),
36
+  },
37
   'frametest': {
38
     'sources': files(lz4_source_root / 'tests/frametest.c'),
39
     'include_directories': include_directories(lz4_source_root / 'programs'),
40
+    'args': ['-v', '-T@0@s'.format(fuzzer_time)],
41
+    'test': false,
42
   },
43
-  'roundTripTest': {
44
-    'sources': files(lz4_source_root / 'tests/roundTripTest.c'),
45
+  'freestanding': {
46
+    'sources': files(lz4_source_root / 'tests/freestanding.c'),
47
+    'c_args': ['-ffreestanding', '-Wno-unused-parameter', '-Wno-declaration-after-statement'],
48
+    'link_args': ['-nostdlib'],
49
+    'build': cc.get_id() in ['gcc', 'clang'],
50
+    'override_options': ['optimization=1']
51
   },
52
-  'datagen': {
53
-    'sources': files(lz4_source_root / 'tests/datagencli.c'),
54
-    'objects': lz4.extract_objects(lz4_source_root / 'programs/datagen.c'),
55
+  'fullbench': {
56
+    'sources': files(lz4_source_root / 'tests/fullbench.c'),
57
     'include_directories': include_directories(lz4_source_root / 'programs'),
58
+    'args': ['--no-prompt', '-i1', files(lz4_source_root / 'tests/COPYING')],
59
+    'test': false,
60
   },
61
-  'checkFrame': {
62
-    'sources': files(lz4_source_root / 'tests/checkFrame.c'),
63
+  'fuzzer': {
64
+    'sources': files(lz4_source_root / 'tests/fuzzer.c'),
65
     'include_directories': include_directories(lz4_source_root / 'programs'),
66
+    'args': ['-T@0@s'.format(fuzzer_time)],
67
+    'test': false,
68
   },
69
-  'checkTag': {
70
-    'sources': files(lz4_source_root / 'tests/checkTag.c'),
71
+  'roundTripTest': {
72
+    'sources': files(lz4_source_root / 'tests/roundTripTest.c'),
73
+    'test': false,
74
   },
75
 }
76
 
77
-foreach e, attrs : exes
78
-  executable(
79
+targets = {}
80
+
81
+foreach e, attrs : test_exes
82
+  if not attrs.get('build', true)
83
+    targets += {e: disabler()}
84
+    continue
85
+  endif
86
+
87
+  t = executable(
88
     e,
89
     attrs.get('sources'),
90
+    c_args: attrs.get('c_args', []),
91
+    link_args: attrs.get('link_args', []),
92
     objects: attrs.get('objects', []),
93
     dependencies: [liblz4_internal_dep],
94
     include_directories: attrs.get('include_directories', []),
95
-    install: false
96
+    install: false,
97
+    override_options: attrs.get('override_options', [])
98
+  )
99
+
100
+  targets += {e: t}
101
+
102
+  if not attrs.get('test', true)
103
+    continue
104
+  endif
105
+
106
+  test(
107
+    e,
108
+    t,
109
+    args: attrs.get('params', []),
110
+    timeout: 120
111
+  )
112
+endforeach
113
+
114
+fs = import('fs')
115
+
116
+run_env.prepend('PATH', meson.current_build_dir())
117
+
118
+test_scripts = {
119
+  'lz4-basic': {
120
+    'depends': [lz4, lz4cat, unlz4, targets['datagen']],
121
+  },
122
+  'lz4-dict': {
123
+    'depends': [lz4, targets['datagen']],
124
+  },
125
+  'lz4-contentSize': {
126
+    'depends': [lz4, targets['datagen']],
127
+  },
128
+  'lz4-fast-hugefile': {
129
+    'depends': [lz4, targets['datagen']],
130
+  },
131
+  'lz4-frame-concatenation': {
132
+    'depends': [lz4, targets['datagen']],
133
+  },
134
+  'lz4-multiple': {
135
+    'depends': [lz4, targets['datagen']],
136
+  },
137
+  'lz4-multiple-legacy': {
138
+    'depends': [lz4, targets['datagen']],
139
+  },
140
+  'lz4-opt-parser': {
141
+    'depends': [lz4, targets['datagen']],
142
+  },
143
+  'lz4-skippable': {
144
+    'depends': [lz4],
145
+  },
146
+  'lz4-sparse': {
147
+    'depends': [lz4, targets['datagen']],
148
+  },
149
+  'lz4-testmode': {
150
+    'depends': [lz4, targets['datagen']],
151
+  },
152
+  'lz4hc-hugefile': {
153
+    'depends': [lz4, targets['datagen']],
154
+  },
155
+}
156
+
157
+foreach s, attrs : test_scripts
158
+  script = find_program(lz4_source_root / 'tests/test-@0@.sh'.format(s))
159
+
160
+  test(
161
+    '@0@'.format(s),
162
+    script,
163
+    depends: attrs.get('depends', []),
164
+    workdir: fs.parent(script.full_path()),
165
+    env: run_env,
166
+    timeout: 360
167
   )
168
 endforeach
(-)b/archivers/liblz4/files/patch-tests_Makefile (+336 lines)
Added Link Here
1
--- ../../tests/Makefile.orig	2022-08-15 22:45:31.000000000 +0000
2
+++ ../../tests/Makefile	2022-10-25 16:11:39.498501000 +0000
3
@@ -173,6 +173,7 @@
4
 CAT:=cat
5
 DD:=dd
6
 DATAGEN:=./datagen
7
+PATH:=../programs:$(shell pwd):$(PATH)
8
 
9
 .PHONY: list
10
 list:
11
@@ -211,312 +212,55 @@
12
 # All FPREFIX must start with `tmp`, for `make clean`
13
 # All tests must clean their temporary test files on successful completion,
14
 # and only their test files : do not employ sweeping statements such `rm tmp*` or `rm *.lz4`
15
-test-lz4-sparse: FPREFIX = tmp-tls
16
 test-lz4-sparse: lz4 datagen
17
 	@echo "\n ---- test sparse file support ----"
18
-	$(DATAGEN) -g5M  -P100 > $(FPREFIX)dg5M
19
-	$(LZ4) -B4D $(FPREFIX)dg5M -c | $(LZ4) -dv --sparse > $(FPREFIX)cB4
20
-	$(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)cB4
21
-	$(LZ4) -B5D $(FPREFIX)dg5M -c | $(LZ4) -dv --sparse > $(FPREFIX)cB5
22
-	$(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)cB5
23
-	$(LZ4) -B6D $(FPREFIX)dg5M -c | $(LZ4) -dv --sparse > $(FPREFIX)cB6
24
-	$(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)cB6
25
-	$(LZ4) -B7D $(FPREFIX)dg5M -c | $(LZ4) -dv --sparse > $(FPREFIX)cB7
26
-	$(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)cB7
27
-	$(LZ4) $(FPREFIX)dg5M -c | $(LZ4) -dv --no-sparse > $(FPREFIX)nosparse
28
-	$(DIFF) -s $(FPREFIX)dg5M $(FPREFIX)nosparse
29
-	ls -ls $(FPREFIX)*
30
-	$(DATAGEN) -s1 -g1200007 -P100 | $(LZ4) | $(LZ4) -dv --sparse > $(FPREFIX)odd   # Odd size file (to generate non-full last block)
31
-	$(DATAGEN) -s1 -g1200007 -P100 | $(DIFF) -s - $(FPREFIX)odd
32
-	ls -ls $(FPREFIX)odd
33
-	@$(RM) $(FPREFIX)*
34
-	@echo "\n Compatibility with Console :"
35
-	echo "Hello World 1 !" | $(LZ4) | $(LZ4) -d -c
36
-	echo "Hello World 2 !" | $(LZ4) | $(LZ4) -d | $(CAT)
37
-	echo "Hello World 3 !" | $(LZ4) --no-frame-crc | $(LZ4) -d -c
38
-	@echo "\n Compatibility with Append :"
39
-	$(DATAGEN) -P100 -g1M > $(FPREFIX)dg1M
40
-	$(CAT) $(FPREFIX)dg1M $(FPREFIX)dg1M > $(FPREFIX)2M
41
-	$(LZ4) -B5 -v $(FPREFIX)dg1M $(FPREFIX)c
42
-	$(LZ4) -d -v $(FPREFIX)c $(FPREFIX)r
43
-	$(LZ4) -d -v $(FPREFIX)c -c >> $(FPREFIX)r
44
-	ls -ls $(FPREFIX)*
45
-	$(DIFF) $(FPREFIX)2M $(FPREFIX)r
46
-	@$(RM) $(FPREFIX)*
47
+	PATH=$(PATH) ./test-lz4-sparse.sh
48
 
49
-test-lz4-contentSize: FPREFIX = tmp-lzc
50
 test-lz4-contentSize: lz4 datagen
51
 	@echo "\n ---- test original size support ----"
52
-	$(DATAGEN) -g15M > $(FPREFIX)
53
-	$(LZ4) -v $(FPREFIX) -c | $(LZ4) -t
54
-	$(LZ4) -v --content-size $(FPREFIX) -c | $(LZ4) -d > $(FPREFIX)-dup
55
-	$(DIFF) $(FPREFIX) $(FPREFIX)-dup
56
-	$(LZ4) -f $(FPREFIX) -c > $(FPREFIX).lz4 # compressed with content size
57
-	$(LZ4) --content-size $(FPREFIX) -c > $(FPREFIX)-wcz.lz4
58
-	! $(DIFF) $(FPREFIX).lz4 $(FPREFIX)-wcz.lz4  # must differ, due to content size
59
-	$(LZ4) --content-size < $(FPREFIX) > $(FPREFIX)-wcz2.lz4 # can determine content size because stdin is just a file
60
-	$(DIFF) $(FPREFIX)-wcz.lz4 $(FPREFIX)-wcz2.lz4  # both must contain content size
61
-	$(CAT) $(FPREFIX) | $(LZ4) > $(FPREFIX)-ncz.lz4
62
-	$(DIFF) $(FPREFIX).lz4 $(FPREFIX)-ncz.lz4  # both don't have content size
63
-	$(CAT) $(FPREFIX) | $(LZ4) --content-size > $(FPREFIX)-ncz2.lz4 # can't determine content size
64
-	$(DIFF) $(FPREFIX).lz4 $(FPREFIX)-ncz2.lz4  # both don't have content size
65
-	@$(RM) $(FPREFIX)*
66
+	PATH=$(PATH) ./test-lz4-contentSize.sh
67
 
68
-test-lz4-frame-concatenation: FPREFIX = tmp-lfc
69
 test-lz4-frame-concatenation: lz4 datagen
70
 	@echo "\n ---- test frame concatenation ----"
71
-	@echo -n > $(FPREFIX)-empty
72
-	@echo hi > $(FPREFIX)-nonempty
73
-	$(CAT) $(FPREFIX)-nonempty $(FPREFIX)-empty $(FPREFIX)-nonempty > $(FPREFIX)-src
74
-	$(LZ4) -zq $(FPREFIX)-empty -c > $(FPREFIX)-empty.lz4
75
-	$(LZ4) -zq $(FPREFIX)-nonempty -c > $(FPREFIX)-nonempty.lz4
76
-	$(CAT) $(FPREFIX)-nonempty.lz4 $(FPREFIX)-empty.lz4 $(FPREFIX)-nonempty.lz4 > $(FPREFIX)-concat.lz4
77
-	$(LZ4) -d $(FPREFIX)-concat.lz4 -c > $(FPREFIX)-result
78
-	$(CMP) $(FPREFIX)-src $(FPREFIX)-result
79
-	@$(RM) $(FPREFIX)*
80
-	@echo frame concatenation test completed
81
+	PATH=$(PATH) ./test-lz4-frame-concatenation.sh
82
 
83
-test-lz4-multiple: FPREFIX = tmp-tml
84
 test-lz4-multiple: lz4 datagen
85
 	@echo "\n ---- test multiple files ----"
86
-	@$(DATAGEN) -s1        > $(FPREFIX)1 2> $(VOID)
87
-	@$(DATAGEN) -s2 -g100K > $(FPREFIX)2 2> $(VOID)
88
-	@$(DATAGEN) -s3 -g200K > $(FPREFIX)3 2> $(VOID)
89
-	# compress multiple files : one .lz4 per source file
90
-	$(LZ4) -f -m $(FPREFIX)*
91
-	test -f $(FPREFIX)1.lz4
92
-	test -f $(FPREFIX)2.lz4
93
-	test -f $(FPREFIX)3.lz4
94
-	# decompress multiple files : one output file per .lz4
95
-	mv $(FPREFIX)1 $(FPREFIX)1-orig
96
-	mv $(FPREFIX)2 $(FPREFIX)2-orig
97
-	mv $(FPREFIX)3 $(FPREFIX)3-orig
98
-	$(LZ4) -d -f -m $(FPREFIX)*.lz4
99
-	$(CMP) $(FPREFIX)1 $(FPREFIX)1-orig   # must be identical
100
-	$(CMP) $(FPREFIX)2 $(FPREFIX)2-orig
101
-	$(CMP) $(FPREFIX)3 $(FPREFIX)3-orig
102
-	# compress multiple files into stdout
103
-	$(CAT) $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 > $(FPREFIX)-concat1
104
-	$(RM) $(FPREFIX)*.lz4
105
-	$(LZ4) -m $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 -c > $(FPREFIX)-concat2
106
-	test ! -f $(FPREFIX)1.lz4  # must not create .lz4 artefact
107
-	$(CMP) $(FPREFIX)-concat1 $(FPREFIX)-concat2  # must be equivalent
108
-	# decompress multiple files into stdout
109
-	$(RM) $(FPREFIX)-concat1 $(FPREFIX)-concat2
110
-	$(LZ4) -f -m $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3   # generate .lz4 to decompress
111
-	$(CAT) $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 > $(FPREFIX)-concat1   # create concatenated reference
112
-	$(RM) $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3
113
-	$(LZ4) -d -m $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 -c > $(FPREFIX)-concat2
114
-	test ! -f $(FPREFIX)1  # must not create file artefact
115
-	$(CMP) $(FPREFIX)-concat1 $(FPREFIX)-concat2  # must be equivalent
116
-	# compress multiple files, one of which is absent (must fail)
117
-	! $(LZ4) -f -m $(FPREFIX)-concat1 notHere $(FPREFIX)-concat2  # must fail : notHere not present
118
-	# test lz4-compressed file
119
-	$(LZ4) -tm $(FPREFIX)-concat1.lz4
120
-	$(LZ4) -tm $(FPREFIX)-concat1.lz4 $(FPREFIX)-concat2.lz4
121
-	# test multiple lz4 files, one of which is absent (must fail)
122
-	! $(LZ4) -tm $(FPREFIX)-concat1.lz4 notHere.lz4 $(FPREFIX)-concat2.lz4
123
-	@$(RM) $(FPREFIX)*
124
+	PATH=$(PATH) ./test-lz4-multiple.sh
125
 
126
-test-lz4-multiple-legacy: FPREFIX = tmp-lml
127
 test-lz4-multiple-legacy: lz4 datagen
128
 	@echo "\n ---- test multiple files (Legacy format) ----"
129
-	@$(DATAGEN) -s1        > $(FPREFIX)1 2> $(VOID)
130
-	@$(DATAGEN) -s2 -g100K > $(FPREFIX)2 2> $(VOID)
131
-	@$(DATAGEN) -s3 -g200K > $(FPREFIX)3 2> $(VOID)
132
-	# compress multiple files using legacy format: one .lz4 per source file
133
-	$(LZ4) -f -l -m $(FPREFIX)*
134
-	test -f $(FPREFIX)1.lz4
135
-	test -f $(FPREFIX)2.lz4
136
-	test -f $(FPREFIX)3.lz4
137
-	# decompress multiple files compressed using legacy format: one output file per .lz4
138
-	mv $(FPREFIX)1 $(FPREFIX)1-orig
139
-	mv $(FPREFIX)2 $(FPREFIX)2-orig
140
-	mv $(FPREFIX)3 $(FPREFIX)3-orig
141
-	$(LZ4) -d -f -m $(FPREFIX)*.lz4
142
-	$(LZ4) -l -d -f -m $(FPREFIX)*.lz4 # -l mustn't impact -d option
143
-	$(CMP) $(FPREFIX)1 $(FPREFIX)1-orig   # must be identical
144
-	$(CMP) $(FPREFIX)2 $(FPREFIX)2-orig
145
-	$(CMP) $(FPREFIX)3 $(FPREFIX)3-orig
146
-	# compress multiple files into stdout using legacy format
147
-	$(CAT) $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 > $(FPREFIX)-concat1
148
-	$(RM) $(FPREFIX)*.lz4
149
-	$(LZ4) -l -m $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 -c > $(FPREFIX)-concat2
150
-	test ! -f $(FPREFIX)1.lz4  # must not create .lz4 artefact
151
-	$(CMP) $(FPREFIX)-concat1 $(FPREFIX)-concat2  # must be equivalent
152
-	# # # decompress multiple files into stdout using legacy format
153
-	$(RM) $(FPREFIX)-concat1 $(FPREFIX)-concat2
154
-	$(LZ4) -l -f -m $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3   # generate .lz4 to decompress
155
-	$(CAT) $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3 > $(FPREFIX)-concat1   # create concatenated reference
156
-	$(RM) $(FPREFIX)1 $(FPREFIX)2 $(FPREFIX)3
157
-	$(LZ4) -d -m $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 -c > $(FPREFIX)-concat2
158
-	$(LZ4) -d -l -m $(FPREFIX)1.lz4 $(FPREFIX)2.lz4 $(FPREFIX)3.lz4 -c > $(FPREFIX)-concat2 # -l mustn't impact option -d
159
-	test ! -f $(FPREFIX)1  # must not create file artefact
160
-	$(CMP) $(FPREFIX)-concat1 $(FPREFIX)-concat2  # must be equivalent
161
-	# # # compress multiple files, one of which is absent (must fail)
162
-	! $(LZ4) -f -l -m $(FPREFIX)-concat1 notHere-legacy $(FPREFIX)-concat2  # must fail : notHere-legacy not present
163
-	@$(RM) $(FPREFIX)*
164
+	PATH=$(PATH) ./test-lz4-multiple-legacy.sh
165
 
166
-SKIPFILE = goldenSamples/skip.bin
167
-test-lz4-skippable: FPREFIX = tmp-lsk
168
-test-lz4-skippable: lz4 datagen
169
+test-lz4-skippable: lz4
170
 	@echo "\n ---- test lz4 with skippable frames ----"
171
-	$(LZ4) -dc $(SKIPFILE)
172
-	$(LZ4) -dc < $(SKIPFILE)
173
-	cat $(SKIPFILE) | $(LZ4) -dc
174
-	echo "Hello from Valid Frame!\n" | $(LZ4) -c > $(FPREFIX).lz4
175
-	cat $(SKIPFILE) $(FPREFIX).lz4 $(SKIPFILE) | $(LZ4) -dc
176
-	$(RM) $(FPREFIX)*
177
+	PATH=$(PATH) ./test-lz4-skippable.sh
178
 
179
-test-lz4-basic: FPREFIX = tmp-tlb
180
 test-lz4-basic: lz4 datagen unlz4 lz4cat
181
 	@echo "\n ---- test lz4 basic compression/decompression ----"
182
-	$(DATAGEN) -g0       | $(LZ4) -v     | $(LZ4) -t
183
-	$(DATAGEN) -g16KB    | $(LZ4) -9     | $(LZ4) -t
184
-	$(DATAGEN) -g20KB > $(FPREFIX)-dg20k
185
-	$(LZ4) < $(FPREFIX)-dg20k | $(LZ4) -d > $(FPREFIX)-dec
186
-	$(DIFF) -q $(FPREFIX)-dg20k $(FPREFIX)-dec
187
-	$(LZ4) --no-frame-crc < $(FPREFIX)-dg20k | $(LZ4) -d > $(FPREFIX)-dec
188
-	$(DIFF) -q $(FPREFIX)-dg20k $(FPREFIX)-dec
189
-	$(DATAGEN)           | $(LZ4) -BI    | $(LZ4) -t
190
-	$(DATAGEN)           | $(LZ4) --no-crc | $(LZ4) -t
191
-	$(DATAGEN) -g6M -P99 | $(LZ4) -9BD   | $(LZ4) -t
192
-	$(DATAGEN) -g17M     | $(LZ4) -9v    | $(LZ4) -qt
193
-	$(DATAGEN) -g33M     | $(LZ4) --no-frame-crc | $(LZ4) -t
194
-	$(DATAGEN) -g256MB   | $(LZ4) -vqB4D | $(LZ4) -t --no-crc
195
-	@echo "hello world" > $(FPREFIX)-hw
196
-	$(LZ4) --rm -f $(FPREFIX)-hw $(FPREFIX)-hw.lz4
197
-	test ! -f $(FPREFIX)-hw                      # must fail (--rm)
198
-	test   -f $(FPREFIX)-hw.lz4
199
-	$(PRGDIR)/lz4cat $(FPREFIX)-hw.lz4 | $(GREP) "hello world"
200
-	$(PRGDIR)/unlz4 --rm $(FPREFIX)-hw.lz4 $(FPREFIX)-hw
201
-	test   -f $(FPREFIX)-hw
202
-	test ! -f $(FPREFIX)-hw.lz4                  # must fail (--rm)
203
-	test ! -f $(FPREFIX)-hw.lz4.lz4              # must fail (unlz4)
204
-	$(PRGDIR)/lz4cat $(FPREFIX)-hw               # pass-through mode
205
-	test   -f $(FPREFIX)-hw
206
-	test ! -f $(FPREFIX)-hw.lz4                  # must fail (lz4cat)
207
-	$(LZ4) $(FPREFIX)-hw $(FPREFIX)-hw.lz4          # creates $(FPREFIX)-hw.lz4
208
-	$(PRGDIR)/lz4cat < $(FPREFIX)-hw.lz4 > $(FPREFIX)3  # checks lz4cat works with stdin (#285)
209
-	$(DIFF) -q $(FPREFIX)-hw $(FPREFIX)3
210
-	$(PRGDIR)/lz4cat < $(FPREFIX)-hw > $(FPREFIX)2      # checks lz4cat works in pass-through mode
211
-	$(DIFF) -q $(FPREFIX)-hw $(FPREFIX)2
212
-	cp $(FPREFIX)-hw ./-d
213
-	$(LZ4) --rm -- -d -d.lz4               # compresses ./d into ./-d.lz4
214
-	test   -f ./-d.lz4
215
-	test ! -f ./-d
216
-	mv ./-d.lz4 ./-z
217
-	$(LZ4) -d --rm -- -z $(FPREFIX)4          # uncompresses ./-z into $(FPREFIX)4
218
-	test ! -f ./-z
219
-	$(DIFF) -q $(FPREFIX)-hw $(FPREFIX)4
220
-	! $(LZ4) $(FPREFIX)2 $(FPREFIX)3 $(FPREFIX)4    # must fail: refuse to handle 3+ file names
221
-	$(LZ4) -f $(FPREFIX)-hw                   # create $(FPREFIX)-hw.lz4, for next tests
222
-	$(LZ4) --list $(FPREFIX)-hw.lz4           # test --list on valid single-frame file
223
-	$(LZ4) --list < $(FPREFIX)-hw.lz4         # test --list from stdin (file only)
224
-	$(CAT) $(FPREFIX)-hw >> $(FPREFIX)-hw.lz4
225
-	! $(LZ4) -f $(FPREFIX)-hw.lz4             # uncompress valid frame followed by invalid data (must fail now)
226
-	$(LZ4) -BX $(FPREFIX)-hw -c -q | $(LZ4) -tv  # test block checksum
227
-	# $(DATAGEN) -g20KB generates the same file every single time
228
-	# cannot save output of $(DATAGEN) -g20KB as input file to lz4 because the following shell commands are run before $(DATAGEN) -g20KB
229
-	test "$(shell $(DATAGEN) -g20KB | $(LZ4) -c --fast | wc -c)" -lt "$(shell $(DATAGEN) -g20KB | $(LZ4) -c --fast=9 | wc -c)" # -1 vs -9
230
-	test "$(shell $(DATAGEN) -g20KB | $(LZ4) -c -1 | wc -c)" -lt "$(shell $(DATAGEN) -g20KB| $(LZ4) -c --fast=1 | wc -c)" # 1 vs -1
231
-	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
232
-	! $(LZ4) -c --fast=0 $(FPREFIX)-dg20K # lz4 should fail when fast=0
233
-	! $(LZ4) -c --fast=-1 $(FPREFIX)-dg20K # lz4 should fail when fast=-1
234
-	# High --fast values can result in out-of-bound dereferences #876
235
-	$(DATAGEN) -g1M | $(LZ4) -c --fast=999999999 > /dev/null
236
-	# Test for #596
237
-	@echo "TEST" > $(FPREFIX)-test
238
-	$(LZ4) -m $(FPREFIX)-test
239
-	$(LZ4) $(FPREFIX)-test.lz4 $(FPREFIX)-test2
240
-	$(DIFF) -q $(FPREFIX)-test $(FPREFIX)-test2
241
-	@$(RM) $(FPREFIX)*
242
+	PATH=$(PATH) ./test-lz4-basic.sh
243
 
244
-
245
-test-lz4-dict: FPREFIX = tmp-dict
246
 test-lz4-dict: lz4 datagen
247
 	@echo "\n ---- test lz4 compression/decompression with dictionary ----"
248
-	$(DATAGEN) -g16KB > $(FPREFIX)
249
-	$(DATAGEN) -g32KB > $(FPREFIX)-sample-32k
250
-	< $(FPREFIX)-sample-32k $(LZ4) -D $(FPREFIX) | $(LZ4) -dD $(FPREFIX) | diff - $(FPREFIX)-sample-32k
251
-	$(DATAGEN) -g128MB > $(FPREFIX)-sample-128m
252
-	< $(FPREFIX)-sample-128m $(LZ4) -D $(FPREFIX) | $(LZ4) -dD $(FPREFIX) | diff - $(FPREFIX)-sample-128m
253
-	touch $(FPREFIX)-sample-0
254
-	< $(FPREFIX)-sample-0 $(LZ4) -D $(FPREFIX) | $(LZ4) -dD $(FPREFIX) | diff - $(FPREFIX)-sample-0
255
+	PATH=$(PATH) ./test-lz4-dict.sh
256
 
257
-	< $(FPREFIX)-sample-32k $(LZ4) -D $(FPREFIX)-sample-0 | $(LZ4) -dD $(FPREFIX)-sample-0 | diff - $(FPREFIX)-sample-32k
258
-	< $(FPREFIX)-sample-0 $(LZ4) -D $(FPREFIX)-sample-0 | $(LZ4) -dD $(FPREFIX)-sample-0 | diff - $(FPREFIX)-sample-0
259
-
260
-	@echo "\n ---- test lz4 dictionary loading ----"
261
-	$(DATAGEN) -g128KB > $(FPREFIX)-data-128KB
262
-	set -e; \
263
-	for l in 0 1 4 128 32767 32768 32769 65535 65536 65537 98303 98304 98305 131071 131072 131073; do \
264
-		$(DATAGEN) -g$$l > $(FPREFIX)-$$l; \
265
-		$(DD) if=$(FPREFIX)-$$l of=$(FPREFIX)-$$l-tail bs=1 count=65536 skip=$$((l > 65536 ? l - 65536 : 0)); \
266
-		< $(FPREFIX)-$$l      $(LZ4) -D stdin $(FPREFIX)-data-128KB -c | $(LZ4) -dD $(FPREFIX)-$$l-tail | $(DIFF) - $(FPREFIX)-data-128KB; \
267
-		< $(FPREFIX)-$$l-tail $(LZ4) -D stdin $(FPREFIX)-data-128KB -c | $(LZ4) -dD $(FPREFIX)-$$l      | $(DIFF) - $(FPREFIX)-data-128KB; \
268
-	done
269
-	@$(RM) $(FPREFIX)*
270
-
271
 test-lz4hc-hugefile: lz4 datagen
272
 	@echo "\n ---- test HC compression/decompression of huge files ----"
273
-	$(DATAGEN) -g4200MB | $(LZ4) -v3BD | $(LZ4) -qt
274
+	PATH=$(PATH) ./test-lz4hc-hugefile.sh
275
 
276
-test-lz4-fast-hugefile: FPREFIX = tmp-lfh
277
 test-lz4-fast-hugefile: lz4 datagen
278
 	@echo "\n ---- test huge files compression/decompression ----"
279
-	$(DATAGEN) -g6GB    | $(LZ4) -vB5D | $(LZ4) -qt
280
-	# test large file size [2-4] GB
281
-	@$(DATAGEN) -g3G -P100 | $(LZ4) -vv | $(LZ4) --decompress --force --sparse - $(FPREFIX)1
282
-	@ls -ls $(FPREFIX)1
283
-	@$(DATAGEN) -g3G -P100 | $(LZ4) --quiet --content-size | $(LZ4) --verbose --decompress --force --sparse - $(FPREFIX)2
284
-	@ls -ls $(FPREFIX)2
285
-	$(DIFF) -s $(FPREFIX)1 $(FPREFIX)2
286
-	@$(RM) $(FPREFIX)*
287
+	PATH=$(PATH) ./test-lz4-fast-hugefile.sh
288
 
289
 test-lz4-hugefile: test-lz4-fast-hugefile test-lz4hc-hugefile
290
 
291
-test-lz4-testmode: FPREFIX = tmp-ltm
292
 test-lz4-testmode: lz4 datagen
293
 	@echo "\n ---- bench mode ----"
294
-	$(LZ4) -bi0
295
-	$(DATAGEN) > $(FPREFIX)
296
-	$(LZ4) -f $(FPREFIX) -c > $(FPREFIX).lz4
297
-	$(LZ4) -bdi0 $(FPREFIX).lz4 # test benchmark decode-only mode
298
-	$(LZ4) -bdi0 --no-crc $(FPREFIX).lz4 # test benchmark decode-only mode
299
-	@echo "\n ---- test mode ----"
300
-	! $(DATAGEN) | $(LZ4) -t
301
-	! $(DATAGEN) | $(LZ4) -tf
302
-	@echo "\n ---- pass-through mode ----"
303
-	@echo "Why hello there " > $(FPREFIX)2.lz4
304
-	! $(LZ4) -f $(FPREFIX)2.lz4 > $(VOID)
305
-	! $(DATAGEN) | $(LZ4) -dc  > $(VOID)
306
-	! $(DATAGEN) | $(LZ4) -df > $(VOID)
307
-	$(DATAGEN) | $(LZ4) -dcf > $(VOID)
308
-	@echo "Hello World !" > $(FPREFIX)1
309
-	$(LZ4) -dcf $(FPREFIX)1
310
-	@echo "from underground..." > $(FPREFIX)2
311
-	$(LZ4) -dcfm $(FPREFIX)1 $(FPREFIX)2
312
-	@echo "\n ---- non-existing source (must fail cleanly) ----"
313
-	! $(LZ4)     file-does-not-exist
314
-	! $(LZ4) -f  file-does-not-exist
315
-	! $(LZ4) -t  file-does-not-exist
316
-	! $(LZ4) -fm file1-dne file2-dne
317
-	@$(RM) $(FPREFIX)*
318
+	PATH=$(PATH) ./test-lz4-testmode.sh
319
 
320
 test-lz4-opt-parser: lz4 datagen
321
 	@echo "\n ---- test opt-parser ----"
322
-	$(DATAGEN) -g16KB      | $(LZ4) -12      | $(LZ4) -t
323
-	$(DATAGEN) -P10        | $(LZ4) -12B4    | $(LZ4) -t
324
-	$(DATAGEN) -g256K      | $(LZ4) -12B4D   | $(LZ4) -t
325
-	$(DATAGEN) -g512K -P25 | $(LZ4) -12BD    | $(LZ4) -t
326
-	$(DATAGEN) -g1M        | $(LZ4) -12B5    | $(LZ4) -t
327
-	$(DATAGEN) -g1M -s2    | $(LZ4) -12B4D   | $(LZ4) -t
328
-	$(DATAGEN) -g2M -P99   | $(LZ4) -11B4D   | $(LZ4) -t
329
-	$(DATAGEN) -g4M        | $(LZ4) -11vq    | $(LZ4) -qt
330
-	$(DATAGEN) -g8M        | $(LZ4) -11B4    | $(LZ4) -t
331
-	$(DATAGEN) -g16M -P90  | $(LZ4) -11B5    | $(LZ4) -t
332
-	$(DATAGEN) -g32M -P10  | $(LZ4) -11B5D   | $(LZ4) -t
333
+	PATH=$(PATH) ./test-lz4-opt-parser.sh
334
 
335
 test-lz4-essentials : lz4 datagen test-lz4-basic test-lz4-multiple test-lz4-multiple-legacy \
336
                       test-lz4-frame-concatenation test-lz4-testmode \
(-)b/archivers/liblz4/files/patch-tests_test-lz4-abi.py (+8 lines)
Added Link Here
1
--- ../../tests/test-lz4-abi.py.orig	2022-11-09 11:07:46.661552000 +0000
2
+++ ../../tests/test-lz4-abi.py	2022-10-25 15:57:45.243470000 +0000
3
@@ -1,4 +1,4 @@
4
-#!/usr/local/bin/python3.9
5
+#!/usr/bin/env python3
6
 """Test LZ4 interoperability between versions"""
7
 
8
 #
(-)b/archivers/liblz4/files/patch-tests_test-lz4-basic.sh (+76 lines)
Added Link Here
1
--- ../../tests/test-lz4-basic.sh.orig	2022-11-09 10:00:59 UTC
2
+++ ../../tests/test-lz4-basic.sh
3
@@ -0,0 +1,73 @@
4
+#!/bin/sh
5
+
6
+FPREFIX="tmp-tlb"
7
+
8
+set -e
9
+
10
+remove () {
11
+    rm $FPREFIX*
12
+}
13
+
14
+trap remove EXIT
15
+
16
+set -x
17
+
18
+datagen -g0       | lz4 -v     | lz4 -t
19
+datagen -g16KB    | lz4 -9     | lz4 -t
20
+datagen -g20KB > $FPREFIX-dg20k
21
+lz4 < $FPREFIX-dg20k | lz4 -d > $FPREFIX-dec
22
+diff -q $FPREFIX-dg20k $FPREFIX-dec
23
+lz4 --no-frame-crc < $FPREFIX-dg20k | lz4 -d > $FPREFIX-dec
24
+diff -q $FPREFIX-dg20k $FPREFIX-dec
25
+datagen           | lz4 -BI    | lz4 -t
26
+datagen           | lz4 --no-crc | lz4 -t
27
+datagen -g6M -P99 | lz4 -9BD   | lz4 -t
28
+datagen -g17M     | lz4 -9v    | lz4 -qt
29
+datagen -g33M     | lz4 --no-frame-crc | lz4 -t
30
+datagen -g256MB   | lz4 -vqB4D | lz4 -t --no-crc
31
+echo "hello world" > $FPREFIX-hw
32
+lz4 --rm -f $FPREFIX-hw $FPREFIX-hw.lz4
33
+test ! -f $FPREFIX-hw                      # must fail (--rm)
34
+test   -f $FPREFIX-hw.lz4
35
+lz4cat $FPREFIX-hw.lz4 | grep "hello world"
36
+unlz4 --rm $FPREFIX-hw.lz4 $FPREFIX-hw
37
+test   -f $FPREFIX-hw
38
+test ! -f $FPREFIX-hw.lz4                  # must fail (--rm)
39
+test ! -f $FPREFIX-hw.lz4.lz4              # must fail (unlz4)
40
+lz4cat $FPREFIX-hw               # pass-through mode
41
+test   -f $FPREFIX-hw
42
+test ! -f $FPREFIX-hw.lz4                  # must fail (lz4cat)
43
+lz4 $FPREFIX-hw $FPREFIX-hw.lz4          # creates $FPREFIX-hw.lz4
44
+lz4cat < $FPREFIX-hw.lz4 > ${FPREFIX}3  # checks lz4cat works with stdin (#285)
45
+diff -q $FPREFIX-hw ${FPREFIX}3
46
+lz4cat < $FPREFIX-hw > ${FPREFIX}2      # checks lz4cat works in pass-through mode
47
+diff -q $FPREFIX-hw ${FPREFIX}2
48
+cp $FPREFIX-hw ./-d
49
+lz4 --rm -- -d -d.lz4               # compresses ./d into ./-d.lz4
50
+test   -f ./-d.lz4
51
+test ! -f ./-d
52
+mv ./-d.lz4 ./-z
53
+lz4 -d --rm -- -z ${FPREFIX}4          # uncompresses ./-z into $FPREFIX4
54
+test ! -f ./-z
55
+diff -q $FPREFIX-hw ${FPREFIX}4
56
+lz4 ${FPREFIX}2 ${FPREFIX}3 ${FPREFIX}4 && exit 1    # must fail: refuse to handle 3+ file names
57
+lz4 -f $FPREFIX-hw                   # create $FPREFIX-hw.lz4, for next tests
58
+lz4 --list $FPREFIX-hw.lz4           # test --list on valid single-frame file
59
+lz4 --list < $FPREFIX-hw.lz4         # test --list from stdin (file only)
60
+cat $FPREFIX-hw >> $FPREFIX-hw.lz4
61
+lz4 -f $FPREFIX-hw.lz4 && exit 1             # uncompress valid frame followed by invalid data (must fail now)
62
+lz4 -BX $FPREFIX-hw -c -q | lz4 -tv  # test block checksum
63
+# datagen -g20KB generates the same file every single time
64
+# cannot save output of datagen -g20KB as input file to lz4 because the following shell commands are run before datagen -g20KB
65
+test "$(datagen -g20KB | lz4 -c --fast | wc -c)" -lt "$(datagen -g20KB | lz4 -c --fast=9 | wc -c)" # -1 vs -9
66
+test "$(datagen -g20KB | lz4 -c -1 | wc -c)" -lt "$(datagen -g20KB| lz4 -c --fast=1 | wc -c)" # 1 vs -1
67
+test "$(datagen -g20KB | lz4 -c --fast=1 | wc -c)" -eq "$(datagen -g20KB| lz4 -c --fast| wc -c)" # checks default fast compression is -1
68
+lz4 -c --fast=0 $FPREFIX-dg20K && exit 1 # lz4 should fail when fast=0
69
+lz4 -c --fast=-1 $FPREFIX-dg20K && exit 1 # lz4 should fail when fast=-1
70
+# High --fast values can result in out-of-bound dereferences #876
71
+datagen -g1M | lz4 -c --fast=999999999 > $FPREFIX-trash
72
+# Test for #596
73
+echo "TEST" > $FPREFIX-test
74
+lz4 -m $FPREFIX-test
75
+lz4 $FPREFIX-test.lz4 $FPREFIX-test2
76
+diff -q $FPREFIX-test $FPREFIX-test2
(-)b/archivers/liblz4/files/patch-tests_test-lz4-contentSize.sh (+30 lines)
Added Link Here
1
--- ../../tests/test-lz4-contentSize.sh.orig	2022-11-09 10:00:59 UTC
2
+++ ../../tests/test-lz4-contentSize.sh
3
@@ -0,0 +1,27 @@
4
+#!/bin/sh
5
+
6
+FPREFIX="tmp-lzc"
7
+
8
+set -e
9
+
10
+remove () {
11
+    rm $FPREFIX*
12
+}
13
+
14
+trap remove EXIT
15
+
16
+set -x
17
+
18
+datagen -g15M > $FPREFIX
19
+lz4 -v $FPREFIX -c | lz4 -t
20
+lz4 -v --content-size $FPREFIX -c | lz4 -d > $FPREFIX-dup
21
+diff $FPREFIX $FPREFIX-dup
22
+lz4 -f $FPREFIX -c > $FPREFIX.lz4 # compressed with content size
23
+lz4 --content-size $FPREFIX -c > $FPREFIX-wcz.lz4
24
+diff $FPREFIX.lz4 $FPREFIX-wcz.lz4 && exit 1 # must differ, due to content size
25
+lz4 --content-size < $FPREFIX > $FPREFIX-wcz2.lz4 # can determine content size because stdin is just a file
26
+diff $FPREFIX-wcz.lz4 $FPREFIX-wcz2.lz4  # both must contain content size
27
+cat $FPREFIX | lz4 > $FPREFIX-ncz.lz4
28
+diff $FPREFIX.lz4 $FPREFIX-ncz.lz4  # both don't have content size
29
+cat $FPREFIX | lz4 --content-size > $FPREFIX-ncz2.lz4 # can't determine content size
30
+diff $FPREFIX.lz4 $FPREFIX-ncz2.lz4  # both don't have content size
(-)b/archivers/liblz4/files/patch-tests_test-lz4-dict.sh (+38 lines)
Added Link Here
1
--- ../../tests/test-lz4-dict.sh.orig	2022-11-09 10:00:59 UTC
2
+++ ../../tests/test-lz4-dict.sh
3
@@ -0,0 +1,35 @@
4
+#!/bin/sh
5
+
6
+FPREFIX="tmp-dict"
7
+
8
+set -e
9
+
10
+remove () {
11
+    rm $FPREFIX*
12
+}
13
+
14
+trap remove EXIT
15
+
16
+set -x
17
+
18
+datagen -g16KB > $FPREFIX
19
+datagen -g32KB > $FPREFIX-sample-32k
20
+< $FPREFIX-sample-32k lz4 -D $FPREFIX | lz4 -dD $FPREFIX | diff - $FPREFIX-sample-32k
21
+datagen -g128MB > $FPREFIX-sample-128m
22
+< $FPREFIX-sample-128m lz4 -D $FPREFIX | lz4 -dD $FPREFIX | diff - $FPREFIX-sample-128m
23
+touch $FPREFIX-sample-0
24
+< $FPREFIX-sample-0 lz4 -D $FPREFIX | lz4 -dD $FPREFIX | diff - $FPREFIX-sample-0
25
+
26
+< $FPREFIX-sample-32k lz4 -D $FPREFIX-sample-0 | lz4 -dD $FPREFIX-sample-0 | diff - $FPREFIX-sample-32k
27
+< $FPREFIX-sample-0 lz4 -D $FPREFIX-sample-0 | lz4 -dD $FPREFIX-sample-0 | diff - $FPREFIX-sample-0
28
+lz4 -bi0 -D $FPREFIX $FPREFIX-sample-32k $FPREFIX-sample-32k
29
+
30
+echo "---- test lz4 dictionary loading ----"
31
+datagen -g128KB > $FPREFIX-data-128KB
32
+set -e; \
33
+for l in 0 1 4 128 32767 32768 32769 65535 65536 65537 98303 98304 98305 131071 131072 131073; do \
34
+    datagen -g$$l > $FPREFIX-$$l; \
35
+    dd if=$FPREFIX-$$l of=$FPREFIX-$$l-tail bs=1 count=65536 skip=$((l > 65536 ? l - 65536 : 0)); \
36
+    < $FPREFIX-$$l      lz4 -D stdin $FPREFIX-data-128KB -c | lz4 -dD $FPREFIX-$$l-tail | diff - $FPREFIX-data-128KB; \
37
+    < $FPREFIX-$$l-tail lz4 -D stdin $FPREFIX-data-128KB -c | lz4 -dD $FPREFIX-$$l      | diff - $FPREFIX-data-128KB; \
38
+done
(-)b/archivers/liblz4/files/patch-tests_test-lz4-fast-hugefile.sh (+24 lines)
Added Link Here
1
--- ../../tests/test-lz4-fast-hugefile.sh.orig	2022-11-09 10:00:59 UTC
2
+++ ../../tests/test-lz4-fast-hugefile.sh
3
@@ -0,0 +1,21 @@
4
+#!/bin/sh
5
+
6
+FPREFIX="tmp-lfh"
7
+
8
+set -e
9
+
10
+remove () {
11
+    rm $FPREFIX*
12
+}
13
+
14
+trap remove EXIT
15
+
16
+set -x
17
+
18
+datagen -g6GB    | lz4 -vB5D | lz4 -qt
19
+# test large file size [2-4] GB
20
+datagen -g3G -P100 | lz4 -vv | lz4 --decompress --force --sparse - ${FPREFIX}1
21
+ls -ls ${FPREFIX}1
22
+datagen -g3G -P100 | lz4 --quiet --content-size | lz4 --verbose --decompress --force --sparse - ${FPREFIX}2
23
+ls -ls ${FPREFIX}2
24
+diff -s ${FPREFIX}1 ${FPREFIX}2
(-)b/archivers/liblz4/files/patch-tests_test-lz4-frame-concatenation.sh (+24 lines)
Added Link Here
1
--- ../../tests/test-lz4-frame-concatenation.sh.orig	2022-11-09 10:00:59 UTC
2
+++ ../../tests/test-lz4-frame-concatenation.sh
3
@@ -0,0 +1,21 @@
4
+#!/bin/sh
5
+
6
+FPREFIX="tmp-lfc"
7
+
8
+set -e
9
+remove () {
10
+    rm $FPREFIX*
11
+}
12
+
13
+trap remove EXIT
14
+
15
+set -x
16
+
17
+echo > $FPREFIX-empty
18
+echo hi > $FPREFIX-nonempty
19
+cat $FPREFIX-nonempty $FPREFIX-empty $FPREFIX-nonempty > $FPREFIX-src
20
+lz4 -zq $FPREFIX-empty -c > $FPREFIX-empty.lz4
21
+lz4 -zq $FPREFIX-nonempty -c > $FPREFIX-nonempty.lz4
22
+cat $FPREFIX-nonempty.lz4 $FPREFIX-empty.lz4 $FPREFIX-nonempty.lz4 > $FPREFIX-concat.lz4
23
+lz4 -d $FPREFIX-concat.lz4 -c > $FPREFIX-result
24
+cmp $FPREFIX-src $FPREFIX-result
(-)b/archivers/liblz4/files/patch-tests_test-lz4-list.py (+8 lines)
Added Link Here
1
--- ../../tests/test-lz4-list.py.orig	2022-11-09 10:52:35.124541000 +0000
2
+++ ../../tests/test-lz4-list.py	2022-11-09 10:53:54.037799000 +0000
3
@@ -1,4 +1,4 @@
4
-#!/usr/local/bin/python3.9
5
+#!/usr/bin/env python3
6
 import subprocess
7
 import time
8
 import glob
(-)b/archivers/liblz4/files/patch-tests_test-lz4-multiple-legacy.sh (+52 lines)
Added Link Here
1
--- ../../tests/test-lz4-multiple-legacy.sh.orig	2022-11-09 10:00:59 UTC
2
+++ ../../tests/test-lz4-multiple-legacy.sh
3
@@ -0,0 +1,49 @@
4
+#!/bin/sh
5
+
6
+FPREFIX="tmp-lml"
7
+
8
+set -e
9
+
10
+remove () {
11
+    rm $FPREFIX*
12
+}
13
+
14
+trap remove EXIT
15
+
16
+set -x
17
+
18
+datagen -s1        > "${FPREFIX}1" 2> $FPREFIX-trash
19
+datagen -s2 -g100K > "${FPREFIX}2" 2> $FPREFIX-trash
20
+datagen -s3 -g200K > "${FPREFIX}3" 2> $FPREFIX-trash
21
+# compress multiple files using legacy format: one .lz4 per source file
22
+lz4 -f -l -m $FPREFIX*
23
+test -f ${FPREFIX}1.lz4
24
+test -f ${FPREFIX}2.lz4
25
+test -f ${FPREFIX}3.lz4
26
+# decompress multiple files compressed using legacy format: one output file per .lz4
27
+mv ${FPREFIX}1 ${FPREFIX}1-orig
28
+mv ${FPREFIX}2 ${FPREFIX}2-orig
29
+mv ${FPREFIX}3 ${FPREFIX}3-orig
30
+lz4 -d -f -m $FPREFIX*.lz4
31
+lz4 -l -d -f -m $FPREFIX*.lz4 # -l mustn't impact -d option
32
+cmp ${FPREFIX}1 ${FPREFIX}1-orig   # must be identical
33
+cmp ${FPREFIX}2 ${FPREFIX}2-orig
34
+cmp ${FPREFIX}3 ${FPREFIX}3-orig
35
+# compress multiple files into stdout using legacy format
36
+cat ${FPREFIX}1.lz4 ${FPREFIX}2.lz4 ${FPREFIX}3.lz4 > $FPREFIX-concat1
37
+rm $FPREFIX*.lz4
38
+lz4 -l -m ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3 -c > $FPREFIX-concat2
39
+test ! -f ${FPREFIX}1.lz4  # must not create .lz4 artefact
40
+cmp $FPREFIX-concat1 $FPREFIX-concat2  # must be equivalent
41
+# # # decompress multiple files into stdout using legacy format
42
+rm $FPREFIX-concat1 $FPREFIX-concat2
43
+lz4 -l -f -m ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3   # generate .lz4 to decompress
44
+cat ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3 > ${FPREFIX}-concat1   # create concatenated reference
45
+rm ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3
46
+lz4 -d -m ${FPREFIX}1.lz4 ${FPREFIX}2.lz4 ${FPREFIX}3.lz4 -c > $FPREFIX-concat2
47
+lz4 -d -l -m ${FPREFIX}1.lz4 ${FPREFIX}2.lz4 ${FPREFIX}3.lz4 -c > $FPREFIX-concat2 # -l mustn't impact option -d
48
+test ! -f ${FPREFIX}1  # must not create file artefact
49
+cmp $FPREFIX-concat1 $FPREFIX-concat2  # must be equivalent
50
+# # # compress multiple files, one of which is absent (must fail)
51
+lz4 -f -l -m $FPREFIX-concat1 notHere-legacy $FPREFIX-concat2 && exit 1 # must fail : notHere-legacy not present
52
+true
(-)b/archivers/liblz4/files/patch-tests_test-lz4-multiple.sh (+61 lines)
Added Link Here
1
--- ../../tests/test-lz4-multiple.sh.orig	2022-11-09 10:00:59 UTC
2
+++ ../../tests/test-lz4-multiple.sh
3
@@ -0,0 +1,58 @@
4
+#!/bin/sh
5
+
6
+FPREFIX="tmp-tml"
7
+
8
+set -e
9
+
10
+remove () {
11
+    rm $FPREFIX*
12
+}
13
+
14
+trap remove EXIT
15
+
16
+set -x
17
+
18
+datagen -s1        > ${FPREFIX}1 2> $FPREFIX-trash
19
+datagen -s2 -g100K > ${FPREFIX}2 2> $FPREFIX-trash
20
+datagen -s3 -g200K > ${FPREFIX}3 2> $FPREFIX-trash
21
+# compress multiple files : one .lz4 per source file
22
+lz4 -f -m $FPREFIX*
23
+test -f ${FPREFIX}1.lz4
24
+test -f ${FPREFIX}2.lz4
25
+test -f ${FPREFIX}3.lz4
26
+# decompress multiple files : one output file per .lz4
27
+mv ${FPREFIX}1 ${FPREFIX}1-orig
28
+mv ${FPREFIX}2 ${FPREFIX}2-orig
29
+mv ${FPREFIX}3 ${FPREFIX}3-orig
30
+lz4 -d -f -m $FPREFIX*.lz4
31
+cmp ${FPREFIX}1 ${FPREFIX}1-orig   # must be identical
32
+cmp ${FPREFIX}2 ${FPREFIX}2-orig
33
+cmp ${FPREFIX}3 ${FPREFIX}3-orig
34
+# compress multiple files into stdout
35
+cat ${FPREFIX}1.lz4 ${FPREFIX}2.lz4 ${FPREFIX}3.lz4 > $FPREFIX-concat1
36
+rm $FPREFIX*.lz4
37
+lz4 -m ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3 -c > $FPREFIX-concat2
38
+test ! -f ${FPREFIX}1.lz4  # must not create .lz4 artefact
39
+cmp $FPREFIX-concat1 $FPREFIX-concat2  # must be equivalent
40
+# decompress multiple files into stdout
41
+rm $FPREFIX-concat1 $FPREFIX-concat2
42
+lz4 -f -m ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3   # generate .lz4 to decompress
43
+cat ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3 > $FPREFIX-concat1   # create concatenated reference
44
+rm ${FPREFIX}1 ${FPREFIX}2 ${FPREFIX}3
45
+lz4 -d -m ${FPREFIX}1.lz4 ${FPREFIX}2.lz4 ${FPREFIX}3.lz4 -c > $FPREFIX-concat2
46
+test ! -f ${FPREFIX}1  # must not create file artefact
47
+cmp $FPREFIX-concat1 $FPREFIX-concat2  # must be equivalent
48
+# compress multiple files, one of which is absent (must fail)
49
+lz4 -f -m $FPREFIX-concat1 notHere $FPREFIX-concat2 && exit 1 # must fail : notHere not present
50
+# test lz4-compressed file
51
+rm $FPREFIX-concat1 $FPREFIX-concat2
52
+lz4 -tm $FPREFIX-concat1.lz4
53
+# ensure the test doesn't create artifact
54
+test ! -f $FPREFIX-concat1  # must not create file artefact
55
+# test multiple lz4-compressed file
56
+lz4 -tm $FPREFIX-concat1.lz4 $FPREFIX-concat2.lz4
57
+test ! -f $FPREFIX-concat1  # must not create file artefact
58
+test ! -f $FPREFIX-concat2  # must not create file artefact
59
+# test multiple lz4 files, one of which is absent (must fail)
60
+lz4 -tm $FPREFIX-concat1.lz4 notHere.lz4 $FPREFIX-concat2.lz4 && exit 1
61
+true
(-)b/archivers/liblz4/files/patch-tests_test-lz4-opt-parser.sh (+19 lines)
Added Link Here
1
--- ../../tests/test-lz4-opt-parser.sh.orig	2022-11-09 10:00:59 UTC
2
+++ ../../tests/test-lz4-opt-parser.sh
3
@@ -0,0 +1,16 @@
4
+#!/bin/sh
5
+
6
+set -e
7
+set -x
8
+
9
+datagen -g16KB      | lz4 -12      | lz4 -t
10
+datagen -P10        | lz4 -12B4    | lz4 -t
11
+datagen -g256K      | lz4 -12B4D   | lz4 -t
12
+datagen -g512K -P25 | lz4 -12BD    | lz4 -t
13
+datagen -g1M        | lz4 -12B5    | lz4 -t
14
+datagen -g1M -s2    | lz4 -12B4D   | lz4 -t
15
+datagen -g2M -P99   | lz4 -11B4D   | lz4 -t
16
+datagen -g4M        | lz4 -11vq    | lz4 -qt
17
+datagen -g8M        | lz4 -11B4    | lz4 -t
18
+datagen -g16M -P90  | lz4 -11B5    | lz4 -t
19
+datagen -g32M -P10  | lz4 -11B5D   | lz4 -t
(-)b/archivers/liblz4/files/patch-tests_test-lz4-skippable.sh (+22 lines)
Added Link Here
1
--- ../../tests/test-lz4-skippable.sh.orig	2022-11-09 10:00:59 UTC
2
+++ ../../tests/test-lz4-skippable.sh
3
@@ -0,0 +1,19 @@
4
+#!/bin/sh
5
+
6
+SKIPFILE="goldenSamples/skip.bin"
7
+FPREFIX="tmp-lsk"
8
+
9
+set -e
10
+
11
+remove () {
12
+    rm "$FPREFIX"*
13
+}
14
+
15
+trap remove EXIT
16
+
17
+set -x
18
+
19
+lz4 -dc $SKIPFILE
20
+lz4 -dc < $SKIPFILE
21
+printf "Hello from Valid Frame!\n" | lz4 -c > $FPREFIX.lz4
22
+cat $SKIPFILE $FPREFIX.lz4 $SKIPFILE | lz4 -dc
(-)b/archivers/liblz4/files/patch-tests_test-lz4-sparse.sh (+45 lines)
Added Link Here
1
--- ../../tests/test-lz4-sparse.sh.orig	2022-11-09 10:00:59 UTC
2
+++ ../../tests/test-lz4-sparse.sh
3
@@ -0,0 +1,42 @@
4
+#!/bin/sh
5
+
6
+FPREFIX="tmp-tls"
7
+
8
+set -e
9
+
10
+remove () {
11
+    rm $FPREFIX*
12
+}
13
+
14
+trap remove EXIT
15
+
16
+set -x
17
+
18
+datagen -g5M  -P100 > ${FPREFIX}dg5M
19
+lz4 -B4D ${FPREFIX}dg5M -c | lz4 -dv --sparse > ${FPREFIX}cB4
20
+diff -s ${FPREFIX}dg5M ${FPREFIX}cB4
21
+lz4 -B5D ${FPREFIX}dg5M -c | lz4 -dv --sparse > ${FPREFIX}cB5
22
+diff -s ${FPREFIX}dg5M ${FPREFIX}cB5
23
+lz4 -B6D ${FPREFIX}dg5M -c | lz4 -dv --sparse > ${FPREFIX}cB6
24
+diff -s ${FPREFIX}dg5M ${FPREFIX}cB6
25
+lz4 -B7D ${FPREFIX}dg5M -c | lz4 -dv --sparse > ${FPREFIX}cB7
26
+diff -s ${FPREFIX}dg5M ${FPREFIX}cB7
27
+lz4 ${FPREFIX}dg5M -c | lz4 -dv --no-sparse > ${FPREFIX}nosparse
28
+diff -s ${FPREFIX}dg5M ${FPREFIX}nosparse
29
+ls -ls $FPREFIX*
30
+datagen -s1 -g1200007 -P100 | lz4 | lz4 -dv --sparse > ${FPREFIX}odd   # Odd size file (to generate non-full last block)
31
+datagen -s1 -g1200007 -P100 | diff -s - ${FPREFIX}odd
32
+ls -ls ${FPREFIX}odd
33
+rm $FPREFIX*
34
+printf "\n Compatibility with Console :"
35
+echo "Hello World 1 !" | lz4 | lz4 -d -c
36
+echo "Hello World 2 !" | lz4 | lz4 -d | cat
37
+echo "Hello World 3 !" | lz4 --no-frame-crc | lz4 -d -c
38
+printf "\n Compatibility with Append :"
39
+datagen -P100 -g1M > ${FPREFIX}dg1M
40
+cat ${FPREFIX}dg1M ${FPREFIX}dg1M > ${FPREFIX}2M
41
+lz4 -B5 -v ${FPREFIX}dg1M ${FPREFIX}c
42
+lz4 -d -v ${FPREFIX}c ${FPREFIX}r
43
+lz4 -d -v ${FPREFIX}c -c >> ${FPREFIX}r
44
+ls -ls $FPREFIX*
45
+diff ${FPREFIX}2M ${FPREFIX}r
(-)b/archivers/liblz4/files/patch-tests_test-lz4-speed.py (+8 lines)
Added Link Here
1
--- ../../tests/test-lz4-speed.py.orig	2022-11-09 11:10:31.834105000 +0000
2
+++ ../../tests/test-lz4-speed.py	2022-10-25 15:57:45.244086000 +0000
3
@@ -1,4 +1,4 @@
4
-#!/usr/local/bin/python3.9
5
+#!/usr/bin/env python3
6
 
7
 #
8
 # Copyright (c) 2016-2020, Przemyslaw Skibinski, Yann Collet, Facebook, Inc.
(-)b/archivers/liblz4/files/patch-tests_test-lz4-testmode.sh (+41 lines)
Added Link Here
1
--- ../../tests/test-lz4-testmode.sh.orig	2022-11-09 10:00:59 UTC
2
+++ ../../tests/test-lz4-testmode.sh
3
@@ -0,0 +1,38 @@
4
+#!/bin/sh
5
+
6
+FPREFIX="tmp-ltm"
7
+
8
+set -e
9
+
10
+remove () {
11
+    rm $FPREFIX*
12
+}
13
+
14
+trap remove EXIT
15
+
16
+set -x
17
+
18
+lz4 -bi0
19
+datagen > $FPREFIX
20
+lz4 -f $FPREFIX -c > $FPREFIX.lz4
21
+lz4 -bdi0 $FPREFIX.lz4 # test benchmark decode-only mode
22
+lz4 -bdi0 --no-crc $FPREFIX.lz4 # test benchmark decode-only mode
23
+echo "---- test mode ----"
24
+datagen | lz4 -t && exit 1
25
+datagen | lz4 -tf && exit 1
26
+echo "---- pass-through mode ----"
27
+echo "Why hello there " > ${FPREFIX}2.lz4
28
+lz4 -f ${FPREFIX}2.lz4 > $FPREFIX-trash && exit 1
29
+datagen | lz4 -dc  > $FPREFIX-trash && exit 1
30
+datagen | lz4 -df > $FPREFIX-trash && exit 1
31
+datagen | lz4 -dcf > $FPREFIX-trash
32
+echo "Hello World !" > ${FPREFIX}1
33
+lz4 -dcf ${FPREFIX}1
34
+echo "from underground..." > ${FPREFIX}2
35
+lz4 -dcfm ${FPREFIX}1 ${FPREFIX}2
36
+echo "---- non-existing source (must fail cleanly) ----"
37
+lz4     file-does-not-exist && exit 1
38
+lz4 -f  file-does-not-exist && exit 1
39
+lz4 -t  file-does-not-exist && exit 1
40
+lz4 -fm file1-dne file2-dne && exit 1
41
+true
(-)b/archivers/liblz4/files/patch-tests_test-lz4-versions.py (+8 lines)
Added Link Here
1
--- ../../tests/test-lz4-versions.py.orig	2022-11-09 11:10:31.834265000 +0000
2
+++ ../../tests/test-lz4-versions.py	2022-10-25 15:57:45.244200000 +0000
3
@@ -1,4 +1,4 @@
4
-#!/usr/local/bin/python3.9
5
+#!/usr/bin/env python3
6
 """Test LZ4 interoperability between versions"""
7
 
8
 #
(-)b/archivers/liblz4/files/patch-tests_test-lz4hc-hugefile.sh (-1 / +9 lines)
Added Link Here
0
- 
1
--- ../../tests/test-lz4hc-hugefile.sh.orig	2022-11-09 10:00:59 UTC
2
+++ ../../tests/test-lz4hc-hugefile.sh
3
@@ -0,0 +1,6 @@
4
+#!/bin/sh
5
+
6
+set -e
7
+set -x
8
+
9
+datagen -g4200MB | lz4 -v3BD | lz4 -qt

Return to bug 267667