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