0
0
mirror of https://github.com/facebook/zstd synced 2026-01-18 17:21:18 +01:00

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.
This commit is contained in:
Yann Collet
2025-12-18 15:36:07 -08:00
committed by Yann Collet
parent a87d0cc476
commit 1dae4f0188

View File

@@ -259,8 +259,15 @@ if __name__ == '__main__':
shutil.copy2('dictBuilder', '{}/dictBuilder.{}'.format(tmp_dir, tag))
os.chdir(r_dir + '/programs') # /path/to/zstd/tests/versionsTest/<TAG>/programs
make(['clean'], False) # separate 'clean' target to allow parallel build
# Enable legacy support for cross-version compatibility testing
make(['zstd', 'ZSTD_LEGACY_SUPPORT=5'], False)
# Enable legacy support for cross-version compatibility testing.
# Use ZSTD_LEGACY_SUPPORT=1 for v0.6.x due to a bug where headers
# check for ==1 but code checks for >=1.
# Use ZSTD_LEGACY_SUPPORT=5 for v1.2.0+ because =1 includes old
# legacy files (v01-v04) that have missing includes in newer versions.
if tag < 'v1.2.0':
make(['zstd', 'ZSTD_LEGACY_SUPPORT=1'], False)
else:
make(['zstd', 'ZSTD_LEGACY_SUPPORT=5'], False)
else:
os.chdir(programs_dir)
print('-----------------------------------------------')