11259 Commits

Author SHA1 Message Date
jinyaoguo
cad0b72ad8 Ensure BMK_timedFnState is always freed in benchMem
When an error occurs in BMK_isSuccessful_runOutcome, the code
previously skipped the call to BMK_freeTimedFnState(tfs),
leaking the allocated tfs object.
Fiexed by calling BMK_freeTimedFnState(tfs) before goto _cleanOut.
2025-06-12 19:52:58 -04:00
Yann Collet
5e6bdf5e3d
Merge pull request #4406 from Cyan4973/separate-cmake-tests
cmake CI tests refactor
2025-06-09 15:19:47 -07:00
Yann Collet
9a6fe9a428 remove global variable
overkill and leaky to transport a test result just in one place.
2025-06-09 21:55:06 +00:00
Yann Collet
88bea95d11
Merge pull request #4403 from dloidolt/fix_FUZZ_malloc_rand
fuzz: Fix FUZZ_malloc_rand() to return non-NULL for zero-size allocations
2025-06-09 10:57:59 -07:00
Yann Collet
39c091bc9e
Merge pull request #4397 from xiaoge1001/free
Fix several locations with potential memory leak
2025-06-09 10:06:36 -07:00
shixuantong
de8d9e8914 Fix several locations with potential memory leak 2025-06-09 21:23:23 +08:00
Yann Collet
472acf5d83 fix #4405 2025-06-09 07:24:03 +00:00
Yann Collet
7e0324e124 fixed cmake + windows + visual + clang-cl
by removing processing of resource files in this case
2025-06-09 07:09:51 +00:00
Yann Collet
b6dc2924f8 remove fail-fast so that the outcome of other tests can be observed 2025-06-09 06:59:18 +00:00
Yann Collet
49fe2ec793 refactor: modularize CMakeLists.txt for better maintainability
- Split monolithic 235-line CMakeLists.txt into focused modules
- Main file reduced to 78 lines with clear section organization
- Created 5 specialized modules:
  * ZstdVersion.cmake - CMake policies and version management
  * ZstdOptions.cmake - Build options and platform configuration
  * ZstdDependencies.cmake - External dependency management
  * ZstdBuild.cmake - Build targets and validation
  * ZstdPackage.cmake - Package configuration generation

Benefits:
- Improved readability and maintainability
- Better separation of concerns
- Easier debugging and modification
- Preserved 100% backward compatibility
- All existing build options and targets unchanged

The refactored build system passes all tests and maintains
identical functionality while being much easier to understand
and maintain.
2025-06-09 03:47:33 +00:00
Yann Collet
75abb8bc1c add cmake build test with ZSTD_BUILD_TESTS disabled
should reproduce #4405 and fail
2025-06-09 00:05:19 +00:00
Yann Collet
c826c572cf added macos arm64 tests
and comment out windows arm64 tests due to unacceptably long queue time
2025-06-08 22:40:15 +00:00
Yann Collet
a168ae7232 added windows arm64 runner to cmake tests 2025-06-08 22:19:57 +00:00
Yann Collet
b922774602 refactor CMake tests workflow for readability 2025-06-08 21:44:21 +00:00
Yann Collet
a2dba85fd1 ci: separate cmake tests into dedicated workflow file
- Create new .github/workflows/cmake-tests.yml with all cmake-related jobs
- Move cmake-build-and-test-check, cmake-source-directory-with-spaces, and cmake-visual-2022 jobs
- Remove cmake tests from dev-short-tests.yml to improve organization
- Maintain same trigger conditions and test configurations
- Add dedicated concurrency group for cmake tests

