Skip to content

Commit

Permalink
enhance: [skip e2e] add make run-test-cpp with support for filter gte…
Browse files Browse the repository at this point in the history
…st (milvus-io#35829)

Signed-off-by: zhenshan.cao <[email protected]>
  • Loading branch information
czs007 committed Aug 29, 2024
1 parent cfc99e6 commit 3d30437
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,12 @@ test-cpp: build-cpp-with-unittest
@echo "Running cpp unittests..."
@(env bash $(PWD)/scripts/run_cpp_unittest.sh)

run-test-cpp:
@echo "Running cpp unittests..."
@echo $(PWD)/scripts/run_cpp_unittest.sh arg=${filter}
@(env bash $(PWD)/scripts/run_cpp_unittest.sh arg=${filter})


# Run code coverage.
codecov: codecov-go codecov-cpp

Expand Down
15 changes: 15 additions & 0 deletions scripts/run_cpp_unittest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,26 @@ if [ -d "${CORE_INSTALL_PREFIX}/lib" ]; then
fi

# run unittest
arg="$1"
filter_value="${arg#*=}"

for UNITTEST_DIR in "${UNITTEST_DIRS[@]}"; do
if [ ! -d "${UNITTEST_DIR}" ]; then
echo "The unittest folder does not exist!"
exit 1
fi


if [[ $filter_value ]]; then
if [ $filter_value == "--gtest_list_tests" ]; then
${UNITTEST_DIR}/all_tests $filter_value
exit 0
else
${UNITTEST_DIR}/all_tests --gtest_filter=$filter_value
exit 0
fi
fi

echo "Running all unittest ..."
${UNITTEST_DIR}/all_tests
if [ $? -ne 0 ]; then
Expand All @@ -56,6 +70,7 @@ for UNITTEST_DIR in "${UNITTEST_DIRS[@]}"; do
exit 1
fi
fi

done

# run cwrapper unittest
Expand Down

0 comments on commit 3d30437

Please sign in to comment.