Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions programs/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,40 @@ UTIL_time_t g_displayClock = UTIL_TIME_INITIALIZER;
# include <lz4.h>
#endif

char const* FIO_zlibVersion(void)
{
#if defined(ZSTD_GZCOMPRESS) || defined(ZSTD_GZDECOMPRESS)
return zlibVersion();
#else
return "Unsupported";
#endif
}

char const* FIO_lz4Version(void)
{
#if defined(ZSTD_LZ4COMPRESS) || defined(ZSTD_LZ4DECOMPRESS)
/* LZ4_versionString() added in v1.7.3 */
# if LZ4_VERSION_NUMBER >= 10703
return LZ4_versionString();
# else
# define ZSTD_LZ4_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE
# define ZSTD_LZ4_VERSION_STRING ZSTD_EXPAND_AND_QUOTE(ZSTD_LZ4_VERSION)
return ZSTD_LZ4_VERSION_STRING;
# endif
#else
return "Unsupported";
#endif
}

char const* FIO_lzmaVersion(void)
{
#if defined(ZSTD_LZMACOMPRESS) || defined(ZSTD_LZMADECOMPRESS)
return lzma_version_string();
#else
return "Unsupported";
#endif
}


/*-*************************************
* Constants
Expand Down
3 changes: 3 additions & 0 deletions programs/fileio.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ int FIO_checkFilenameCollisions(const char** filenameTable, unsigned nbFiles);
/* custom crash signal handler */
void FIO_addAbortHandler(void);

char const* FIO_zlibVersion(void);
char const* FIO_lz4Version(void);
char const* FIO_lzmaVersion(void);


#if defined (__cplusplus)
Expand Down
5 changes: 5 additions & 0 deletions programs/zstdcli.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,11 @@ static void printVersion(void)
#endif
DISPLAYOUT("\n");
if (g_displayLevel >= 4) {
/* library versions */
DISPLAYOUT("zlib version %s\n", FIO_zlibVersion());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I understand that a library version is displayed for each and every supported external codec,
irrespective of the fact that zstd was linked to them or not ?
(and display "Unsupported" in this last case)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. We could change that behavior by gating each of these behind an ifdef check. I figured that since this is in zstd -vvV output, there is not need to make it super pretty. I'm okay either way though, so lmk if you want me to change it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not urgent indeed. This is a debug print, I think some verbosity is acceptable.

DISPLAYOUT("lz4 version %s\n", FIO_lz4Version());
DISPLAYOUT("lzma version %s\n", FIO_lzmaVersion());

/* posix support */
#ifdef _POSIX_C_SOURCE
DISPLAYOUT("_POSIX_C_SOURCE defined: %ldL\n", (long) _POSIX_C_SOURCE);
Expand Down
1 change: 1 addition & 0 deletions tests/playTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ else
fi


zstd -vvV

println "\n===> simple tests "

Expand Down