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.

cachetest_cpp.sh 2.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/bash
  2. # Copyright 2019 Huawei Technologies Co., Ltd
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # ============================================================================
  16. # source the globals and functions for use with cache testing
  17. SKIP_ADMIN_COUNTER=true
  18. . cachetest_lib.sh
  19. echo
  20. ################################################################################
  21. # Cache testing: cache cpp test driver #
  22. # Summary: A launcher for invoking cpp cache tests #
  23. ################################################################################
  24. UT_TEST_DIR="${BUILD_PATH}/mindspore/tests/ut/cpp"
  25. DateStamp=$(date +%Y%m%d_%H%M%S);
  26. CPP_TEST_LOG_OUTPUT="/tmp/ut_tests_cache_${DateStamp}.log"
  27. # Start a basic cache server to be used for all tests
  28. StartServer
  29. HandleRcExit $? 1 1
  30. # Set the environment variable to enable these pytests
  31. export RUN_CACHE_TEST=TRUE
  32. GTEST_FILTER_OLD=$GTEST_FILTER
  33. export GTEST_FILTER="MindDataTestCacheOp.*"
  34. export GTEST_ALSO_RUN_DISABLED_TESTS=1
  35. # All of the cpp tests run under the same session
  36. GetSession
  37. HandleRcExit $? 1 1
  38. export SESSION_ID=$session_id
  39. test_count=$(($test_count+1))
  40. cd ${UT_TEST_DIR}
  41. cmd="${UT_TEST_DIR}/ut_tests"
  42. echo "Test ${test_count}: ${cmd}"
  43. MsgEnter "Run test ${test_count}"
  44. ${cmd} > ${CPP_TEST_LOG_OUTPUT} 2>&1
  45. rc=$?
  46. if [ ${rc} -ne 0 ]; then
  47. MsgFail "FAILED"
  48. MsgError "Invoking cpp tests failed!" "${rc}" "See log: ${CPP_TEST_LOG_OUTPUT}"
  49. else
  50. MsgOk "OK"
  51. fi
  52. echo
  53. HandleRcExit $rc 1 0
  54. cd ${CURRPATH}
  55. StopServer
  56. HandleRcExit $? 1 0
  57. # restore old env var
  58. export GTEST_FILTER=$GTEST_FILTER_OLD
  59. unset RUN_CACHE_TEST
  60. unset GTEST_ALSO_RUN_DISABLED_TESTS
  61. exit ${failed_tests}