1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-30 22:23:13 +03:00

fix FreeBSD

use an alias instead of a function

also: added more traces and updated version nb to v1.5.8
This commit is contained in:
Yann Collet
2025-03-10 13:55:45 -07:00
parent c18374bb16
commit 2ff87aefac
3 changed files with 17 additions and 19 deletions

View File

@ -111,7 +111,7 @@ extern "C" {
/*------ Version ------*/ /*------ Version ------*/
#define ZSTD_VERSION_MAJOR 1 #define ZSTD_VERSION_MAJOR 1
#define ZSTD_VERSION_MINOR 5 #define ZSTD_VERSION_MINOR 5
#define ZSTD_VERSION_RELEASE 7 #define ZSTD_VERSION_RELEASE 8
#define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE) #define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
/*! ZSTD_versionNumber() : /*! ZSTD_versionNumber() :

View File

@ -686,6 +686,12 @@ static void printVersion(void)
DISPLAYOUT("lz4 version %s\n", FIO_lz4Version()); DISPLAYOUT("lz4 version %s\n", FIO_lz4Version());
DISPLAYOUT("lzma version %s\n", FIO_lzmaVersion()); DISPLAYOUT("lzma version %s\n", FIO_lzmaVersion());
#ifdef ZSTD_MULTITHREAD
DISPLAYOUT("supports Multithreading \n");
#else
DISPLAYOUT("single-thread operations only \n");
#endif
/* posix support */ /* posix support */
#ifdef _POSIX_C_SOURCE #ifdef _POSIX_C_SOURCE
DISPLAYOUT("_POSIX_C_SOURCE defined: %ldL\n", (long) _POSIX_C_SOURCE); DISPLAYOUT("_POSIX_C_SOURCE defined: %ldL\n", (long) _POSIX_C_SOURCE);
@ -1336,7 +1342,7 @@ int main(int argCount, const char* argv[])
#ifdef ZSTD_MULTITHREAD #ifdef ZSTD_MULTITHREAD
if ((nbWorkers==NBWORKERS_AUTOCPU) && (!singleThread)) { if ((nbWorkers==NBWORKERS_AUTOCPU) && (!singleThread)) {
/* automatically set # workers based on # of reported cpus */ /* automatically set # workers based on # of reported cpu cores */
if (defaultLogicalCores) { if (defaultLogicalCores) {
nbWorkers = (unsigned)UTIL_countLogicalCores(); nbWorkers = (unsigned)UTIL_countLogicalCores();
DISPLAYLEVEL(3, "Note: %d logical core(s) detected \n", nbWorkers); DISPLAYLEVEL(3, "Note: %d logical core(s) detected \n", nbWorkers);
@ -1345,7 +1351,7 @@ int main(int argCount, const char* argv[])
DISPLAYLEVEL(3, "Note: %d physical core(s) detected \n", nbWorkers); DISPLAYLEVEL(3, "Note: %d physical core(s) detected \n", nbWorkers);
} }
} }
if (operation != zom_bench) if (operation == zom_compress)
DISPLAYLEVEL(4, "Compressing with %u worker threads \n", nbWorkers); DISPLAYLEVEL(4, "Compressing with %u worker threads \n", nbWorkers);
#else #else
(void)singleThread; (void)nbWorkers; (void)defaultLogicalCores; (void)singleThread; (void)nbWorkers; (void)defaultLogicalCores;

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
set -e # exit immediately on error set -e # exit immediately on error
# set -x # print commands before execution (debug) set -x # print commands before execution (debug)
unset ZSTD_CLEVEL unset ZSTD_CLEVEL
unset ZSTD_NBTHREADS unset ZSTD_NBTHREADS
@ -16,13 +16,7 @@ datagen() {
"$DATAGEN_BIN" "$@" "$DATAGEN_BIN" "$@"
} }
zstd() { alias zstd="$EXE_PREFIX $ZSTD_BIN"
if [ -z "$EXE_PREFIX" ]; then
"$ZSTD_BIN" "$@"
else
"$EXE_PREFIX" "$ZSTD_BIN" "$@"
fi
}
sudoZstd() { sudoZstd() {
if [ -z "$EXE_PREFIX" ]; then if [ -z "$EXE_PREFIX" ]; then
@ -1563,18 +1557,16 @@ then
println "\n===> zstdmt environment variable tests " println "\n===> zstdmt environment variable tests "
echo "multifoo" >> mt_tmp echo "multifoo" >> mt_tmp
ZSTD_NBTHREADS=-3 zstd -f mt_tmp # negative value, warn and revert to default setting ZSTD_NBTHREADS=-3 zstd -f mt_tmp # negative value, warn and revert to default setting
ZSTD_NBTHREADS='' zstd -f mt_tmp # empty env var, warn and revert to default setting ZSTD_NBTHREADS='' zstd -f mt_tmp # empty env var, warn and revert to default setting
ZSTD_NBTHREADS=- zstd -f mt_tmp # malformed env var, warn and revert to default setting ZSTD_NBTHREADS=- zstd -f mt_tmp # malformed env var, warn and revert to default setting
ZSTD_NBTHREADS=a zstd -f mt_tmp # malformed env var, warn and revert to default setting ZSTD_NBTHREADS=a zstd -f mt_tmp # malformed env var, warn and revert to default setting
ZSTD_NBTHREADS=+a zstd -f mt_tmp # malformed env var, warn and revert to default setting ZSTD_NBTHREADS=+a zstd -f mt_tmp # malformed env var, warn and revert to default setting
ZSTD_NBTHREADS=3a7 zstd -f mt_tmp # malformed env var, warn and revert to default setting ZSTD_NBTHREADS=3a7 zstd -f mt_tmp # malformed env var, warn and revert to default setting
ZSTD_NBTHREADS=50000000000 zstd -f mt_tmp # numeric value too large, warn and revert to default setting= ZSTD_NBTHREADS=50000000000 zstd -f mt_tmp # numeric value too large, warn and revert to default setting=
ZSTD_NBTHREADS=2 zstd -f mt_tmp # correct usage ZSTD_NBTHREADS=2 zstd -f mt_tmp # correct usage
ZSTD_NBTHREADS=1 zstd -f mt_tmp # correct usage: single worker ZSTD_NBTHREADS=1 zstd -f mt_tmp # correct usage: single worker
ZSTD_NBTHREADS=4 zstd -f mt_tmp -vv 2>&1 | grep "4 worker threads" # check message ZSTD_NBTHREADS=4 zstd -f mt_tmp -vv 2>&1 | $GREP "4 worker threads" # check message
zstd -tq mt_tmp.zst ZSTD_NBTHREADS=0 zstd -f mt_tmp -vv 2>&1 | $GREP "core(s) detected" # check core count autodetection is triggered
ZSTD_NBTHREADS=0 zstd -f mt_tmp -vv 2>&1 | grep "core(s) detected" # check core count autodetection is triggered
zstd -tq mt_tmp.zst
# temporary envvar changes in the above tests would actually persist in macos /bin/sh # temporary envvar changes in the above tests would actually persist in macos /bin/sh
unset ZSTD_NBTHREADS unset ZSTD_NBTHREADS
rm -f mt_tmp* rm -f mt_tmp*