|
2110 | 2110 | </target> |
2111 | 2111 |
|
2112 | 2112 | <target name="test-nio" description="Runs the JUnit test cases for NIO. Does not stop on errors." |
2113 | | - depends="-test-name-default,setup-jacoco,test-compile,deploy,test-openssl-exists" if="${execute.test.nio}"> |
| 2113 | + depends="-test-name-default,setup-jacoco,test-compile,deploy,test-openssl-exists,test-tcnative-exists" if="${execute.test.nio}"> |
2114 | 2114 | <runtests protocol="org.apache.coyote.http11.Http11NioProtocol" |
2115 | 2115 | extension=".NIO" /> |
2116 | 2116 | </target> |
2117 | 2117 |
|
2118 | 2118 | <target name="test-only-nio" description="Runs the JUnit test cases or NIO without test preparations. Does not stop on errors." |
2119 | | - depends="-test-name-default,setup-jacoco,test-openssl-exists" if="${execute.test.nio}"> |
| 2119 | + depends="-test-name-default,setup-jacoco,test-openssl-exists,test-tcnative-exists" if="${execute.test.nio}"> |
2120 | 2120 | <runtests protocol="org.apache.coyote.http11.Http11NioProtocol" |
2121 | 2121 | extension=".NIO" /> |
2122 | 2122 | </target> |
|
2147 | 2147 | </and> |
2148 | 2148 | </or> |
2149 | 2149 | </condition> |
| 2150 | + <echo message="OpenSSL is not available. OpenSSL-related tests will be skipped or may fail." level="warning" unless:set="test.openssl.exists"/> |
| 2151 | + </target> |
| 2152 | + |
| 2153 | + <target name="test-tcnative-exists" description="Verifies tomcat-native library can be loaded"> |
| 2154 | + <!-- Check if main classes are built --> |
| 2155 | + <available file="${test.run.classes}/org/apache/tomcat/jni/Library.class" |
| 2156 | + property="tomcat.classes.available"/> |
| 2157 | + |
| 2158 | + <!-- If main classes don't exist, compile just what we need --> |
| 2159 | + <mkdir dir="${test.run.classes}" unless:set="tomcat.classes.available"/> |
| 2160 | + <javac srcdir="java" destdir="${test.run.classes}" |
| 2161 | + includes="org/apache/tomcat/jni/Library.java,org/apache/tomcat/jni/LibraryNotFoundError.java" |
| 2162 | + debug="${compile.debug}" |
| 2163 | + includeantruntime="false" |
| 2164 | + encoding="UTF-8" |
| 2165 | + unless:set="tomcat.classes.available"> |
| 2166 | + <compilerarg line="-Xlint:-options"/> |
| 2167 | + </javac> |
| 2168 | + |
| 2169 | + <!-- Compile the test class --> |
| 2170 | + <mkdir dir="${test.classes}"/> |
| 2171 | + <javac srcdir="test" destdir="${test.classes}" |
| 2172 | + includes="org/apache/tomcat/jni/TesterLibraryLoad.java" |
| 2173 | + debug="${compile.debug}" |
| 2174 | + includeantruntime="false" |
| 2175 | + encoding="UTF-8"> |
| 2176 | + <classpath> |
| 2177 | + <pathelement location="${test.run.classes}"/> |
| 2178 | + <pathelement location="${junit.jar}"/> |
| 2179 | + </classpath> |
| 2180 | + </javac> |
| 2181 | + |
| 2182 | + <!-- Run test - it will check both test.apr.loc and system library paths --> |
| 2183 | + <junit printsummary="no" fork="yes" showoutput="false" haltonfailure="false" |
| 2184 | + failureproperty="test.tcnative.error" logfailedtests="false"> |
| 2185 | + <jvmarg value="${runtests.librarypath}"/> |
| 2186 | + <jvmarg value="${native.nativeaccess}"/> |
| 2187 | + <classpath refid="tomcat.test.classpath"/> |
| 2188 | + <test name="org.apache.tomcat.jni.TesterLibraryLoad"/> |
| 2189 | + </junit> |
| 2190 | + |
| 2191 | + <echo message="Tomcat Native is not available. Tomcat Native (JNI) tests will be skipped." if:set="test.tcnative.error" level="warning"/> |
2150 | 2192 | </target> |
2151 | 2193 |
|
2152 | 2194 | <target name="test-httpd-exists" description="Checks for the httpd binary"> |
|
0 commit comments