Skip to content
This repository was archived by the owner on Feb 18, 2026. It is now read-only.

Commit 7f5dc64

Browse files
committed
fix(makefile): add diskann_cache.c to source files and update test build command
feat(package): add clean:bench and clean:all scripts, update precommit to include bear
1 parent 903ea6f commit 7f5dc64

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ TEST_BIN = test_diskann
2626
STRESS_BIN = test_stress
2727

2828
# Source files
29-
SOURCES = $(SRC_DIR)/diskann_api.c $(SRC_DIR)/diskann_blob.c $(SRC_DIR)/diskann_insert.c $(SRC_DIR)/diskann_node.c $(SRC_DIR)/diskann_search.c $(SRC_DIR)/diskann_vtab.c
29+
SOURCES = $(SRC_DIR)/diskann_api.c $(SRC_DIR)/diskann_blob.c $(SRC_DIR)/diskann_cache.c $(SRC_DIR)/diskann_insert.c $(SRC_DIR)/diskann_node.c $(SRC_DIR)/diskann_search.c $(SRC_DIR)/diskann_vtab.c
3030
TEST_C_SOURCES = $(filter-out %/test_runner.c %/test_stress.c, $(wildcard $(TEST_DIR)/c/test_*.c))
3131
TEST_RUNNER = $(TEST_DIR)/c/test_runner.c
3232
UNITY_SOURCES = $(TEST_DIR)/c/unity/unity.c
@@ -111,7 +111,7 @@ $(BUILD_DIR)/$(STRESS_BIN): $(SOURCES) $(TEST_DIR)/c/test_stress.c $(UNITY_SOURC
111111
@echo "Built stress test suite: $@"
112112

113113
$(BUILD_DIR)/$(TEST_BIN): $(SOURCES) $(TEST_C_SOURCES) $(TEST_RUNNER) $(UNITY_SOURCES) $(BUILD_DIR)/sqlite3.o | $(BUILD_DIR)
114-
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I$(SRC_DIR) -I$(TEST_DIR)/c -o $@ $^ $(LIBS)
114+
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DTESTING -I$(SRC_DIR) -I$(TEST_DIR)/c -o $@ $^ $(LIBS)
115115
@echo "Built test suite: $@"
116116

117117
# Run tests
@@ -129,16 +129,16 @@ asan:
129129
# Generate compile_commands.json for clang-tidy
130130
bear:
131131
@command -v bear >/dev/null 2>&1 || { echo "Error: bear not installed. Install with: sudo apt install bear" >&2; exit 1; }
132-
bear -- $(MAKE) clean all test || true
132+
bear -- $(MAKE) clean all $(BUILD_DIR)/$(TEST_BIN) || true
133133
@# Strip .o linker inputs that Bear captures (clang-tidy only compiles)
134134
@python3 -c "import json;cc=json.load(open('compile_commands.json'));[e.__setitem__('arguments',[a for a in e['arguments'] if not a.endswith('.o')]) for e in cc];json.dump(cc,open('compile_commands.json','w'),indent=2)"
135135

136-
# Run clang-tidy (auto-generates compile_commands.json if missing)
136+
# Run clang-tidy (requires compile_commands.json from bear)
137137
clang-tidy:
138138
@command -v clang-tidy >/dev/null 2>&1 || { echo "Error: clang-tidy not installed" >&2; exit 1; }
139139
@if [ ! -f compile_commands.json ]; then \
140-
echo "compile_commands.json not found, generating with bear..."; \
141-
$(MAKE) bear; \
140+
echo "Error: compile_commands.json not found. Run 'make bear' first." >&2; \
141+
exit 1; \
142142
fi
143143
clang-tidy $(SOURCES) $(TEST_C_SOURCES)
144144

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,23 @@
6464
"test:valgrind": "make valgrind",
6565
"test:memory": "make asan",
6666
"clean": "make clean",
67+
"clean:bench": "rm -rf benchmarks/datasets benchmarks/results-*.json",
68+
"clean:all": "run-s clean clean:bench",
6769
"rebuild": "make clean all",
70+
"bear": "make bear",
6871
"lint": "run-p lint:*",
72+
"lint:benchmark": "cd benchmarks && tsc --noEmit",
6973
"lint:eslint": "eslint",
7074
"lint:ts": "tsc --noEmit",
71-
"lint:native": "make bear && make lint",
75+
"lint:native": "make lint",
7276
"fmt": "run-p fmt:prettier fmt:native",
7377
"fmt:prettier": "prettier --cache --write .",
7478
"fmt:native": "make fmt",
7579
"update": "run-p update:*",
7680
"update:deps": "ncu -u",
7781
"install:pinact": "go install github.com/suzuki-shunsuke/pinact/cmd/pinact@latest",
7882
"update:actions": "pinact run -u || echo \"problem with pinact\"",
79-
"precommit": "run-s update rebuild fmt lint test:all test:asan clean test:valgrind || npm run clean",
83+
"precommit": "run-s update rebuild bear fmt lint test:all test:asan clean test:valgrind || npm run clean",
8084
"prepare-release": "npm run build:dist"
8185
},
8286
"devDependencies": {

0 commit comments

Comments
 (0)