From: Yann Collet Date: Thu, 18 Dec 2025 23:36:07 +0000 (-0800) Subject: test: fix versionsTest build for old zstd versions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4554%2Fhead;p=thirdparty%2Fzstd.git 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. --- diff --git a/tests/test-zstd-versions.py b/tests/test-zstd-versions.py index 703faa478..57131c243 100755 --- a/tests/test-zstd-versions.py +++ b/tests/test-zstd-versions.py @@ -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//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('-----------------------------------------------')