mirror of
https://github.com/facebook/zstd.git
synced 2025-08-05 19:15:58 +03:00
Restrict dictmode regression tests only to advanced API, fix some compiler warnings
This commit is contained in:
@@ -983,7 +983,7 @@ void UTIL_mirrorSourceFilesDirectories(const char** inFileNames, unsigned int nb
|
|||||||
}
|
}
|
||||||
|
|
||||||
FileNamesTable*
|
FileNamesTable*
|
||||||
UTIL_createExpandedFNT(const char** inputNames, size_t nbIfns, int followLinks)
|
UTIL_createExpandedFNT(const char* const* inputNames, size_t nbIfns, int followLinks)
|
||||||
{
|
{
|
||||||
unsigned nbFiles;
|
unsigned nbFiles;
|
||||||
char* buf = (char*)malloc(LIST_SIZE_INCREASE);
|
char* buf = (char*)malloc(LIST_SIZE_INCREASE);
|
||||||
|
@@ -277,7 +277,7 @@ void UTIL_refFilename(FileNamesTable* fnt, const char* filename);
|
|||||||
* or NULL in case of error
|
* or NULL in case of error
|
||||||
*/
|
*/
|
||||||
FileNamesTable*
|
FileNamesTable*
|
||||||
UTIL_createExpandedFNT(const char** filenames, size_t nbFilenames, int followLinks);
|
UTIL_createExpandedFNT(const char* const* filenames, size_t nbFilenames, int followLinks);
|
||||||
|
|
||||||
|
|
||||||
/*-****************************************
|
/*-****************************************
|
||||||
|
@@ -28,10 +28,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Define a config for each level we want to test with. */
|
/* Define a config for each level we want to test with. */
|
||||||
#define LEVEL(x) \
|
#define LEVEL(x) \
|
||||||
param_value_t const level_##x##_param_values[] = { \
|
param_value_t const level_##x##_param_values[] = { \
|
||||||
{.param = ZSTD_c_compressionLevel, .value = x}, \
|
{.param = ZSTD_c_compressionLevel, .value = x}, \
|
||||||
}; \
|
}; \
|
||||||
param_value_t const level_##x##_param_values_dms[] = { \
|
param_value_t const level_##x##_param_values_dms[] = { \
|
||||||
{.param = ZSTD_c_compressionLevel, .value = x}, \
|
{.param = ZSTD_c_compressionLevel, .value = x}, \
|
||||||
{.param = ZSTD_c_enableDedicatedDictSearch, .value = 0}, \
|
{.param = ZSTD_c_enableDedicatedDictSearch, .value = 0}, \
|
||||||
@@ -40,40 +40,56 @@
|
|||||||
param_value_t const level_##x##_param_values_dds[] = { \
|
param_value_t const level_##x##_param_values_dds[] = { \
|
||||||
{.param = ZSTD_c_compressionLevel, .value = x}, \
|
{.param = ZSTD_c_compressionLevel, .value = x}, \
|
||||||
{.param = ZSTD_c_enableDedicatedDictSearch, .value = 1}, \
|
{.param = ZSTD_c_enableDedicatedDictSearch, .value = 1}, \
|
||||||
|
{.param = ZSTD_c_forceAttachDict, .value = ZSTD_dictForceAttach}, \
|
||||||
}; \
|
}; \
|
||||||
param_value_t const level_##x##_param_values_dictcopy[] = { \
|
param_value_t const level_##x##_param_values_dictcopy[] = { \
|
||||||
{.param = ZSTD_c_compressionLevel, .value = x}, \
|
{.param = ZSTD_c_compressionLevel, .value = x}, \
|
||||||
{.param = ZSTD_c_enableDedicatedDictSearch, .value = 0}, \
|
{.param = ZSTD_c_enableDedicatedDictSearch, .value = 0}, \
|
||||||
{.param = ZSTD_c_forceAttachDict, .value = ZSTD_dictForceCopy}, \
|
{.param = ZSTD_c_forceAttachDict, .value = ZSTD_dictForceCopy}, \
|
||||||
}; \
|
}; \
|
||||||
config_t const level_##x = { \
|
param_value_t const level_##x##_param_values_dictload[] = { \
|
||||||
.name = "level " #x, \
|
{.param = ZSTD_c_compressionLevel, .value = x}, \
|
||||||
.cli_args = "-" #x, \
|
{.param = ZSTD_c_enableDedicatedDictSearch, .value = 0}, \
|
||||||
.param_values = PARAM_VALUES(level_##x##_param_values), \
|
{.param = ZSTD_c_forceAttachDict, .value = ZSTD_dictForceLoad}, \
|
||||||
}; \
|
}; \
|
||||||
config_t const level_##x##_dict = { \
|
config_t const level_##x = { \
|
||||||
.name = "level " #x " with dict", \
|
.name = "level " #x, \
|
||||||
.cli_args = "-" #x, \
|
.cli_args = "-" #x, \
|
||||||
.param_values = PARAM_VALUES(level_##x##_param_values), \
|
.param_values = PARAM_VALUES(level_##x##_param_values), \
|
||||||
.use_dictionary = 1, \
|
}; \
|
||||||
}; \
|
config_t const level_##x##_dict = { \
|
||||||
config_t const level_##x##_dict_dms = { \
|
.name = "level " #x " with dict", \
|
||||||
.name = "level " #x " with dict dms", \
|
.cli_args = "-" #x, \
|
||||||
.cli_args = "-" #x, \
|
.param_values = PARAM_VALUES(level_##x##_param_values), \
|
||||||
.param_values = PARAM_VALUES(level_##x##_param_values_dms), \
|
.use_dictionary = 1, \
|
||||||
.use_dictionary = 1, \
|
}; \
|
||||||
}; \
|
config_t const level_##x##_dict_dms = { \
|
||||||
config_t const level_##x##_dict_dds = { \
|
.name = "level " #x " with dict dms", \
|
||||||
.name = "level " #x " with dict dds", \
|
.cli_args = "-" #x, \
|
||||||
.cli_args = "-" #x, \
|
.param_values = PARAM_VALUES(level_##x##_param_values_dms), \
|
||||||
.param_values = PARAM_VALUES(level_##x##_param_values_dds), \
|
.use_dictionary = 1, \
|
||||||
.use_dictionary = 1, \
|
.advanced_api_only = 1, \
|
||||||
}; \
|
}; \
|
||||||
config_t const level_##x##_dict_copy = { \
|
config_t const level_##x##_dict_dds = { \
|
||||||
.name = "level " #x " with dict copy", \
|
.name = "level " #x " with dict dds", \
|
||||||
.cli_args = "-" #x, \
|
.cli_args = "-" #x, \
|
||||||
.param_values = PARAM_VALUES(level_##x##_param_values_dictcopy), \
|
.param_values = PARAM_VALUES(level_##x##_param_values_dds), \
|
||||||
.use_dictionary = 1, \
|
.use_dictionary = 1, \
|
||||||
|
.advanced_api_only = 1, \
|
||||||
|
}; \
|
||||||
|
config_t const level_##x##_dict_copy = { \
|
||||||
|
.name = "level " #x " with dict copy", \
|
||||||
|
.cli_args = "-" #x, \
|
||||||
|
.param_values = PARAM_VALUES(level_##x##_param_values_dictcopy), \
|
||||||
|
.use_dictionary = 1, \
|
||||||
|
.advanced_api_only = 1, \
|
||||||
|
}; \
|
||||||
|
config_t const level_##x##_dict_load = { \
|
||||||
|
.name = "level " #x " with dict load", \
|
||||||
|
.cli_args = "-" #x, \
|
||||||
|
.param_values = PARAM_VALUES(level_##x##_param_values_dictload), \
|
||||||
|
.use_dictionary = 1, \
|
||||||
|
.advanced_api_only = 1, \
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PARAM_VALUES(pv) \
|
#define PARAM_VALUES(pv) \
|
||||||
@@ -236,7 +252,7 @@ static config_t explicit_params = {
|
|||||||
static config_t const* g_configs[] = {
|
static config_t const* g_configs[] = {
|
||||||
|
|
||||||
#define FAST_LEVEL(x) &level_fast##x, &level_fast##x##_dict,
|
#define FAST_LEVEL(x) &level_fast##x, &level_fast##x##_dict,
|
||||||
#define LEVEL(x) &level_##x, &level_##x##_dict, &level_##x##_dict_dms, &level_##x##_dict_dds, &level_##x##_dict_copy,
|
#define LEVEL(x) &level_##x, &level_##x##_dict, &level_##x##_dict_dms, &level_##x##_dict_dds, &level_##x##_dict_copy, &level_##x##_dict_load,
|
||||||
#include "levels.h"
|
#include "levels.h"
|
||||||
#undef LEVEL
|
#undef LEVEL
|
||||||
#undef FAST_LEVEL
|
#undef FAST_LEVEL
|
||||||
|
@@ -53,6 +53,11 @@ typedef struct {
|
|||||||
* when the method allows it. Defaults to yes.
|
* when the method allows it. Defaults to yes.
|
||||||
*/
|
*/
|
||||||
int no_pledged_src_size;
|
int no_pledged_src_size;
|
||||||
|
/**
|
||||||
|
* Boolean parameter that says that this config should only be used
|
||||||
|
* for methods that use the advanced compression API
|
||||||
|
*/
|
||||||
|
int advanced_api_only;
|
||||||
} config_t;
|
} config_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
@@ -102,6 +102,9 @@ static result_t simple_compress(method_state_t* base, config_t const* config) {
|
|||||||
*/
|
*/
|
||||||
if (base->data->type != data_type_file)
|
if (base->data->type != data_type_file)
|
||||||
return result_error(result_error_skip);
|
return result_error(result_error_skip);
|
||||||
|
|
||||||
|
if (config->advanced_api_only)
|
||||||
|
return result_error(result_error_skip);
|
||||||
|
|
||||||
if (config->use_dictionary || config->no_pledged_src_size)
|
if (config->use_dictionary || config->no_pledged_src_size)
|
||||||
return result_error(result_error_skip);
|
return result_error(result_error_skip);
|
||||||
@@ -151,6 +154,9 @@ static result_t compress_cctx_compress(
|
|||||||
|
|
||||||
if (base->data->type != data_type_dir)
|
if (base->data->type != data_type_dir)
|
||||||
return result_error(result_error_skip);
|
return result_error(result_error_skip);
|
||||||
|
|
||||||
|
if (config->advanced_api_only)
|
||||||
|
return result_error(result_error_skip);
|
||||||
|
|
||||||
int const level = config_get_level(config);
|
int const level = config_get_level(config);
|
||||||
|
|
||||||
@@ -254,6 +260,9 @@ static result_t cli_compress(method_state_t* state, config_t const* config) {
|
|||||||
if (config->cli_args == NULL)
|
if (config->cli_args == NULL)
|
||||||
return result_error(result_error_skip);
|
return result_error(result_error_skip);
|
||||||
|
|
||||||
|
if (config->advanced_api_only)
|
||||||
|
return result_error(result_error_skip);
|
||||||
|
|
||||||
/* We don't support no pledged source size with directories. Too slow. */
|
/* We don't support no pledged source size with directories. Too slow. */
|
||||||
if (state->data->type == data_type_dir && config->no_pledged_src_size)
|
if (state->data->type == data_type_dir && config->no_pledged_src_size)
|
||||||
return result_error(result_error_skip);
|
return result_error(result_error_skip);
|
||||||
@@ -523,6 +532,10 @@ static result_t old_streaming_compress_internal(
|
|||||||
result = result_error(result_error_skip);
|
result = result_error(result_error_skip);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
if (config->advanced_api_only) {
|
||||||
|
result = result_error(result_error_skip);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
if (init_cstream(state, zcs, config, advanced, cdict ? &cd : NULL)) {
|
if (init_cstream(state, zcs, config, advanced, cdict ? &cd : NULL)) {
|
||||||
result = result_error(result_error_compression_error);
|
result = result_error(result_error_compression_error);
|
||||||
goto out;
|
goto out;
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user