You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test-compatibility.sh 2.9 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # https://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. # Compiles and builds Ant with various different recent versions of Java and
  17. # then runs (only the) tests with the minimal supported version of Java runtime
  18. # (which as of Aug 2019, is Java 8).
  19. # This ensures/verifies that various Ant functionality works as expected
  20. # when Ant is built with a higher version of Java and is run against the minimal
  21. # supported version.
  22. # This script is ideal for using in a CI environment where it can be invoked
  23. # through a job which is configured to use various different JDK versions.
  24. # Fail the script on error
  25. set -e
  26. # Build (compile and generate the dist) the project using the Java version
  27. # that's already set in the environment
  28. echo "Using \"${JAVA_HOME}\" to build Ant"
  29. java -version
  30. # Fetch all the necessary thirdparty libs, before boostraping Ant
  31. ant -f fetch.xml -Ddest=optional
  32. # Now bootstrap Ant with all necessary thirdparty libs already fetched
  33. ./build.sh allclean dist
  34. # Switch the JDK to Java 8 to run *only* the tests.
  35. # This will ensure that Ant built with different (higher) version of Ant
  36. # can be used by Java 8 runtime and can function properly for all Ant
  37. # functionality
  38. mkdir -p build/java-8-latest
  39. cd build/java-8-latest
  40. # Download latest Java 8 (we use Adopt OpenJDK binaries)
  41. wget https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u222b10.tar.gz
  42. tar -zxf ./*.tar.gz
  43. # set JAVA_HOME to point to the newly extracted tar's content
  44. export JAVA_HOME="`echo \`pwd\`/\`echo */\``"
  45. export PATH="${JAVA_HOME}"/bin:$PATH
  46. cd ../..
  47. echo "Using \"${JAVA_HOME}\" to run Ant tests"
  48. java -version
  49. # Set ANT_HOME to the boostraped version - the one which was built, using a different Java version, a few steps
  50. # earlier in this script
  51. export ANT_HOME="`pwd`/bootstrap"
  52. # Run the tests. We intentionally skip the build (compilation etc) to avoid compiling the project
  53. # with the newly set Java version.
  54. ant -nouserlib -lib lib/optional test -Dskip.build=true -Dignore.tests.failed=true -Doptional.jars.whenmanifestonly=skip -Djenkins=t