You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2021/04/03 08:29:53 UTC

[logging-log4j2] branch master updated: Set timeout for Linux for consistency. Fix test bug

This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/master by this push:
     new 55480fc  Set timeout for Linux for consistency. Fix test bug
55480fc is described below

commit 55480fc829a04b0d6d31860366271c8d588afc09
Author: Ralph Goers <rg...@apache.org>
AuthorDate: Sat Apr 3 01:29:35 2021 -0700

    Set timeout for Linux for consistency. Fix test bug
---
 .github/workflows/main.yml                                        | 1 +
 .../test/java/org/apache/logging/log4j/core/SimplePerfTest.java   | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index fdc4f0a..82ea17a 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -36,6 +36,7 @@ jobs:
         run: env | grep '^JAVA'
 
       - name: Build with Maven (Linux)
+        timeout-minutes: 60
         if: runner.os == 'Linux'
         continue-on-error: true
         run: ./mvnw -V -B --no-transfer-progress -e -DtrimStackTrace=false -Dmaven.test.failure.ignore=true -Dsurefire.rerunFailingTestsCount=1  verify
diff --git a/log4j-core-its/src/test/java/org/apache/logging/log4j/core/SimplePerfTest.java b/log4j-core-its/src/test/java/org/apache/logging/log4j/core/SimplePerfTest.java
index 150905b..9e957c7 100644
--- a/log4j-core-its/src/test/java/org/apache/logging/log4j/core/SimplePerfTest.java
+++ b/log4j-core-its/src/test/java/org/apache/logging/log4j/core/SimplePerfTest.java
@@ -84,13 +84,13 @@ public class SimplePerfTest {
         timer.stop();
         System.out.println(timer.toString());
         long elapsed = timer.getElapsedNanoTime();
-        assertTrue(String.format(FORMAT, maxTime, maxTime - elapsed), maxTime > elapsed);
+        assertTrue(String.format(FORMAT, maxTime, elapsed - maxTime), maxTime > elapsed);
     }
 
     @Test
     public void debugDisabledByLevel() {
         System.gc();
-        final Timer timer = new Timer("DebugDisabled", LOOP_CNT);
+        final Timer timer = new Timer("IsEnabled", LOOP_CNT);
         timer.start();
         for (int i=0; i < LOOP_CNT; ++i) {
             logger.isEnabled(Level.DEBUG);
@@ -98,7 +98,7 @@ public class SimplePerfTest {
         timer.stop();
         System.out.println(timer.toString());
         long elapsed = timer.getElapsedNanoTime();
-        assertTrue(String.format(FORMAT, maxTime, maxTime - elapsed), maxTime > elapsed);
+        assertTrue(String.format(FORMAT, maxTime, elapsed - maxTime), maxTime > elapsed);
     }
 
     @Test
@@ -113,7 +113,7 @@ public class SimplePerfTest {
         timer.stop();
         System.out.println(timer.toString());
         long elapsed = timer.getElapsedNanoTime();
-        assertTrue(String.format(FORMAT, maxTime, maxTime - elapsed), maxTime > elapsed);
+        assertTrue(String.format(FORMAT, maxTime, elapsed - maxTime), maxTime > elapsed);
     }
     /*
     @Test