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.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. export SKIP_ADMIN_COUNTER=true
  18. declare session_id failed_tests
  19. . cachetest_lib.sh
  20. echo
  21. ################################################################################
  22. # Cache testing: cache cpp test driver #
  23. # Summary: A launcher for invoking cpp cache tests #
  24. ################################################################################
  25. UT_TEST_DIR="${BUILD_PATH}/mindspore/tests/ut/cpp"
  26. DateStamp=$(date +%Y%m%d_%H%M%S);
  27. CPP_TEST_LOG_OUTPUT="/tmp/ut_tests_cache_${DateStamp}.log"
  28. # start cache server with a spilling path to be used for all tests
  29. cmd="${CACHE_ADMIN} --start -s /tmp"
  30. CacheAdminCmd "${cmd}" 0
  31. sleep 1
  32. HandleRcExit $? 1 1
  33. # Set the environment variable to enable these pytests
  34. export RUN_CACHE_TEST=TRUE
  35. GTEST_FILTER_OLD=$GTEST_FILTER
  36. export GTEST_FILTER="MindDataTestCacheOp.*"
  37. export GTEST_ALSO_RUN_DISABLED_TESTS=1
  38. # All of the cpp tests run under the same session
  39. GetSession
  40. HandleRcExit $? 1 1
  41. export SESSION_ID=$session_id
  42. test_count=$(($test_count+1))
  43. cd ${UT_TEST_DIR}
  44. cmd="${UT_TEST_DIR}/ut_tests"
  45. echo "Test ${test_count}: ${cmd}"
  46. MsgEnter "Run test ${test_count}"
  47. ${cmd} > ${CPP_TEST_LOG_OUTPUT} 2>&1
  48. rc=$?
  49. if [ ${rc} -ne 0 ]; then
  50. MsgFail "FAILED"
  51. MsgError "Invoking cpp tests failed!" "${rc}" "See log: ${CPP_TEST_LOG_OUTPUT}"
  52. else
  53. MsgOk "OK"
  54. fi
  55. echo
  56. HandleRcExit $rc 1 0
  57. cd ${CURRPATH}
  58. StopServer
  59. HandleRcExit $? 1 0
  60. # restore old env var
  61. export GTEST_FILTER=$GTEST_FILTER_OLD
  62. unset RUN_CACHE_TEST
  63. unset GTEST_ALSO_RUN_DISABLED_TESTS
  64. exit ${failed_tests}