Skip to content
This repository was archived by the owner on Sep 13, 2023. It is now read-only.

Commit e89a55b

Browse files
committed
Clean up test suite
Significant test suite cleanup/refactoring. Change maven unit test config to run all tests instead of a whitelist. Many more unit tests are now running. Make maven clean up the unit test outputs. Remove hopelessly broken tests: * tests/src/java/org/apache/log4j/AsyncAppenderTestCase.java * tests/src/java/org/apache/log4j/defaultInit/TestCase2.java * tests/src/java/org/apache/log4j/defaultInit/TestCase3.java * tests/src/java/org/apache/log4j/defaultInit/TestCase4.java None of these were being run during the build. Change many tests that read/write files to use unique filenames. This avoids tests output leaking between tests. The suite is now a bit less brittle. Delete left-over SocketServer configs now that it is disabled.
1 parent 2283a0e commit e89a55b

File tree

72 files changed

+134
-865
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+134
-865
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
target/
22
tests/output/
3+
tests/temp
34
.idea/

pom.xml

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -154,47 +154,6 @@ Building of NTEventLogappender.dll is disabled. Use an older log4j to get it.
154154
<forkMode>pertest</forkMode><!-- deprecated, but tests fail when changing the setting -->
155155
<skip>false</skip>
156156
<argLine>-Djava.library.path=${project.basedir}</argLine>
157-
<includes>
158-
<include>org/apache/log4j/LevelTest.java</include>
159-
<include>org/apache/log4j/PriorityTest.java</include>
160-
<include>org/apache/log4j/CategoryTest.java</include>
161-
<include>org/apache/log4j/FileAppenderTest.java</include>
162-
<include>org/apache/log4j/LogManagerTest.java</include>
163-
<include>org/apache/log4j/helpers.LogLogTest.java</include>
164-
<include>org/apache/log4j/LayoutTest.java</include>
165-
<include>org/apache/log4j/helpers.DateLayoutTest.java</include>
166-
<include>org/apache/log4j/TTCCLayoutTest.java</include>
167-
<include>org/apache/log4j/xml.XMLLayoutTest.java</include>
168-
<include>org/apache/log4j/HTMLLayoutTest.java</include>
169-
<include>org/apache/log4j/PatternLayoutTest.java</include>
170-
<include>org/apache/log4j/spi.LoggingEventTest.java</include>
171-
<include>org/apache/log4j/spi.ThrowableInformationTest.java</include>
172-
<include>org/apache/log4j/spi.LocationInfoTest.java</include>
173-
<include>org/apache/log4j/PropertyConfiguratorTest.java</include>
174-
<include>org/apache/log4j/MinimumTestCase.java</include>
175-
<include>org/apache/log4j/LoggerTestCase.java</include>
176-
<include>org/apache/log4j/PatternLayoutTestCase.java</include>
177-
<include>org/apache/log4j/HierarchyThresholdTestCase.java</include>
178-
<include>org/apache/log4j/xml/DOMTestCase.java</include>
179-
<include>org/apache/log4j/xml/CustomLevelTestCase.java</include>
180-
<include>org/apache/log4j/customLogger/XLoggerTestCase.java</include>
181-
<!-- DefaultInit -->
182-
<include>org/apache/log4j/xml/XMLLayoutTestCase.java</include>
183-
<include>org/apache/log4j/xml/AsyncAppenderTestCase.java</include>
184-
<include>org/apache/log4j/varia/LevelMatchFilterTestCase.java</include>
185-
<!-- ErrorHandlerTestCase is not run in Ant build either <include>org/apache/log4j/varia/ErrorHandlerTestCase.java</include> -->
186-
<!-- include>org/apache/log4j/helpers/OptionConverterTestCase.java</include -->
187-
<include>org/apache/log4j/helpers/BoundedFIFOTestCase.java</include>
188-
<include>org/apache/log4j/helpers/CyclicBufferTestCase.java</include>
189-
<include>org/apache/log4j/helpers/PatternParserTestCase.java</include>
190-
<include>org/apache/log4j/or/ORTestCase.java</include>
191-
<include>org/apache/log4j/DRFATestCase.java</include>
192-
<include>org/apache/log4j/RFATestCase.java</include>
193-
<include>org/apache/log4j/varia/ERFATestCase.java</include>
194-
<include>org/apache/log4j/net/SyslogAppenderTest</include>
195-
<include>org/apache/log4j/nt/NTEventLogAppenderTest</include>
196-
<include>org/apache/log4j/net/SocketAppenderTest</include>
197-
</includes>
198157
</configuration>
199158
</plugin>
200159
<plugin>
@@ -348,6 +307,25 @@ Building of NTEventLogappender.dll is disabled. Use an older log4j to get it.
348307
<templateFile>${basedir}/src/site/site-template.vm</templateFile>
349308
</configuration>
350309
</plugin>
310+
<plugin>
311+
<artifactId>maven-clean-plugin</artifactId>
312+
<version>3.1.0</version>
313+
<configuration>
314+
<filesets>
315+
<fileset>
316+
<directory>${basedir}/tests/output</directory>
317+
<followSymlinks>false</followSymlinks>
318+
</fileset>
319+
<fileset>
320+
<directory>${basedir}/tests</directory>
321+
<followSymlinks>false</followSymlinks>
322+
<includes>
323+
<include>temp</include>
324+
</includes>
325+
</fileset>
326+
</filesets>
327+
</configuration>
328+
</plugin>
351329
</plugins>
352330
<testSourceDirectory>tests/src/java</testSourceDirectory>
353331
<resources>

