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