This separation allows cmake tests to run independently and makes
the CI configuration more modular and easier to maintain.
2025-06-08 20:25:25 +00:00
Yann Collet
ec8ad2e552
Merge pull request #4384 from xiaoge1001/dev
update `--rm` cmd help info
2025-06-08 12:39:26 -07:00
Yann Collet
5b6fbf5f96
Merge pull request #4392 from mugitya03/MLK
Fix potential memory leak in function `benchMem`
2025-06-08 12:38:31 -07:00
Yann Collet
e23d0a9616
Merge pull request #4399 from zijianli1234/dev
Improve speed of convertSequences() and get1BlockSummary() using RVV
2025-06-08 12:38:02 -07:00
Dominik Loidolt
4be08ba122 fuzz: Fix FUZZ_malloc_rand() to return non-NULL for zero-size allocations
The FUZZ_malloc_rand() function was incorrectly always returning NULL for
zero-size allocations. The random offset generated by
FUZZ_dataProducer_int32Range() was not being added to the pointer variable,
causing the function to always return (void *)0.
2025-06-05 17:28:30 +02:00
Yann Collet
bd894054c0
Merge pull request #4401 from mugitya03/MLK-1
Release resources before returning
2025-06-04 12:49:38 -07:00
jinyaoguo
dd4cee9190 Release resources before returning
In main, resources were freed on the success path but not in the error path.
This change ensures all allocated resources are released before returning.
2025-06-03 15:28:11 -04:00
李子建
d95123f2e6 Improve speed of ZSTD_compressSequencesAndLiterals() using RVV 2025-06-02 17:21:02 +08:00
shixuantong
4bd5654e72 update --rm cmd help info
Starting from cee6bec9fa6aa249f2df9f84165b682eb793eab, --rm is ignored when the output is `stdout`.
2025-05-30 06:49:52 +08:00
jinyaoguo
4618b255ea Fix memory leak in function benchMem
`speedPerRound` is allocated at the start of benchMem to collect per-round speeds,
but is never freed, causing a leak on each invocation.
2025-05-25 15:21:23 -04:00
Dave Vasilevsky
f9938c217d lz4: Remove ancient test helpers
Building lz4 as root was causing `make clean` to fail with permission
errors.

We used to have to install lz4 from source back in Ubuntu 14.04, but
nowadays the installed lz4 is fine. Get rid of ancient helpers and
cruft!
2025-05-07 22:01:49 -07:00
Dave Vasilevsky
448a09ff78 seekable_format: Fix conversion warnings in parallel_compression 2025-05-07 22:01:49 -07:00
Dave Vasilevsky
13cb7a10ae seekable_format: Add test for parallel_compression memory usage
Use ulimit to fail the test if we use O(filesize) memory, rather than
O(threads).
2025-05-07 22:01:49 -07:00
Dave Vasilevsky
01c973de8d seekable_format: Fix race in parallel_processing
There was no memory barrier between writing and reading `done`, which
would allow reordering to cause races. With so little data to handle
after each job completes, we might as well just join.
2025-05-07 22:01:49 -07:00
Dave Vasilevsky
6fc8455a72 seekable_format: Cleanup POOL in parallel_compression 2025-05-07 22:01:49 -07:00
Dave Vasilevsky
2d4cff69c4 seekable_format: Make parallel_compression use memory properly
Previously, parallel_compression would only handle each job's results
after ALL jobs were successfully queued. This caused all src/dst
buffers to remain in memory until then!

It also polled to check whether a job completed, which is racy without
any memory barrier.

Now, we flush results as a side effect of completing a job. Completed
frames are placed in an ordered linked-list, and any eligible frames
are flushed. This may be zero or multiple frames, depending on the
order in which jobs finish.

This design also makes it simple to support streaming input, so that
is now available. Just pass `-` as the filename, and stdin/stdout will
be used for I/O.
2025-05-07 22:01:49 -07:00
Dave Vasilevsky
f5b6531902 seekable_format: Link against multi-threaded libzstd.a
Some of these examples are intended to be parallel, and don't make
sense to link against single-threaded libzstd.

