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