Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
run: |
ant -noinput echoproperties deploy embed test-nio test-status
env:
ANT_OPTS: -Dtest.openssl.exists=false -Dtest.excludePerformance=true -Dtest.exclude=jakarta/servlet/http/TestHttpServletResponseSendError.java,org/apache/catalina/authenticator/TestFormAuthenticatorA.java,org/apache/catalina/authenticator/TestFormAuthenticatorB.java,org/apache/catalina/authenticator/TestFormAuthenticatorC.java,org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java,org/apache/catalina/authenticator/TestSSOnonLoginAndDigestAuthenticator.java,org/apache/catalina/core/TestAsyncContextImpl.java,org/apache/catalina/core/TestAsyncContextStateChanges.java,org/apache/catalina/core/TestStandardContextResources.java,org/apache/catalina/core/TestStandardWrapper.java,org/apache/catalina/loader/TestVirtualContext.java,org/apache/catalina/mapper/TestMapperWebapps.java,org/apache/catalina/nonblocking/TestNonBlockingAPI.java,org/apache/catalina/servlets/TestDefaultServletEncodingPassThroughBom.java,org/apache/catalina/servlets/TestDefaultServletEncodingWithBom.java,org/apache/catalina/servlets/TestDefaultServletEncodingWithoutBom.java,org/apache/catalina/servlets/TestDefaultServletIfMatchRequests.java,org/apache/catalina/servlets/TestDefaultServlet.java,org/apache/catalina/servlets/TestDefaultServletOptions.java,org/apache/catalina/servlets/TestWebdavServletOptionsFile.java,org/apache/catalina/startup/TestContextConfig.java,org/apache/catalina/startup/TestHostConfigAutomaticDeploymentA.java,org/apache/catalina/startup/TestHostConfigAutomaticDeploymentB.java,org/apache/catalina/startup/TestHostConfigAutomaticDeploymentC.java,org/apache/catalina/valves/rewrite/TestRewriteValve.java,org/apache/catalina/valves/TestStuckThreadDetectionValve.java,org/apache/coyote/ajp/TestAbstractAjpProcessor.java,org/apache/coyote/http11/filters/TestChunkedInputFilter.java,org/apache/coyote/http11/TestHttp11InputBufferCRLF.java,org/apache/coyote/http11/TestHttp11InputBuffer.java,org/apache/coyote/http11/TestHttp11Processor.java,org/apache/coyote/http2/TestAsync.java,org/apache/coyote/http2/TestHttp2ConnectionTimeouts.java,org/apache/coyote/http2/TestHttp2Limits.java,org/apache/coyote/http2/TestHttp2Section_6_8.java,org/apache/coyote/http2/TestHttp2Timeouts.java,org/apache/coyote/http2/TestStreamQueryString.java,org/apache/el/TestELInJsp.java,org/apache/jasper/compiler/TestCompiler.java,org/apache/jasper/compiler/TestEncodingDetector.java,org/apache/jasper/compiler/TestGenerator.java,org/apache/jasper/compiler/TestJspConfig.java,org/apache/jasper/compiler/TestJspDocumentParser.java,org/apache/jasper/compiler/TestValidator.java,org/apache/jasper/optimizations/TestELInterpreterTagSetters.java,org/apache/jasper/optimizations/TestStringInterpreterTagSetters.java,org/apache/jasper/runtime/TestCustomHttpJspPage.java,org/apache/jasper/runtime/TestJspContextWrapper.java,org/apache/jasper/runtime/TestJspRuntimeLibrary.java,org/apache/jasper/runtime/TestPageContextImpl.java,org/apache/jasper/servlet/TestTldScanner.java,org/apache/naming/resources/TestWarDirContext.java,org/apache/naming/TestEnvEntry.java,org/apache/tomcat/util/net/TestClientCert.java,org/apache/tomcat/util/net/TestCustomSslTrustManager.java,org/apache/tomcat/util/net/TestSSLHostConfigCompat.java,org/apache/tomcat/util/net/TestSsl.java,org/apache/tomcat/websocket/server/TestSlowClient.java,org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java,org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java,org/apache/tomcat/websocket/TestWsWebSocketContainer.java,org/apache/tomcat/websocket/TestWsWebSocketContainerTimeoutServer.java,org/apache/catalina/tribes/group/interceptors/TestTcpFailureDetector.java,org/apache/catalina/filters/TestRateLimitFilter.java,jakarta/servlet/http/TestHttpServletDoHeadInvalidWrite*.java,jakarta/servlet/http/TestHttpServletDoHeadValidWrite*.java
ANT_OPTS: -Dtest.openssl.exists=false -Dtest.excludePerformance=true -Dtest.profile=smoke