The filename of mt and nomt libzstd are identical, so it's still
possible to link against the single-threaded one, just harder.
2025-05-07 22:01:49 -07:00
Dave Vasilevsky
6b0039abcf seekable_format: Build with $(MAKE)
This passes make flags, such as `-jN` for building in parallel, to
the underlying make.
2025-05-07 22:01:49 -07:00
Thomas Devoogdt
769723aee2 [cmake] only require a CXX compiler when tests are build
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
2025-05-06 12:20:26 -07:00
Nobuhiro Iwamatsu
2d224dc745 Add License variable to pkg-config file
The pkg-config file has License variable that allows you to set the license for
the software. This sets 'BSD-3-Clause OR GPL-2.0-only' to License.

Ref: https://github.com/pkgconf/pkgconf/blob/master/man/pc.5#L116
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2025-05-06 12:16:28 -07:00
Yann Collet
e26dde3dcf
Merge pull request #4378 from Cyan4973/fix_zstreamtest_minor
fix minor warning in zstreamtest
2025-04-29 14:01:14 -07:00
Yann Collet
453e252015
Merge pull request #4371 from ecordonnier-sc/eco/fix-macos-duplicate-lc-rpath
Fix duplicate LC_RPATH error on MacOS
2025-04-29 14:00:41 -07:00
Yann Collet
7f907d5c23 fix minor warning in zstreamtest 2025-04-29 09:56:00 -07:00
Etienne Cordonnier
8929d3b09f Fix duplicate LC_RPATH error on MacOS
After the update to MacOS 15.4, the dynamic loader dyld treats duplicated LC_RPATH as an error.
The `FLAGS` variable already contains `LDFLAGS`, thus using both `FLAGS` and `LDFLAGS`
duplicates all `LDFLAGS`, including `-Wl,rpath` parameters.

The duplicate LC_RPATH causes this kind of errors:

```
dyld[29361]: Library not loaded: @loader_path/../lib/libzstd.1.dylib
      Referenced from: <7131C877-3CF0-33AC-AA05-257BA4FDD770> /Users/foobar/...
      Reason: tried: '/Users/foobar/..../lib/libzstd.1.dylib' (duplicate LC_RPATH '/usr/mypath.../lib')
```

Closes https://github.com/facebook/zstd/issues/4369

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
2025-04-18 15:59:06 +02:00
Yann Collet
d654fca786
Merge pull request #4362 from facebook/dependabot/github_actions/actions/setup-java-4.7.1
Bump actions/setup-java from 4.7.0 to 4.7.1
2025-04-14 03:19:07 -07:00
dependabot[bot]
28ffb100ab
Bump actions/setup-java from 4.7.0 to 4.7.1
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 4.7.0 to 4.7.1.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](3a4f6e1af5...c5195efecf)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-version: 4.7.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-14 05:21:33 +00:00
Yann Collet
f5d4da09f5
Merge pull request #4353 from afq984/sparse
Check regular file for sparse support after opening
2025-04-07 03:48:41 -07:00
Li-Yu Yu
2a12bbaf90 Update cli-tests/file-stat tests 2025-03-28 22:46:26 +00:00
Li-Yu Yu
3bd5aa3404 Check regular file for sparse support after opening
A regular file may be created by the open call.
Checking after opening allows sparseFileSupport even
if dstFileName does not already exist.
2025-03-28 21:23:10 +00:00
Yann Collet
c5926fbab8
Merge pull request #4349 from Cyan4973/devfd
Support process substitution for `--filelist=`
2025-03-28 10:35:45 -07:00
Yann Collet
2f9627863f update error message 2025-03-28 10:02:37 -07:00
Yann Collet
0bdeb1d204 fix test 2025-03-28 09:18:17 -07:00
Yann Collet
8626da73b6 add error message clarification for inputs as process substitution 2025-03-28 09:18:17 -07:00
Yann Collet
a293cdcb85 added CI test 2025-03-28 09:18:17 -07:00
Yann Collet
0bde39a9b3 visual studio fix 2025-03-28 09:18:17 -07:00
Yann Collet
94cfa0b5a0 minor: restore some code comment 2025-03-28 09:18:17 -07:00