runtests.sh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #-------------------------------------------------------------------------------------------------------
  2. # Copyright (C) Microsoft. All rights reserved.
  3. # Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. #-------------------------------------------------------------------------------------------------------
  5. #
  6. # CI ONLY
  7. # This script is mainly for CI only. In case you have ChakraCore is compiled for multiple
  8. # targets, this script may fail to test all of them. Use runtests.py instead.
  9. pushd `dirname $0` > /dev/null
  10. test_path=`pwd -P`
  11. popd > /dev/null
  12. build_type=
  13. binary_path=
  14. release_build=0
  15. while [[ $# -gt 0 ]]; do
  16. case "$1" in
  17. --iculib=*)
  18. ICU4C_LIBRARY_PATH=$1
  19. ICU4C_LIBRARY_PATH="${ICU4C_LIBRARY_PATH:9}"
  20. export ICU4C_LIBRARY_PATH
  21. ;;
  22. *)
  23. test_variant=$1
  24. ;;
  25. esac
  26. shift
  27. done
  28. if [[ -f "$test_path/../out/Debug/ch" ]]; then
  29. echo "Warning: Debug build was found"
  30. binary_path="Debug";
  31. build_type="-d"
  32. elif [[ -f "$test_path/../out/Test/ch" ]]; then
  33. echo "Warning: Test build was found"
  34. binary_path="Test";
  35. build_type="-t"
  36. elif [[ -f "$test_path/../out/Release/ch" ]]; then
  37. binary_path="Release";
  38. echo "Warning: Release build was found"
  39. release_build=1
  40. else
  41. echo 'Error: ch not found- exiting'
  42. exit 1
  43. fi
  44. if [[ $release_build != 1 ]]; then
  45. "$test_path/runtests.py" $build_type --not-tag exclude_jenkins --not-tag exclude_ch $test_variant
  46. if [[ $? != 0 ]]; then
  47. exit 1
  48. fi
  49. else
  50. # TEST flags are not enabled for release build
  51. # however we would like to test if the compiled binary
  52. # works or not
  53. RES=$($test_path/../out/${binary_path}/ch $test_path/Basics/hello.js)
  54. EXIT_CODE=$?
  55. if [[ $RES =~ "Error :" || $EXIT_CODE != 0 ]]; then
  56. echo "FAILED"
  57. exit $EXIT_CODE
  58. else
  59. echo "Release Build Passes hello.js run"
  60. fi
  61. fi
  62. CH_ABSOLUTE_PATH="${test_path}/../out/${binary_path}/ch"
  63. RES=$(cd $test_path/native-tests; ./test_native.sh ${CH_ABSOLUTE_PATH} ${binary_path} 2>&1)
  64. if [[ $? != 0 ]]; then
  65. echo "Error: Native tests failed"
  66. echo -e "$RES"
  67. exit 1
  68. fi