Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
frametest.c File Reference
#include "util.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <assert.h>
#include "lz4frame.h"
#include "lz4.h"
#include "xxhash.h"

Data Structures

struct  Test_alloc_state
 

Macros

#define LZ4F_STATIC_LINKING_ONLY
 
#define LZ4_STATIC_LINKING_ONLY   /* LZ4_DISTANCE_MAX */
 
#define XXH_STATIC_LINKING_ONLY
 
#define KB   *(1U<<10)
 
#define MB   *(1U<<20)
 
#define GB   *(1U<<30)
 
#define FUZ_COMPRESSIBILITY_DEFAULT   50
 
#define DISPLAY(...)
 
#define DISPLAYLEVEL(l, ...)
 
#define DISPLAYUPDATE(l, ...)
 
#define MIN(a, b)
 
#define MAX(a, b)
 
#define FUZ_rotl32(x, r)
 
#define RAND_BITS(N)
 
#define FUZ_LITERAL   (RAND_BITS(6) + '0')
 
#define FUZ_ABOUT(_R)
 
#define CONTROL(c)
 
#define CHECK_V(v, f)
 
#define CHECK(f)
 
#define COMPRESSIBLE_NOISE_LENGTH   (2 MB)
 
#define EXIT_MSG(...)
 
#define CHECK(cond, ...)
 

Enumerations

enum  o_scenario_e { o_contiguous , o_noncontiguous , o_overwrite }
 

Functions

unsigned int FUZ_rand (unsigned int *src)
 
size_t test_lz4f_decompression_wBuffers (const void *cSrc, size_t cSize, void *dst, size_t dstCapacity, o_scenario_e o_scenario, const void *srcRef, size_t decompressedSize, U64 crcOrig, U32 *const randState, LZ4F_dctx *const dCtx, U32 seed, U32 testNb, int findErrorPos)
 
size_t test_lz4f_decompression (const void *cSrc, size_t cSize, const void *srcRef, size_t decompressedSize, U64 crcOrig, U32 *const randState, LZ4F_dctx *const dCtx, U32 seed, U32 testNb, int findErrorPos)
 
int fuzzerTests (U32 seed, unsigned nbTests, unsigned startTest, double compressibility, U32 duration_s)
 
int FUZ_usage (const char *programName)
 
int main (int argc, const char **argv)
 

Macro Definition Documentation

◆ CHECK [1/2]

#define CHECK ( cond,
... )
Value:
{ if (cond) { EXIT_MSG(__VA_ARGS__); } }
#define EXIT_MSG(...)
Definition frametest.c:992

◆ CHECK [2/2]

#define CHECK ( f)
Value:
{ LZ4F_errorCode_t const CHECK_V(err_ , f); }
#define CHECK_V(v, f)
Definition frametest.c:276
size_t LZ4F_errorCode_t
Definition lz4frame.h:103
#define f(i)
Definition sha256.c:46

◆ CHECK_V

#define CHECK_V ( v,
f )
Value:
v = f; if (LZ4F_isError(v)) { fprintf(stderr, "%s \n", LZ4F_getErrorName(v)); goto _output_error; }
unsigned LZ4F_isError(LZ4F_errorCode_t code)
Definition lz4frame.c:293
const char * LZ4F_getErrorName(LZ4F_errorCode_t code)
Definition lz4frame.c:298

◆ COMPRESSIBLE_NOISE_LENGTH

#define COMPRESSIBLE_NOISE_LENGTH   (2 MB)

◆ CONTROL

#define CONTROL ( c)
Value:
{ \
if (!(c)) { \
DISPLAY("Error (line %i) => %s not respected \n", __LINE__, #c); \
return 1; \
} }
#define c(i)
Definition sha256.c:43

◆ DISPLAY

#define DISPLAY ( ...)
Value:
fprintf(stderr, __VA_ARGS__)

◆ DISPLAYLEVEL

#define DISPLAYLEVEL ( l,
... )
Value:
do { if (displayLevel>=(l)) DISPLAY(__VA_ARGS__); } while (0)
#define DISPLAY(...)
Definition frametest.c:82