tests/input/fallback1.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ log4j.appender.PRIMARY.layout=org.apache.log4j.PatternLayout
2424
log4j.appender.PRIMARY.layout.conversionPattern=%-5p %c{2} - %m%n
2525

2626
log4j.appender.FALLBACK=org.apache.log4j.FileAppender
27-
log4j.appender.FALLBACK.File=output/temp
27+
log4j.appender.FALLBACK.File=output/temp.ErrorHandlerTestCase
2828
log4j.appender.FALLBACK.Append=false
2929
log4j.appender.FALLBACK.layout=org.apache.log4j.PatternLayout
3030
log4j.appender.FALLBACK.layout.ConversionPattern=FALLBACK - %c - %m%n

tests/input/hierarchyThreshold1.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
log4j.threshold=OFF
1717
log4j.rootLogger=,A
1818
log4j.appender.A=org.apache.log4j.FileAppender
19-
log4j.appender.A.File=output/temp
19+
log4j.appender.A.File=output/temp.HierarchyThresholdTestCase
2020
log4j.appender.A.Append=false
2121
log4j.appender.A.layout=org.apache.log4j.PatternLayout
22-
log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n
22+
log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n

tests/input/hierarchyThreshold2.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
log4j.threshold=FATAL
1717
log4j.rootLogger=,A
1818
log4j.appender.A=org.apache.log4j.FileAppender
19-
log4j.appender.A.File=output/temp
19+
log4j.appender.A.File=output/temp.HierarchyThresholdTestCase
2020
log4j.appender.A.Append=false
2121
log4j.appender.A.layout=org.apache.log4j.PatternLayout
22-
log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n
22+
log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n

tests/input/hierarchyThreshold3.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
log4j.threshold=ERROR
1717
log4j.rootLogger=,A
1818
log4j.appender.A=org.apache.log4j.FileAppender
19-
log4j.appender.A.File=output/temp
19+
log4j.appender.A.File=output/temp.HierarchyThresholdTestCase
2020
log4j.appender.A.Append=false
2121
log4j.appender.A.layout=org.apache.log4j.PatternLayout
22-
log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n
22+
log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n

tests/input/hierarchyThreshold4.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
log4j.threshold=WARN
1717
log4j.rootLogger=,A
1818
log4j.appender.A=org.apache.log4j.FileAppender
19-
log4j.appender.A.File=output/temp
19+
log4j.appender.A.File=output/temp.HierarchyThresholdTestCase
2020
log4j.appender.A.Append=false
2121
log4j.appender.A.layout=org.apache.log4j.PatternLayout
22-
log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n
22+
log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n

tests/input/hierarchyThreshold5.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
log4j.threshold=INFO
1717
log4j.rootLogger=,A
1818
log4j.appender.A=org.apache.log4j.FileAppender
19-
log4j.appender.A.File=output/temp
19+
log4j.appender.A.File=output/temp.HierarchyThresholdTestCase
2020
log4j.appender.A.Append=false
2121
log4j.appender.A.layout=org.apache.log4j.PatternLayout
22-
log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n
22+
log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n

tests/input/hierarchyThreshold6.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
log4j.threshold=DEBUG
1717
log4j.rootLogger=,A
1818
log4j.appender.A=org.apache.log4j.FileAppender
19-
log4j.appender.A.File=output/temp
19+
log4j.appender.A.File=output/temp.HierarchyThresholdTestCase
2020
log4j.appender.A.Append=false
2121
log4j.appender.A.layout=org.apache.log4j.PatternLayout
22-
log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n
22+
log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n

tests/input/hierarchyThreshold7.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
log4j.threshold=TRACE#org.apache.log4j.xml.XLevel
1717
log4j.rootLogger=ALL,A
1818
log4j.appender.A=org.apache.log4j.FileAppender
19-
log4j.appender.A.File=output/temp
19+
log4j.appender.A.File=output/temp.HierarchyThresholdTestCase
2020
log4j.appender.A.Append=false
2121
log4j.appender.A.layout=org.apache.log4j.PatternLayout
2222
log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n

0 commit comments

Comments
 (0)