test-linux.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. #
  3. # Copyright (c) Contributors to the Open 3D Engine Project.
  4. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. #
  6. # SPDX-License-Identifier: Apache-2.0 OR MIT
  7. #
  8. #
  9. # The expected OPENSSL_VERSION_TEXT (Refer to build_config.json for the current version being built)
  10. EXPECTED_OPENSSL_VERSION="OpenSSL 1.1.1t 7 Feb 2023"
  11. # The sha256 hash of the above OPENSSL_VERSION_TEXT (Refer to build_config.json for the current version being built)
  12. EXPECTED_OPENSSL_VERSION_SHA256="92b72d8487f5580f88413f85e7053daf63da2653"
  13. # Reset any existing test folder
  14. rm -rf temp/build_test
  15. mkdir temp/build_test
  16. # Make sure we are running on the target architecture
  17. TARGET_ARCH=${1:-$(uname -m)}
  18. CURRENT_HOST_ARCH=$(uname -m)
  19. if [ "${CURRENT_HOST_ARCH}" != ${TARGET_ARCH} ]
  20. then
  21. echo "Warning: Tests for packages on target ${TARGET_ARCH} can only be run on ${TARGET_ARCH}. Skipping tests."
  22. exit 0
  23. fi
  24. # Build the test program
  25. cmake -S test -B temp/build_test -DCMAKE_MODULE_PATH="$PACKAGE_ROOT" -DCMAKE_BUILD_TYPE=Release
  26. if [ $? -ne 0 ]
  27. then
  28. echo "Error generating the test project"
  29. exit 1
  30. fi
  31. cmake --build temp/build_test
  32. if [ $? -ne 0 ]
  33. then
  34. echo "Error building the test project"
  35. exit 1
  36. fi
  37. echo Executing test_OpenSSL \"${EXPECTED_OPENSSL_VERSION}\" ${EXPECTED_OPENSSL_VERSION_SHA256}
  38. ./temp/build_test/test_OpenSSL "${EXPECTED_OPENSSL_VERSION}" ${EXPECTED_OPENSSL_VERSION_SHA256}
  39. if [ $? -ne 0 ]
  40. then
  41. echo "Package test failed"
  42. exit 1
  43. fi
  44. echo "Package test passed"
  45. exit 0