Skip to content

Commit

Permalink
use parallel for ci_test (#94)
Browse files Browse the repository at this point in the history
- introduce Makefile new tag: test_asan_parallel
- mark [diskann] & [hnsw] tags run parallel

Signed-off-by: LHT129 <tianlan.lht@antgroup.com>
  • Loading branch information
LHT129 authored Nov 1, 2024
1 parent 9195f69 commit 830b8f9
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
key: fork-cache-{{ checksum "CMakeLists.txt" }}
paths:
- ./build
- run: make test_asan
- run: make test_asan_parallel

main-branch-check:
docker:
Expand All @@ -44,8 +44,9 @@ jobs:
- restore_cache:
keys:
- main-ccache-{{ checksum "CMakeLists.txt" }}
- run: make test_asan
- run: make asan
- save_cache:
key: main-ccache-{{ checksum "CMakeLists.txt" }}
paths:
- ./build
- run: make test_asan_parallel
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ asan: ## Build with AddressSanitizer option.
cmake ${VSAG_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=ON -DENABLE_CCACHE=ON
cmake --build build --parallel ${COMPILE_JOBS}

.PHONY: test_asan_parallel ## Run unit tests parallel with AddressSanitizer option.
test_asan_parallel: asan
@./scripts/test_asan_bg.sh
./build/mockimpl/tests_mockimpl -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}

.PHONY: test_asan
test_asan: asan ## Run unit tests with AddressSanitizer option.
./build/tests/unittests -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
Expand Down
40 changes: 40 additions & 0 deletions scripts/test_asan_bg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

pids=()
exit_codes=()
parallel_tags="[diskann] [hnsw]"
othertag=""

./build/tests/unittests -d yes ${UT_FILTER} --allow-running-no-tests --shard-count 1 --shard-index 0 &
pids+=($!)

for tag in ${parallel_tags}
do
othertag="~"${tag}${othertag}
./build/tests/functests -d yes ${UT_FILTER} --allow-running-no-tests ${tag} &
pids+=($!)
done

./build/tests/functests -d yes ${UT_FILTER} --allow-running-no-tests ${othertag} &
pids+=($!)

for pid in "${pids[@]}"
do
wait $pid
exit_codes+=($?)
done

all_successful=true
for code in "${exit_codes[@]}"
do
if [ $code -ne 0 ]; then
all_successful=false
break
fi
done

if [ $all_successful = true ]; then
exit 0
else
exit 1
fi

0 comments on commit 830b8f9

Please sign in to comment.