Removing symbols already in unit tests and adding some new unit tests for missing symbols (#1985)

* Removing symbols that are not being tested

* Removing symbols used in zstdcli, fileio, dibio and benchzstd

* Removing symbols used in zbuff and add test-zbuff to travis

* Removing remaining symbols and adding unit tests instead

* Removing symbols test entirely
This commit is contained in:
Bimba Shrestha 2020-02-05 16:55:00 -08:00 committed by GitHub
parent 0cbafe3ce6
commit 6a4258a08a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 50 additions and 188 deletions

View File

@ -33,7 +33,7 @@ jobs:
make ppc64build; make clean
make ppcbuild ; make clean
make armbuild ; make clean
make -C tests test-legacy test-longmatch test-symbols; make clean
make -C tests test-legacy test-longmatch; make clean
make -C lib libzstd-nomt; make clean
# This step is only run on release tags.
# It publishes the source tarball as artifacts and if the GITHUB_TOKEN

View File

@ -168,6 +168,11 @@ matrix:
script:
- make test
- name: zbuff test
if: branch = master
script:
- make test-zbuff
- name: Versions Compatibility Test # 11.5mn
if: branch = master
script:

View File

@ -11,7 +11,7 @@ They consist of the following tests:
- Compilation on all supported targets (x86, x86_64, ARM, AArch64, PowerPC, and PowerPC64)
- Compilation on various versions of gcc, clang, and g++
- `tests/playTests.sh` on x86_64, without the tests on long data (CLI tests)
- Small tests (`tests/legacy.c`, `tests/longmatch.c`, `tests/symbols.c`) on x64_64
- Small tests (`tests/legacy.c`, `tests/longmatch.c`) on x64_64
Medium Tests
------------

View File

@ -14,7 +14,7 @@
- COMPILER: "gcc"
HOST: "mingw"
PLATFORM: "x64"
SCRIPT: "make allzstd MOREFLAGS=-static && make -C tests test-symbols fullbench-lib"
SCRIPT: "make allzstd MOREFLAGS=-static && make -C tests fullbench-lib"
ARTIFACT: "true"
BUILD: "true"
- COMPILER: "gcc"

View File

@ -131,14 +131,6 @@ decodecorpus = executable('decodecorpus',
dependencies: [ libzstd_dep, libm_dep ],
install: false)
symbols_sources = [join_paths(zstd_rootdir, 'tests/symbols.c')]
symbols = executable('symbols',
symbols_sources,
include_directories: test_includes,
c_args: host_machine_os == os_windows ? '-DZSTD_DLL_IMPORT=1' : [],
dependencies: [ libzstd_dep ],
install: false)
poolTests_sources = [join_paths(zstd_rootdir, 'programs/util.c'),
join_paths(zstd_rootdir, 'programs/timefn.c'),
join_paths(zstd_rootdir, 'tests/poolTests.c'),
@ -219,7 +211,6 @@ test('test-zstream-3',
timeout: 120)
test('test-longmatch', longmatch, timeout: 36)
test('test-invalidDictionaries', invalidDictionaries) # should be fast
test('test-symbols', symbols) # should be fast
if 0 < legacy_level and legacy_level <= 4
test('test-legacy', legacy) # should be fast
endif

View File

@ -222,14 +222,6 @@ legacy : $(ZSTD_FILES) $(wildcard $(ZSTDDIR)/legacy/*.c) legacy.c
decodecorpus : $(filter-out zstdc_zstd_compress.o, $(ZSTD_OBJECTS)) $(ZDICT_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c decodecorpus.c
$(CC) $(FLAGS) $^ -o $@$(EXT) -lm
symbols : symbols.c zstd-dll
ifneq (,$(filter Windows%,$(OS)))
cp $(ZSTDDIR)/dll/libzstd.dll .
$(CC) $(FLAGS) $< -o $@$(EXT) -DZSTD_DLL_IMPORT=1 libzstd.dll
else
$(CC) $(FLAGS) $< -o $@$(EXT) -Wl,-rpath=$(ZSTDDIR) $(ZSTDDIR)/libzstd.so # broken on Mac
endif
poolTests : $(PRGDIR)/util.c $(PRGDIR)/timefn.c poolTests.c $(ZSTDDIR)/common/pool.c $(ZSTDDIR)/common/threading.c $(ZSTDDIR)/common/zstd_common.c $(ZSTDDIR)/common/error_private.c
$(CC) $(FLAGS) $(MULTITHREAD) $^ -o $@$(EXT)
@ -404,9 +396,6 @@ test-bigdict: bigdict
test-invalidDictionaries: invalidDictionaries
$(QEMU_SYS) ./invalidDictionaries
test-symbols: symbols
$(QEMU_SYS) ./symbols
test-legacy: legacy
$(QEMU_SYS) ./legacy

View File

@ -366,6 +366,11 @@ static int basicUnitTests(U32 const seed, double compressibility)
DISPLAYLEVEL(3, "%i (OK) \n", mcl);
}
DISPLAYLEVEL(3, "test%3u : ZSTD_versionNumber : ", testNb++);
{ unsigned const vn = ZSTD_versionNumber();
DISPLAYLEVEL(3, "%u (OK) \n", vn);
}
DISPLAYLEVEL(3, "test%3u : compress %u bytes : ", testNb++, (unsigned)CNBuffSize);
{ ZSTD_CCtx* const cctx = ZSTD_createCCtx();
if (cctx==NULL) goto _output_error;
@ -389,13 +394,18 @@ static int basicUnitTests(U32 const seed, double compressibility)
}
DISPLAYLEVEL(3, "OK \n");
DISPLAYLEVEL(3, "test%3i : ZSTD_getFrameContentSize test : ", testNb++);
{ unsigned long long const rSize = ZSTD_getFrameContentSize(compressedBuffer, cSize);
if (rSize != CNBuffSize) goto _output_error;
}
DISPLAYLEVEL(3, "OK \n");
DISPLAYLEVEL(3, "test%3i : ZSTD_getDecompressedSize test : ", testNb++);
{ unsigned long long const rSize = ZSTD_getDecompressedSize(compressedBuffer, cSize);
if (rSize != CNBuffSize) goto _output_error;
}
DISPLAYLEVEL(3, "OK \n");
DISPLAYLEVEL(3, "test%3i : ZSTD_findDecompressedSize test : ", testNb++);
{ unsigned long long const rSize = ZSTD_findDecompressedSize(compressedBuffer, cSize);
if (rSize != CNBuffSize) goto _output_error;
@ -428,6 +438,31 @@ static int basicUnitTests(U32 const seed, double compressibility)
} }
DISPLAYLEVEL(3, "OK \n");
DISPLAYLEVEL(3, "test%3i : ZSTD_checkCParams : ", testNb++);
{
ZSTD_parameters params = ZSTD_getParams(3, 0, 0);
assert(!ZSTD_checkCParams(params.cParams));
}
DISPLAYLEVEL(3, "OK \n");
DISPLAYLEVEL(3, "test%3i : ZSTD_createDCtx_advanced and ZSTD_sizeof_DCtx: ", testNb++);
{
ZSTD_DCtx* const dctx = ZSTD_createDCtx_advanced(ZSTD_defaultCMem);
assert(dctx != NULL);
assert(ZSTD_sizeof_DCtx(dctx) != 0);
ZSTD_freeDCtx(dctx);
}
DISPLAYLEVEL(3, "OK \n");
DISPLAYLEVEL(3, "test%3i : misc unaccounted for zstd symbols : ", testNb++);
{
DISPLAYLEVEL(3, "%p ", ZSTD_getDictID_fromDDict);
DISPLAYLEVEL(3, "%p ", ZSTD_createDStream_advanced);
DISPLAYLEVEL(3, "%p ", ZSTD_copyDCtx);
DISPLAYLEVEL(3, "%p ", ZSTD_nextInputType);
}
DISPLAYLEVEL(3, ": OK \n");
DISPLAYLEVEL(3, "test%3i : decompress with null dict : ", testNb++);
{ ZSTD_DCtx* const dctx = ZSTD_createDCtx(); assert(dctx != NULL);
{ size_t const r = ZSTD_decompress_usingDict(dctx,

View File

@ -1,164 +0,0 @@
/*
* Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
#include <stdio.h>
#include "zstd_errors.h"
#define ZSTD_STATIC_LINKING_ONLY
#include "zstd.h"
#define ZBUFF_DISABLE_DEPRECATE_WARNINGS
#define ZBUFF_STATIC_LINKING_ONLY
#include "zbuff.h"
#define ZDICT_DISABLE_DEPRECATE_WARNINGS
#define ZDICT_STATIC_LINKING_ONLY
#include "zdict.h"
static const void *symbols[] = {
/* zstd.h */
&ZSTD_versionNumber,
&ZSTD_compress,
&ZSTD_decompress,
&ZSTD_getDecompressedSize,
&ZSTD_findDecompressedSize,
&ZSTD_findFrameCompressedSize,
&ZSTD_getFrameContentSize,
&ZSTD_maxCLevel,
&ZSTD_compressBound,
&ZSTD_decompressBound,
&ZSTD_isError,
&ZSTD_getErrorName,
&ZSTD_createCCtx,
&ZSTD_freeCCtx,
&ZSTD_compressCCtx,
&ZSTD_createDCtx,
&ZSTD_freeDCtx,
&ZSTD_decompressDCtx,
&ZSTD_compress_usingDict,
&ZSTD_decompress_usingDict,
&ZSTD_createCDict,
&ZSTD_freeCDict,
&ZSTD_compress_usingCDict,
&ZSTD_createDDict,
&ZSTD_freeDDict,
&ZSTD_decompress_usingDDict,
&ZSTD_createCStream,
&ZSTD_freeCStream,
&ZSTD_initCStream,
&ZSTD_compressStream,
&ZSTD_flushStream,
&ZSTD_endStream,
&ZSTD_CStreamInSize,
&ZSTD_CStreamOutSize,
&ZSTD_createDStream,
&ZSTD_freeDStream,
&ZSTD_initDStream,
&ZSTD_decompressStream,
&ZSTD_DStreamInSize,
&ZSTD_DStreamOutSize,
/* zstd.h: advanced functions */
&ZSTD_estimateCCtxSize,
&ZSTD_createCCtx_advanced,
&ZSTD_sizeof_CCtx,
&ZSTD_createCDict_advanced,
&ZSTD_sizeof_CDict,
&ZSTD_getCParams,
&ZSTD_getParams,
&ZSTD_checkCParams,
&ZSTD_adjustCParams,
&ZSTD_compress_advanced,
&ZSTD_isFrame,
&ZSTD_estimateDCtxSize,
&ZSTD_createDCtx_advanced,
&ZSTD_sizeof_DCtx,
&ZSTD_sizeof_DDict,
&ZSTD_getDictID_fromDict,
&ZSTD_getDictID_fromDDict,
&ZSTD_getDictID_fromFrame,
&ZSTD_createCStream_advanced,
&ZSTD_initCStream_srcSize,
&ZSTD_initCStream_usingDict,
&ZSTD_initCStream_advanced,
&ZSTD_initCStream_usingCDict,
&ZSTD_resetCStream,
&ZSTD_sizeof_CStream,
&ZSTD_createDStream_advanced,
&ZSTD_initDStream_usingDict,
&ZSTD_initDStream_usingDDict,
&ZSTD_resetDStream,
&ZSTD_sizeof_DStream,
&ZSTD_compressBegin,
&ZSTD_compressBegin_usingDict,
&ZSTD_compressBegin_advanced,
&ZSTD_copyCCtx,
&ZSTD_compressContinue,
&ZSTD_compressEnd,
&ZSTD_getFrameHeader,
&ZSTD_decompressBegin,
&ZSTD_decompressBegin_usingDict,
&ZSTD_copyDCtx,
&ZSTD_nextSrcSizeToDecompress,
&ZSTD_decompressContinue,
&ZSTD_nextInputType,
&ZSTD_getBlockSize,
&ZSTD_compressBlock,
&ZSTD_decompressBlock,
&ZSTD_insertBlock,
/* zstd_errors.h */
&ZSTD_getErrorCode,
&ZSTD_getErrorString,
/* zbuff.h */
&ZBUFF_createCCtx,
&ZBUFF_freeCCtx,
&ZBUFF_compressInit,
&ZBUFF_compressInitDictionary,
&ZBUFF_compressContinue,
&ZBUFF_compressFlush,
&ZBUFF_compressEnd,
&ZBUFF_createDCtx,
&ZBUFF_freeDCtx,
&ZBUFF_decompressInit,
&ZBUFF_decompressInitDictionary,
&ZBUFF_decompressContinue,
&ZBUFF_isError,
&ZBUFF_getErrorName,
&ZBUFF_recommendedCInSize,
&ZBUFF_recommendedCOutSize,
&ZBUFF_recommendedDInSize,
&ZBUFF_recommendedDOutSize,
/* zbuff.h: advanced functions */
&ZBUFF_createCCtx_advanced,
&ZBUFF_createDCtx_advanced,
&ZBUFF_compressInit_advanced,
/* zdict.h */
&ZDICT_trainFromBuffer,
&ZDICT_getDictID,
&ZDICT_isError,
&ZDICT_getErrorName,
/* zdict.h: advanced functions */
&ZDICT_trainFromBuffer_cover,
&ZDICT_optimizeTrainFromBuffer_cover,
&ZDICT_trainFromBuffer_fastCover,
&ZDICT_optimizeTrainFromBuffer_fastCover,
&ZDICT_finalizeDictionary,
&ZDICT_trainFromBuffer_legacy,
&ZDICT_addEntropyTablesFromBuffer,
NULL,
};
int main(int argc, const char** argv) {
const void **symbol;
(void)argc;
(void)argv;
for (symbol = symbols; *symbol != NULL; ++symbol) {
printf("%p\n", *symbol);
}
return 0;
}

View File

@ -35,6 +35,7 @@
#define XXH_STATIC_LINKING_ONLY
#include "xxhash.h" /* XXH64_* */
#include "util.h"
#include "assert.h"
/*-************************************
@ -180,6 +181,11 @@ static int basicUnitTests(U32 seed, double compressibility, ZSTD_customMem custo
if (readSize+readSkipSize != cSize) goto _output_error; /* should have read the entire frame */
DISPLAYLEVEL(4, "OK \n");
DISPLAYLEVEL(4, "test%3i : ZBUFF_recommendedCInSize : ", testNb++); { assert(ZBUFF_recommendedCInSize() != 0); } DISPLAYLEVEL(4, "OK \n");
DISPLAYLEVEL(4, "test%3i : ZBUFF_recommendedCOutSize : ", testNb++); { assert(ZBUFF_recommendedCOutSize() != 0); } DISPLAYLEVEL(4, "OK \n");
DISPLAYLEVEL(4, "test%3i : ZBUFF_recommendedDInSize : ", testNb++); { assert(ZBUFF_recommendedDInSize() != 0); } DISPLAYLEVEL(4, "OK \n");
DISPLAYLEVEL(4, "test%3i : ZBUFF_recommendedDOutSize : ", testNb++); { assert(ZBUFF_recommendedDOutSize() != 0); } DISPLAYLEVEL(4, "OK \n");
/* check regenerated data is byte exact */
DISPLAYLEVEL(4, "test%3i : check decompressed result : ", testNb++);
{ size_t i;