- name: Upload logs
if: ${{ !cancelled() }}
Expand Down
106 changes: 98 additions & 8 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
<property name="tomcat-jdbc-src.jar" value="${tomcat.pool}/tomcat-jdbc-src.jar"/>

<!-- Tests To Run -->
<property name="test.name" value="**/Test*.java"/>
<!-- NOTE: test.name default is set in -test-profile-init target to allow profile override -->
<property name="test.formatter" value="-Dorg.apache.juli.formatter=java.util.logging.SimpleFormatter"/>
<property name="test.relaxTiming" value="false"/>

Expand Down Expand Up @@ -1942,14 +1942,104 @@
<property name="junit.formatter.usefile" value="true" />
<property name="junit.formatter.extension" value=".txt" />

<!-- ==================== Test Profile System ==================== -->
<!--
Property-based test profiles for convenient, selective test execution.

Usage: ant test -Dtest.profile=<profile-name>

Precedence: test.entry > test.profile > default
If test.entry is set, the profile is ignored to maintain backward compatibility.

Profile patterns are defined in test-profiles.properties test.profile properties
to keep this file readable.
-->

<!-- ================= Initialize Test Profile Property Values ================ -->

<!-- We read test profile definitions from "test-profiles.properties.default" -->
<!-- and also from "test-profiles.properties" if it exists. -->
<!-- The values in "test-profiles.properties" have stronger preference. -->
<!-- If you want to customize your build, you can either change the values -->
<!-- directly in the default file, or create a new test-profiles.properties and -->
<!-- set the values there. This way you don't have to change a file which -->
<!-- is part of the original project source code. -->
<!-- See "test-profiles.properties.default" in the top level directory for some -->
<!-- property values you may customize. -->
<property file="${user.home}/test-profiles.properties"/>
<property file="test-profiles.properties"/>
<property file="test-profiles.properties.default"/>

<!-- Macro to set test pattern based on profile name -->
<macrodef name="set-profile-pattern">
<attribute name="profile"/>
<sequential>
<!-- Set test.name property based on the profile attribute -->
<condition property="test.name" value="${test.profile.smoke}">
<equals arg1="@{profile}" arg2="smoke"/>
</condition>
<condition property="test.name" value="${test.profile.catalina}">
<equals arg1="@{profile}" arg2="catalina"/>
</condition>
<condition property="test.name" value="${test.profile.coyote}">
<equals arg1="@{profile}" arg2="coyote"/>
</condition>
<condition property="test.name" value="${test.profile.performance}">
<equals arg1="@{profile}" arg2="performance"/>
</condition>
<condition property="test.name" value="${test.profile.tribes}">
<equals arg1="@{profile}" arg2="tribes"/>
</condition>
<condition property="test.name" value="${test.profile.buildutil}">
<equals arg1="@{profile}" arg2="buildutil"/>
</condition>
</sequential>
</macrodef>

<!-- New internal target to initialize tests before moving to test target -->
<target name="-test-profile-init" if="test.profile" unless="test.entry">
<set-profile-pattern profile="${test.profile}"/>

<!-- Validate that the profile exists -->
<fail message="Unknown test profile '${test.profile}'. Check test-profiles.properties[.default] for available profiles.">
<condition>
<not><isset property="test.name"/></not>
</condition>
</fail>

<!-- Special handling for performance profile: disable default exclusion -->
<condition property="test.excludePerformance" value="false">
<equals arg1="${test.profile}" arg2="performance"/>
</condition>

<!-- Special handling for buildutil profile: include buildutil tests -->
<condition property="test.includeBuildutil" value="true">
<equals arg1="${test.profile}" arg2="buildutil"/>
</condition>

<!-- Special handling for tribes profile: include old slow/flaky tribes tests -->
<condition property="test.includeTribes" value="true">
<equals arg1="${test.profile}" arg2="tribes"/>
</condition>

