Skip to content

Commit 1dae4f0

Browse files
committed
test: fix versionsTest build for old zstd versions
Summary: Some old zstd versions (notably v0.6.x) have a bug in fileio.c where header includes check for `ZSTD_LEGACY_SUPPORT==1` but code usage checks for `ZSTD_LEGACY_SUPPORT>=1`. Using value 5 causes compilation failure because headers aren't included but the code tries to use legacy functions. Changing to `ZSTD_LEGACY_SUPPORT=1` for old version builds fixes the compilation while still enabling legacy format support. Test Plan: Run `make versionsTest` or `python3 tests/test-zstd-versions.py` to verify all old versions compile and cross-version decompression works correctly.
1 parent a87d0cc commit 1dae4f0

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tests/test-zstd-versions.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,15 @@ def decompress_dict(tag):
259259
shutil.copy2('dictBuilder', '{}/dictBuilder.{}'.format(tmp_dir, tag))
260260
os.chdir(r_dir + '/programs') # /path/to/zstd/tests/versionsTest/<TAG>/programs
261261
make(['clean'], False) # separate 'clean' target to allow parallel build
262-
# Enable legacy support for cross-version compatibility testing
263-
make(['zstd', 'ZSTD_LEGACY_SUPPORT=5'], False)
262+
# Enable legacy support for cross-version compatibility testing.
263+
# Use ZSTD_LEGACY_SUPPORT=1 for v0.6.x due to a bug where headers
264+
# check for ==1 but code checks for >=1.
265+
# Use ZSTD_LEGACY_SUPPORT=5 for v1.2.0+ because =1 includes old
266+
# legacy files (v01-v04) that have missing includes in newer versions.
267+
if tag < 'v1.2.0':
268+
make(['zstd', 'ZSTD_LEGACY_SUPPORT=1'], False)
269+
else:
270+
make(['zstd', 'ZSTD_LEGACY_SUPPORT=5'], False)
264271
else:
265272
os.chdir(programs_dir)
266273
print('-----------------------------------------------')

0 commit comments

Comments
 (0)