◆ DISPLAYUPDATE

#define DISPLAYUPDATE ( l,
... )
Value:
do { if (displayLevel>=(l)) { \
if ((FUZ_GetClockSpan(g_clockTime) > refreshRate) || (displayLevel>=4)) \
{ g_clockTime = clock(); DISPLAY(__VA_ARGS__); \
if (displayLevel>=4) fflush(stdout); } } } while (0)
while(len< limit &&buf1[len]==buf2[len])++len

◆ EXIT_MSG

#define EXIT_MSG ( ...)
Value:
{ DISPLAY("Error => "); DISPLAY(__VA_ARGS__); \
DISPLAY(" (seed %u, test nb %u) \n", seed, testNb); exit(1); }
uint32_t seed
Definition stream_decompress.c:26

◆ FUZ_ABOUT

#define FUZ_ABOUT ( _R)
Value:
((FUZ_rand(randState) % (_R)) + (FUZ_rand(randState) % (_R)) + 1)
unsigned int FUZ_rand(unsigned int *src)
Definition frametest.c:164

◆ FUZ_COMPRESSIBILITY_DEFAULT

#define FUZ_COMPRESSIBILITY_DEFAULT   50

◆ FUZ_LITERAL

#define FUZ_LITERAL   (RAND_BITS(6) + '0')

◆ FUZ_rotl32

#define FUZ_rotl32 ( x,
r )
Value:
((x << r) | (x >> (32 - r)))

◆ GB

#define GB   *(1U<<30)

◆ KB

#define KB   *(1U<<10)

◆ LZ4_STATIC_LINKING_ONLY

#define LZ4_STATIC_LINKING_ONLY   /* LZ4_DISTANCE_MAX */

◆ LZ4F_STATIC_LINKING_ONLY

#define LZ4F_STATIC_LINKING_ONLY

◆ MAX

#define MAX ( a,
b )
Value:
( (a) > (b) ? (a) : (b) )
#define b(i)
Definition sha256.c:42
#define a(i)
Definition sha256.c:41

◆ MB

#define MB   *(1U<<20)

◆ MIN

#define MIN ( a,
b )
Value:
( (a) < (b) ? (a) : (b) )

◆ RAND_BITS

#define RAND_BITS ( N)
Value:
(FUZ_rand(randState) & ((1 << (N))-1))

◆ XXH_STATIC_LINKING_ONLY

#define XXH_STATIC_LINKING_ONLY

Enumeration Type Documentation

◆ o_scenario_e

Enumerator
o_contiguous 
o_noncontiguous 
o_overwrite 

Function Documentation

◆ FUZ_rand()

unsigned int FUZ_rand ( unsigned int * src)

◆ FUZ_usage()

int FUZ_usage ( const char * programName)

◆ fuzzerTests()

int fuzzerTests ( U32 seed,
unsigned nbTests,
unsigned startTest,
double compressibility,
U32 duration_s )

◆ main()

int main ( int argc,
const char ** argv )

◆ test_lz4f_decompression()

size_t test_lz4f_decompression ( const void * cSrc,
size_t cSize,
const void * srcRef,
size_t decompressedSize,
U64 crcOrig,
U32 *const randState,
LZ4F_dctx *const dCtx,
U32 seed,
U32 testNb,
int findErrorPos )

◆ test_lz4f_decompression_wBuffers()

size_t test_lz4f_decompression_wBuffers ( const void * cSrc,
size_t cSize,
void * dst,
size_t dstCapacity,
o_scenario_e o_scenario,
const void * srcRef,
size_t decompressedSize,
U64 crcOrig,
U32 *const randState,
LZ4F_dctx *const dCtx,
U32 seed,
U32 testNb,
int findErrorPos )