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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. ## prepare data for dataset & mindrecord
  29. cp -fr ${PROJECT_PATH}/tests/ut/data ${UT_TEST_DIR}
  30. ## prepare album dataset, uses absolute path so has to be generated
  31. python ${UT_TEST_DIR}/data/dataset/testAlbum/gen_json.py
  32. # start cache server with a spilling path to be used for all tests
  33. cmd="${CACHE_ADMIN} --start -s /tmp"
  34. CacheAdminCmd "${cmd}" 0
  35. sleep 1
  36. HandleRcExit $? 1 1
  37. # Set the environment variable to enable these pytests
  38. export RUN_CACHE_TEST=TRUE
  39. GTEST_FILTER_OLD=$GTEST_FILTER
  40. export GTEST_FILTER="MindDataTestCacheOp.*"
  41. export GTEST_ALSO_RUN_DISABLED_TESTS=1
  42. # All of the cpp tests run under the same session
  43. GetSession
  44. HandleRcExit $? 1 1
  45. export SESSION_ID=$session_id
  46. test_count=$(($test_count+1))
  47. cd ${UT_TEST_DIR} || exit
  48. cmd="${UT_TEST_DIR}/ut_tests"
  49. echo "Test ${test_count}: ${cmd}"
  50. MsgEnter "Run test ${test_count}"
  51. ${cmd} > ${CPP_TEST_LOG_OUTPUT} 2>&1
  52. rc=$?
  53. if [ ${rc} -ne 0 ]; then
  54. MsgFail "FAILED"
  55. MsgError "Invoking cpp tests failed!" "${rc}" "See log: ${CPP_TEST_LOG_OUTPUT}"
  56. else
  57. MsgOk "OK"
  58. fi
  59. echo
  60. HandleRcExit $rc 1 0
  61. cd ${CURRPATH} || exit
  62. StopServer
  63. HandleRcExit $? 1 0
  64. # restore old env var
  65. export GTEST_FILTER=$GTEST_FILTER_OLD
  66. unset RUN_CACHE_TEST
  67. unset GTEST_ALSO_RUN_DISABLED_TESTS
  68. exit ${failed_tests}