[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-61-g3d5ba2c

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Thu Mar 4 00:18:30 CET 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, master has been updated
       via  3d5ba2cfc7f4c381ba2fc10cd0a5342c6330757c (commit)
      from  d87d66c281909ad2e24013286821874416a2c87e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=3d5ba2cfc7f4c381ba2fc10cd0a5342c6330757c
http://github.com/ceki/logback/commit/3d5ba2cfc7f4c381ba2fc10cd0a5342c6330757c

commit 3d5ba2cfc7f4c381ba2fc10cd0a5342c6330757c
Author: Ceki Gulcu <ceki at gimmel.(none)>
Date:   Wed Mar 3 23:59:51 2010 +0100

    attempt to improve test passing rate

diff --git a/logback-core/src/test/java/ch/qos/logback/core/FileAppenderResilienceTest.java b/logback-core/src/test/java/ch/qos/logback/core/FileAppenderResilienceTest.java
index 2b55163..99a6698 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/FileAppenderResilienceTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/FileAppenderResilienceTest.java
@@ -63,8 +63,9 @@ public class FileAppenderResilienceTest {
     Thread t = new Thread(runner);
     t.start();
 
+    double delayCoeff = 2.0;
     for (int i = 0; i < 5; i++) {
-      Thread.sleep((int) (RecoveryCoordinator.BACKOFF_COEFFICIENT_MIN * 2));
+      Thread.sleep((int)(RecoveryCoordinator.BACKOFF_COEFFICIENT_MIN * delayCoeff));
       ResilientFileOutputStream resilientFOS = (ResilientFileOutputStream) fa
           .getOutputStream();
       FileChannel fileChannel = resilientFOS.getChannel();
@@ -73,8 +74,9 @@ public class FileAppenderResilienceTest {
     runner.setDone(true);
     t.join();
 
+    double bestCase = 1/delayCoeff;
     ResilienceUtil
-        .verify(logfileStr, "^hello (\\d{1,5})$", runner.getCounter());
+        .verify(logfileStr, "^hello (\\d{1,5})$", runner.getCounter(), bestCase);
   }
 }
 
@@ -89,7 +91,7 @@ class Runner extends RunnableWithCounterAndDone {
     while (!isDone()) {
       counter++;
       fa.doAppend("hello " + counter);
-      if (counter % 512 == 0) {
+      if (counter % 1024 == 0) {
         try {
           Thread.sleep(10);
         } catch (InterruptedException e) {
diff --git a/logback-core/src/test/java/ch/qos/logback/core/FileAppenderResilience_AS_ROOT_Test.java b/logback-core/src/test/java/ch/qos/logback/core/FileAppenderResilience_AS_ROOT_Test.java
index 0ed804b..a5a7691 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/FileAppenderResilience_AS_ROOT_Test.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/FileAppenderResilience_AS_ROOT_Test.java
@@ -35,7 +35,6 @@ public class FileAppenderResilience_AS_ROOT_Test {
 
   static String PATH_LOOPFS_SCRIPT = "/home/ceki/java/logback/logback-core/src/test/loopfs.sh";
 
-  
   enum LoopFSCommand {
     setup, shake, teardown;
   }
@@ -44,16 +43,16 @@ public class FileAppenderResilience_AS_ROOT_Test {
   int diff = RandomUtil.getPositiveInt();
   String outputDirStr = MOUNT_POINT + "resilience-" + diff + "/";
   String logfileStr = outputDirStr + "output.log";
-  
+
   FileAppender<Object> fa = new FileAppender<Object>();
 
   static boolean isConformingHost() {
-    return Env.isLocalHostNameInList(new String[] {"gimmel"});
+    return Env.isLocalHostNameInList(new String[] { "gimmel" });
   }
-  
+
   @Before
   public void setUp() throws IOException, InterruptedException {
-    if(!isConformingHost()) {
+    if (!isConformingHost()) {
       return;
     }
     Process p = runLoopFSScript(LoopFSCommand.setup);
@@ -89,10 +88,9 @@ public class FileAppenderResilience_AS_ROOT_Test {
     }
   }
 
-  
   @After
   public void tearDown() throws IOException, InterruptedException {
-    if(!isConformingHost()) {
+    if (!isConformingHost()) {
       return;
     }
     StatusPrinter.print(context);
@@ -108,7 +106,7 @@ public class FileAppenderResilience_AS_ROOT_Test {
 
   @Test
   public void go() throws IOException, InterruptedException {
-    if(!isConformingHost()) {
+    if (!isConformingHost()) {
       return;
     }
     Process p = runLoopFSScript(LoopFSCommand.shake);
@@ -117,7 +115,9 @@ public class FileAppenderResilience_AS_ROOT_Test {
       Thread.sleep(DELAY);
     }
     p.waitFor();
-    ResilienceUtil.verify(logfileStr, "^(\\d{1,3}) x*$", NUM_STEPS);
+    // the extrernal script has the file system ready for IO 50% of the time
+    double bestCase = 0.5;
+    ResilienceUtil.verify(logfileStr, "^(\\d{1,3}) x*$", NUM_STEPS, bestCase);
     System.out.println("Done go");
   }
 
@@ -127,7 +127,7 @@ public class FileAppenderResilience_AS_ROOT_Test {
       InterruptedException {
     // causing a NullPointerException is better than locking the whole
     // machine which the next operation can and will do.
-    if(!isConformingHost()) {
+    if (!isConformingHost()) {
       return null;
     }
     ProcessBuilder pb = new ProcessBuilder();
diff --git a/logback-core/src/test/java/ch/qos/logback/core/util/ResilienceUtil.java b/logback-core/src/test/java/ch/qos/logback/core/util/ResilienceUtil.java
index 2233fbc..9a8d2e5 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/util/ResilienceUtil.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/util/ResilienceUtil.java
@@ -11,7 +11,7 @@ import java.util.regex.Pattern;
 public class ResilienceUtil {
 
   
-  static public void verify(String logfile, String regexp, long totalSteps) throws NumberFormatException, IOException {
+  static public void verify(String logfile, String regexp, long totalSteps, double bestCase) throws NumberFormatException, IOException {
     FileReader fr = new FileReader(logfile);
     BufferedReader br = new BufferedReader(fr);
     Pattern p = Pattern.compile(regexp);
@@ -35,8 +35,9 @@ public class ResilienceUtil {
     fr.close();
     br.close();
 
+    double expectedSuccessRate = bestCase * 0.7;
     // at least 40% of the logs should have been written
-    int lowerLimit = (int) (totalSteps*0.4);
+    int lowerLimit = (int) (totalSteps*expectedSuccessRate);
     assertTrue("totalLines="+totalLines+" less than "+lowerLimit, totalLines > lowerLimit);
     
     // we want some gaps which indicate recuperation

-----------------------------------------------------------------------

Summary of changes:
 .../logback/core/FileAppenderResilienceTest.java   |    8 +++++---
 .../core/FileAppenderResilience_AS_ROOT_Test.java  |   20 ++++++++++----------
 .../ch/qos/logback/core/util/ResilienceUtil.java   |    5 +++--
 3 files changed, 18 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list