Skip to content

fix: Add memory usage API + sanitizer-safe buffer ownership + leak smoke tests #492

fix: Add memory usage API + sanitizer-safe buffer ownership + leak smoke tests

fix: Add memory usage API + sanitizer-safe buffer ownership + leak smoke tests #492

Workflow file for this run

name: HNSW CI
on: [push, pull_request]
jobs:
test_python:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Build and install
run: python -m pip install .
- name: Test
timeout-minutes: 15
run: |
python -m unittest discover -v --start-directory examples/python --pattern "example*.py"
python -m unittest discover -v --start-directory tests/python --pattern "bindings_test*.py"
test_cpp:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Build
run: |
mkdir build
cd build
cmake ..
if [ "$RUNNER_OS" == "Windows" ]; then
cmake --build ./ --config Release
else
make
fi
shell: bash
leak_sanitizers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Build and install (ASAN/LSAN)
env:
HNSWLIB_NO_NATIVE: "1"
CFLAGS: "-O1 -g -fno-omit-frame-pointer -fsanitize=address,leak"
CXXFLAGS: "-O1 -g -fno-omit-frame-pointer -fsanitize=address,leak"
LDFLAGS: "-fsanitize=address,leak"
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -v --no-build-isolation .
- name: Python leak smoke test (ASAN/LSAN)
timeout-minutes: 15
env:
ASAN_OPTIONS: "detect_leaks=1:halt_on_error=1:alloc_dealloc_mismatch=1"
run: |
python -m unittest discover -v --start-directory tests/python --pattern "bindings_test_leaks.py"
- name: C++ leak smoke test (ASAN/LSAN)
timeout-minutes: 15
env:
ASAN_OPTIONS: "detect_leaks=1:halt_on_error=1:alloc_dealloc_mismatch=1"
run: |
cmake -S . -B build-asan -DHNSWLIB_EXAMPLES=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS="-O1 -g -fno-omit-frame-pointer -fsanitize=address,leak -std=c++11" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,leak"
cmake --build build-asan --target leak_smoke_test -j 2
./build-asan/leak_smoke_test
- name: Prepare test data
run: |
pip install numpy
cd tests/cpp/
python update_gen_data.py
shell: bash
- name: Test
timeout-minutes: 15
run: |
cd build
if [ "$RUNNER_OS" == "Windows" ]; then
cp ./Release/* ./
fi
./example_search
./example_filter
./example_replace_deleted
./example_mt_search
./example_mt_filter
./example_mt_replace_deleted
./example_multivector_search
./example_epsilon_search
./searchKnnCloserFirst_test
./searchKnnWithFilter_test
./multiThreadLoad_test
./multiThread_replace_test
./test_updates
./test_updates update
./multivector_search_test
./epsilon_search_test
./leak_smoke_test
shell: bash