diff options
author | Takayuki MATSUOKA <takayuki.matsuoka@gmail.com> | 2014-04-16 14:25:56 (GMT) |
---|---|---|
committer | Takayuki MATSUOKA <takayuki.matsuoka@gmail.com> | 2014-04-16 14:25:56 (GMT) |
commit | 0390c7dd9d9885b7b629ff97863a2ffb1e6607e9 (patch) | |
tree | 84cc321455a8a2ad9c8146f46fab84c3f1cd0ca8 /programs/fullbench.c | |
parent | a674c55bd924b8d0a4cd8087aadac115afd294ad (diff) | |
download | lz4-0390c7dd9d9885b7b629ff97863a2ffb1e6607e9.zip lz4-0390c7dd9d9885b7b629ff97863a2ffb1e6607e9.tar.gz lz4-0390c7dd9d9885b7b629ff97863a2ffb1e6607e9.tar.bz2 |
Add command-line switch to support Travis-CI
Add command-line switch '--no-prompt' to fullbench and fuzzer.
'--no-prompt' enables :
- Throtting stdout to satisfy Travis-CI's stdout limit (10MB).
- Prevent Travis-CI's build timeouts and ignore pause by getchar().
http://docs.travis-ci.com/user/build-configuration/#Build-Timeouts
Diffstat (limited to 'programs/fullbench.c')
-rw-r--r-- | programs/fullbench.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/programs/fullbench.c b/programs/fullbench.c index 19d10ba..6304029 100644 --- a/programs/fullbench.c +++ b/programs/fullbench.c @@ -50,6 +50,7 @@ #include <stdio.h> // fprintf, fopen, ftello64 #include <sys/types.h> // stat64 #include <sys/stat.h> // stat64 +#include <string.h> // strcmp // Use ftime() if gettimeofday() is not available on your target #if defined(BMK_LEGACY_TIMER) @@ -138,6 +139,7 @@ struct chunkParameters // MACRO //************************************** #define DISPLAY(...) fprintf(stderr, __VA_ARGS__) +#define PROGRESS(...) no_prompt ? 0 : DISPLAY(__VA_ARGS__) @@ -151,6 +153,7 @@ static int compressionTest = 1; static int decompressionTest = 1; static int compressionAlgo = ALL_COMPRESSORS; static int decompressionAlgo = ALL_DECOMPRESSORS; +static int no_prompt = 0; void BMK_SetBlocksize(int bsize) { @@ -478,7 +481,7 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles) double averageTime; int milliTime; - DISPLAY("%1i-%-19.19s : %9i ->\r", loopNb, cName, (int)benchedSize); + PROGRESS("%1i-%-19.19s : %9i ->\r", loopNb, cName, (int)benchedSize); { size_t i; for (i=0; i<benchedSize; i++) compressed_buff[i]=(char)i; } // warmimg up memory nb_loops = 0; @@ -502,7 +505,7 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles) if (averageTime < bestTime) bestTime = averageTime; cSize=0; for (chunkNb=0; chunkNb<nbChunks; chunkNb++) cSize += chunkP[chunkNb].compressedSize; ratio = (double)cSize/(double)benchedSize*100.; - DISPLAY("%1i-%-19.19s : %9i -> %9i (%5.2f%%),%7.1f MB/s\r", loopNb, cName, (int)benchedSize, (int)cSize, ratio, (double)benchedSize / bestTime / 1000.); + PROGRESS("%1i-%-19.19s : %9i -> %9i (%5.2f%%),%7.1f MB/s\r", loopNb, cName, (int)benchedSize, (int)cSize, ratio, (double)benchedSize / bestTime / 1000.); } if (ratio<100.) @@ -547,7 +550,7 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles) int milliTime; U32 crcDecoded; - DISPLAY("%1i-%-24.24s :%10i ->\r", loopNb, dName, (int)benchedSize); + PROGRESS("%1i-%-24.24s :%10i ->\r", loopNb, dName, (int)benchedSize); nb_loops = 0; milliTime = BMK_GetMilliStart(); @@ -567,7 +570,7 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles) averageTime = (double)milliTime / nb_loops; if (averageTime < bestTime) bestTime = averageTime; - DISPLAY("%1i-%-24.24s :%10i -> %7.1f MB/s\r", loopNb, dName, (int)benchedSize, (double)benchedSize / bestTime / 1000.); + PROGRESS("%1i-%-24.24s :%10i -> %7.1f MB/s\r", loopNb, dName, (int)benchedSize, (double)benchedSize / bestTime / 1000.); // CRC Checking crcDecoded = XXH32(orig_buff, (int)benchedSize, 0); @@ -658,6 +661,11 @@ int main(int argc, char** argv) char* argument = argv[i]; if(!argument) continue; // Protection if argument empty + if (!strcmp(argument, "--no-prompt")) + { + no_prompt = 1; + continue; + } // Decode command (note : aggregated commands are allowed) if (argument[0]=='-') |