<echo message="Test profile: ${test.profile}"/>
</target>

<!-- Set default test.name if no profile specified, using ant's immutability feature -->
<target name="-test-name-default" depends="-test-profile-init">
<property name="test.name" value="**/Test*.java"/>
</target>

<!-- ==================== End of Test Profile System ==================== -->

<target name="test" description="Runs the JUnit test cases"
depends="test-nio,coverage-report,test-status" />
depends="-test-name-default,test-nio,coverage-report,test-status" />

<target name="test-clean" description="Runs the JUnit test cases"
depends="clean-classes,test-nio,coverage-report,test-status" />
depends="clean-classes,-test-name-default,test-nio,coverage-report,test-status" />

<target name="test-only" description="Runs the JUnit test cases, without compilation"
depends="test-only-nio,test-status" />
depends="-test-name-default,test-only-nio,test-status" />

<target name="test-status"
description="Analyses logs directory and reports on skipped tests, test failures and test errors">
Expand Down Expand Up @@ -2092,14 +2182,14 @@
<fileset dir="test" includes="${test.name}" excludes="${test.exclude}">
<!-- Exclude helper classes -->
<exclude name="**/Tester*.java" />
<!-- Exclude the tests known to fail -->
<exclude name="org/apache/catalina/tribes/test/**" />
<!-- Exclude old tribes tests (slow/flaky, excluded since 2011, unless explicitly requested via tribes profile) -->
<exclude name="org/apache/catalina/tribes/test/**" unless="test.includeTribes" />
<!-- Exclude the OpenSSL tests unless OpenSSL is available -->
<exclude name="org/apache/tomcat/util/net/openssl/ciphers/**" unless="${test.openssl.exists}" />
<!-- Exclude performance tests. E.g. on systems with slow/inconsistent timing -->
<exclude name="**/*Performance.java" if="${test.excludePerformance}" />
<!-- Exclude tests that Gump can't compile -->
<exclude name="org/apache/tomcat/buildutil/**" />
<!-- Exclude tests that Gump can't compile (unless explicitly requested via buildutil profile) -->
<exclude name="org/apache/tomcat/buildutil/**" unless="test.includeBuildutil" />
<!-- Exclude tests that require large heaps -->
<exclude name="**/*LargeHeap.java" unless="${test.includeLargeHeap}" />
</fileset>
Expand Down
109 changes: 109 additions & 0 deletions test-profiles.properties.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# -----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------------
# test-profiles.properties
#
# This file contains test profile pattern definitions for ant test targets.
# These patterns are used by the test profile system in build.xml.
#
# To add a new profile:
# 1. Add the property: test.profile.myprofile=pattern
# 2. Add a condition in build.xml's set-profile-pattern macro
#
# -----------------------------------------------------------------------------

