summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrzemyslaw Skibinski <inikep@gmail.com>2016-11-04 15:56:01 (GMT)
committerPrzemyslaw Skibinski <inikep@gmail.com>2016-11-04 15:56:01 (GMT)
commitfbede33fd7f98f62d89031b4ee29cffdc90cceb8 (patch)
tree4995035dbd8a3ed310672e4ffccb77ca5653ad46
parent8ddaddc2d64451511d88634e2061766655289774 (diff)
downloadlz4-fbede33fd7f98f62d89031b4ee29cffdc90cceb8.zip
lz4-fbede33fd7f98f62d89031b4ee29cffdc90cceb8.tar.gz
lz4-fbede33fd7f98f62d89031b4ee29cffdc90cceb8.tar.bz2
fixed Travis tests
-rw-r--r--.travis.yml2
-rw-r--r--contrib/cmake_unofficial/CMakeLists.txt2
-rw-r--r--programs/bench.c24
3 files changed, 18 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml
index 2a0eaab..ef8732c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -100,6 +100,8 @@ matrix:
sources:
- ubuntu-toolchain-r-test
packages:
+ - libc6-dev-i386
+ - gcc-multilib
- gcc-5
- gcc-5-multilib
- env: Ubu="14.04" PARAMS='-C tests test-lz4 CC=gcc-6' COMPILER=gcc-6
diff --git a/contrib/cmake_unofficial/CMakeLists.txt b/contrib/cmake_unofficial/CMakeLists.txt
index 6edec98..899ce35 100644
--- a/contrib/cmake_unofficial/CMakeLists.txt
+++ b/contrib/cmake_unofficial/CMakeLists.txt
@@ -27,7 +27,7 @@ ENDIF()
set(LZ4_DIR ../../lib/)
set(PRG_DIR ../../programs/)
set(LZ4_SRCS_LIB ${LZ4_DIR}lz4.c ${LZ4_DIR}lz4hc.c ${LZ4_DIR}lz4.h ${LZ4_DIR}lz4hc.h ${LZ4_DIR}lz4frame.c ${LZ4_DIR}lz4frame.h ${LZ4_DIR}xxhash.c)
-set(LZ4_SRCS ${LZ4_DIR}lz4frame.c ${LZ4_DIR}xxhash.c ${PRG_DIR}bench.c ${PRG_DIR}lz4cli.c ${PRG_DIR}lz4io.c)
+set(LZ4_SRCS ${LZ4_DIR}lz4frame.c ${LZ4_DIR}xxhash.c ${PRG_DIR}bench.c ${PRG_DIR}lz4cli.c ${PRG_DIR}lz4io.c ${PRG_DIR}datagen.c)
if(BUILD_TOOLS AND NOT (LINK_TOOLS_WITH_LIB AND BUILD_LIBS))
set(LZ4_SRCS ${LZ4_SRCS} ${LZ4_SRCS_LIB})
diff --git a/programs/bench.c b/programs/bench.c
index 51c07f5..33f5fcf 100644
--- a/programs/bench.c
+++ b/programs/bench.c
@@ -353,22 +353,28 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize,
static size_t BMK_findMaxMem(U64 requiredMem)
{
- size_t const step = 64 MB;
- BYTE* testmem = NULL;
+ size_t step = 64 MB;
+ BYTE* testmem=NULL;
requiredMem = (((requiredMem >> 26) + 1) << 26);
- requiredMem += step;
+ requiredMem += 2*step;
if (requiredMem > maxMemory) requiredMem = maxMemory;
- do {
- testmem = (BYTE*)malloc((size_t)requiredMem);
- requiredMem -= step;
- } while (!testmem);
+ while (!testmem) {
+ if (requiredMem > step) requiredMem -= step;
+ else requiredMem >>= 1;
+ testmem = (BYTE*) malloc ((size_t)requiredMem);
+ }
+ free (testmem);
+
+ /* keep some space available */
+ if (requiredMem > step) requiredMem -= step;
+ else requiredMem >>= 1;
- free(testmem);
- return (size_t)(requiredMem);
+ return (size_t)requiredMem;
}
+
static void BMK_benchCLevel(void* srcBuffer, size_t benchedSize,
const char* displayName, int cLevel, int cLevelLast,
const size_t* fileSizes, unsigned nbFiles)