From 5e6c24e797304a26d8704b81027c469d9e914f6c Mon Sep 17 00:00:00 2001
From: Oksana Shadura <oksana.shadura@cern.ch>
Date: Thu, 22 Jun 2017 19:56:16 +0200
Subject: [PATCH] Enabling LZ4 as default compression algorithm, fixing
 references for unit stress tests

---
 main/src/hadd.cxx |  3 ++-
 test/stress.cxx   | 35 ++++++++++++++++++++++++++++-------
 2 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/main/src/hadd.cxx b/main/src/hadd.cxx
index 03f2ba71812..673bd7c514c 100644
--- a/main/src/hadd.cxx
+++ b/main/src/hadd.cxx
@@ -124,7 +124,8 @@ int main( int argc, char **argv )
       std::cout << "If the option -experimental-io-features is used (and an argument provided), then\n"
                    "   the corresponding experimental feature will be enabled for output trees." << std::endl;
       std::cout << "When -the -f option is specified, one can also specify the compression level of\n"
-                   "   the target file.  By default the compression level is 1." <<std::endl;
+                   "   the target file.  By default the compression level is 4."
+                << std::endl;
       std::cout << "If \"-fk\" is specified, the target file contain the baskets with the same\n"
                    "   compression as in the input files unless -O is specified.  The meta data will\n"
                    "   be compressed using the compression level specified in the first input or the\n"
diff --git a/test/stress.cxx b/test/stress.cxx
index 321bdbb2e88..7df763321b1 100644
--- a/test/stress.cxx
+++ b/test/stress.cxx
@@ -356,8 +356,15 @@ void stress2()
    //Long64_t lastgood = 12383; //9428;
    //Long64_t lastgood = 9789;  // changes for new TFormula
    //Long64_t lastgood = 9797;  // changes for TH1 v8 ROOT-9173 on 32-bits
-   Long64_t lastgood = 10032;  // changes in TFormula (v12)
-   if (last <lastgood-200 || last > lastgood+200 || comp <2.0 || comp > 2.4) OK = kFALSE;
+#ifdef R__HAS_LZ4
+      Long64_t lastgood = 11579;
+      if (last < lastgood - 200 || last > lastgood + 200 || comp < 1.5 || comp > 2.1)
+         OK = kFALSE;
+#else
+      Long64_t lastgood = 10032;  // changes in TFormula (v12)
+      if (last < lastgood - 200 || last > lastgood + 200 || comp < 2.0 || comp > 2.4)
+         OK = kFALSE;
+#endif
    if (OK) printf("OK\n");
    else    {
       printf("FAILED\n");
@@ -387,14 +394,28 @@ void stress3()
    Long64_t last = f.GetEND();
    Float_t comp = f.GetCompressionFactor();
    Bool_t OK = kTRUE;
-   constexpr Long64_t lastgood  = 51851;
-   constexpr Long64_t tolerance = 150;
-   if (last <lastgood-tolerance || last > lastgood+tolerance || comp <1.8 || comp > 2.4) OK = kFALSE;
+   constexpr Long64_t lastgood = 51886;
+   constexpr Long64_t tolerance = 100;
+#ifdef R__HAS_LZ4
+      constexpr Long64_t difflastgoodlz4 = 5500;
+      if (last < lastgood - tolerance || last > lastgood + difflastgoodlz4 + tolerance || comp < 1.5 || comp > 2.1)
+         OK = kFALSE;
+#else
+      if (last < lastgood - tolerance || last > lastgood + tolerance || comp < 1.8 || comp > 2.4)
+         OK = kFALSE;
+#endif
    if (OK) printf("OK\n");
    else    {
       printf("FAILED\n");
-      printf("%-8s File size= %lld (expected %lld +/- %lld)\n"
-             "%-8s Comp Fact=  %3.2f (expected 2.1 +/- 0.3)\n"," ",last,lastgood,tolerance," ",comp);
+#ifdef R__HAS_LZ4
+      printf("%-8s LZ4 file size= %lld (expected %lld +/- %lld)\n"
+             "%-8s Comp Fact=  %3.2f (expected 1.8 +/- 0.3)\n",
+             " ", last, lastgood + difflastgoodlz4, tolerance, " ", comp);
+#else
+       printf("%-8s File size= %lld (expected %lld +/- %lld)\n"
+             "%-8s Comp Fact=  %3.2f (expected 2.1 +/- 0.3)\n",
+             " ", last, lastgood, tolerance, " ", comp);
+#endif
    }
    if (gPrintSubBench) { printf("Test  3 : "); gBenchmark->Show("stress");gBenchmark->Start("stress"); }
 }
-- 
GitLab