# Smoke test profile
test.profile.smoke=\
jakarta/servlet/http/TestHttpServletResponseSendError.java,\
org/apache/catalina/authenticator/TestFormAuthenticatorA.java,\
org/apache/catalina/authenticator/TestFormAuthenticatorB.java,\
org/apache/catalina/authenticator/TestFormAuthenticatorC.java,\
org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java,\
org/apache/catalina/authenticator/TestSSOnonLoginAndDigestAuthenticator.java,\
org/apache/catalina/core/TestAsyncContextImpl.java,\
org/apache/catalina/core/TestAsyncContextStateChanges.java,\
org/apache/catalina/core/TestStandardContextResources.java,\
org/apache/catalina/core/TestStandardWrapper.java,\
org/apache/catalina/loader/TestVirtualContext.java,\
org/apache/catalina/mapper/TestMapperWebapps.java,\
org/apache/catalina/nonblocking/TestNonBlockingAPI.java,\
org/apache/catalina/servlets/TestDefaultServletEncodingPassThroughBom.java,\
org/apache/catalina/servlets/TestDefaultServletEncodingWithBom.java,\
org/apache/catalina/servlets/TestDefaultServletEncodingWithoutBom.java,\
org/apache/catalina/servlets/TestDefaultServletIfMatchRequests.java,\
org/apache/catalina/servlets/TestDefaultServlet.java,\
org/apache/catalina/servlets/TestDefaultServletOptions.java,\
org/apache/catalina/servlets/TestWebdavServletOptionsFile.java,\
org/apache/catalina/startup/TestContextConfig.java,\
org/apache/catalina/startup/TestHostConfigAutomaticDeploymentA.java,\
org/apache/catalina/startup/TestHostConfigAutomaticDeploymentB.java,\
org/apache/catalina/startup/TestHostConfigAutomaticDeploymentC.java,\
org/apache/catalina/valves/rewrite/TestRewriteValve.java,\
org/apache/catalina/valves/TestStuckThreadDetectionValve.java,\
org/apache/coyote/ajp/TestAbstractAjpProcessor.java,\
org/apache/coyote/http11/filters/TestChunkedInputFilter.java,\
org/apache/coyote/http11/TestHttp11InputBufferCRLF.java,\
org/apache/coyote/http11/TestHttp11InputBuffer.java,\
org/apache/coyote/http11/TestHttp11Processor.java,\
org/apache/coyote/http2/TestAsync.java,\
org/apache/coyote/http2/TestHttp2ConnectionTimeouts.java,\
org/apache/coyote/http2/TestHttp2Limits.java,\
org/apache/coyote/http2/TestHttp2Section_6_8.java,\
org/apache/coyote/http2/TestHttp2Timeouts.java,\
org/apache/coyote/http2/TestStreamQueryString.java,\
org/apache/el/TestELInJsp.java,\
org/apache/jasper/compiler/TestCompiler.java,\
org/apache/jasper/compiler/TestEncodingDetector.java,\
org/apache/jasper/compiler/TestGenerator.java,\
org/apache/jasper/compiler/TestJspConfig.java,\
org/apache/jasper/compiler/TestJspDocumentParser.java,\
org/apache/jasper/compiler/TestValidator.java,\
org/apache/jasper/optimizations/TestELInterpreterTagSetters.java,\
org/apache/jasper/optimizations/TestStringInterpreterTagSetters.java,\
org/apache/jasper/runtime/TestCustomHttpJspPage.java,\
org/apache/jasper/runtime/TestJspContextWrapper.java,\
org/apache/jasper/runtime/TestJspRuntimeLibrary.java,\
org/apache/jasper/runtime/TestPageContextImpl.java,\
org/apache/jasper/servlet/TestTldScanner.java,\
org/apache/naming/resources/TestWarDirContext.java,\
org/apache/naming/TestEnvEntry.java,\
org/apache/tomcat/util/net/TestClientCert.java,\
org/apache/tomcat/util/net/TestCustomSslTrustManager.java,\
org/apache/tomcat/util/net/TestSSLHostConfigCompat.java,\
org/apache/tomcat/util/net/TestSsl.java,\
org/apache/tomcat/websocket/server/TestSlowClient.java,\
org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java,\
org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java,\
org/apache/tomcat/websocket/TestWsWebSocketContainer.java,\
org/apache/tomcat/websocket/TestWsWebSocketContainerTimeoutServer.java,\
org/apache/catalina/tribes/group/interceptors/TestTcpFailureDetector.java,\
org/apache/catalina/filters/TestRateLimitFilter.java,\
jakarta/servlet/http/TestHttpServletDoHeadInvalidWrite*.java,\
jakarta/servlet/http/TestHttpServletDoHeadValidWrite*.java

# Component test profiles
test.profile.catalina=**/catalina/**/*Test*.java
test.profile.coyote=**/coyote/**/*Test*.java

# Performance test profile
test.profile.performance=**/*Performance.java

# Tribes test profile
test.profile.tribes=**/tribes/**/*Test*.java

# Build utility test profile: Tests for build tools (normally excluded)
# Note: These tests depend on classes not in output JARs and are excluded by default
test.profile.buildutil=**/buildutil/**/*Test*.java
6 changes: 6 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@
</subsection>
<subsection name="Other">
<changelog>
<add>
Add test profile system for selective test execution. Profiles can be
specified via <code>-Dtest.profile=&lt;name&gt;</code> to run specific
test subsets without using patterns directly. Profile patterns are
defined in <code>test-profiles.properties</code>. (csutherl)
</add>
<update>
Update Derby to 10.17.1.0. (markt)
</update>
Expand Down
Loading