mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 03:55:04 -05:00
chore: separate unittests into different executables
it's easier to run a specific set of tests if they are into separate executable. We shouldn't have to run them all for testing a specific set of tests
This commit is contained in:
@@ -27,9 +27,6 @@ $(BUILD_DIR)/configured.stamp:
|
||||
|
||||
build-initialized: $(BUILD_DIR)/configured.stamp
|
||||
|
||||
build-end-to-end-jit: build-initialized
|
||||
cmake --build $(BUILD_DIR) --target end_to_end_jit_test
|
||||
|
||||
zamacompiler: build-initialized
|
||||
cmake --build $(BUILD_DIR) --target zamacompiler
|
||||
|
||||
@@ -40,14 +37,41 @@ python-bindings: build-initialized
|
||||
test-check: zamacompiler file-check not
|
||||
$(BUILD_DIR)/bin/llvm-lit -v tests/
|
||||
|
||||
test-end-to-end-jit: build-end-to-end-jit
|
||||
$(BUILD_DIR)/bin/end_to_end_jit_test
|
||||
|
||||
test-python: python-bindings
|
||||
PYTHONPATH=${PYTHONPATH}:$(BUILD_DIR)/tools/zamalang/python_packages/zamalang_core LD_PRELOAD=$(BUILD_DIR)/lib/libZamalangRuntime.so pytest -vs tests/python
|
||||
|
||||
test: test-check test-end-to-end-jit test-python
|
||||
|
||||
# Unittests
|
||||
|
||||
build-end-to-end-jit-test: build-initialized
|
||||
cmake --build $(BUILD_DIR) --target end_to_end_jit_test
|
||||
|
||||
build-end-to-end-jit-clear-tensor: build-initialized
|
||||
cmake --build $(BUILD_DIR) --target end_to_end_jit_clear_tensor
|
||||
|
||||
build-end-to-end-jit-encrypted-tensor: build-initialized
|
||||
cmake --build $(BUILD_DIR) --target end_to_end_jit_encrypted_tensor
|
||||
|
||||
build-end-to-end-jit-hlfhelinalg: build-initialized
|
||||
cmake --build $(BUILD_DIR) --target end_to_end_jit_hlfhelinalg
|
||||
|
||||
build-end-to-end-jit: build-end-to-end-jit-test build-end-to-end-jit-clear-tensor build-end-to-end-jit-encrypted-tensor build-end-to-end-jit-hlfhelinalg
|
||||
|
||||
test-end-to-end-jit-test: build-end-to-end-jit-test
|
||||
$(BUILD_DIR)/bin/end_to_end_jit_test
|
||||
|
||||
test-end-to-end-jit-clear-tensor: build-end-to-end-jit-clear-tensor
|
||||
$(BUILD_DIR)/bin/end_to_end_jit_clear_tensor
|
||||
|
||||
test-end-to-end-jit-encrypted-tensor: build-end-to-end-jit-encrypted-tensor
|
||||
$(BUILD_DIR)/bin/end_to_end_jit_encrypted_tensor
|
||||
|
||||
test-end-to-end-jit-hlfhelinalg: build-end-to-end-jit-hlfhelinalg
|
||||
$(BUILD_DIR)/bin/end_to_end_jit_hlfhelinalg
|
||||
|
||||
test-end-to-end-jit: test-end-to-end-jit-test test-end-to-end-jit-clear-tensor test-end-to-end-jit-encrypted-tensor test-end-to-end-jit-hlfhelinalg
|
||||
|
||||
# LLVM/MLIR dependencies
|
||||
|
||||
all-deps: file-check not
|
||||
@@ -83,6 +107,10 @@ release_tarballs:
|
||||
python-bindings \
|
||||
test-check \
|
||||
test-end-to-end-jit \
|
||||
test-end-to-end-jit-test \
|
||||
test-end-to-end-jit-clear-tensor \
|
||||
test-end-to-end-jit-encrypted-tensor \
|
||||
test-end-to-end-jit-hlfhelinalg \
|
||||
test-python \
|
||||
test \
|
||||
add-deps \
|
||||
|
||||
@@ -4,12 +4,24 @@ include_directories(${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
add_executable(
|
||||
end_to_end_jit_test
|
||||
end_to_end_jit_clear_tensor.cc
|
||||
end_to_end_jit_encrypted_tensor.cc
|
||||
end_to_end_jit_hlfhelinalg.cc
|
||||
end_to_end_jit_test.cc
|
||||
)
|
||||
|
||||
add_executable(
|
||||
end_to_end_jit_clear_tensor
|
||||
end_to_end_jit_clear_tensor.cc
|
||||
)
|
||||
|
||||
add_executable(
|
||||
end_to_end_jit_encrypted_tensor
|
||||
end_to_end_jit_encrypted_tensor.cc
|
||||
)
|
||||
|
||||
add_executable(
|
||||
end_to_end_jit_hlfhelinalg
|
||||
end_to_end_jit_hlfhelinalg.cc
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
end_to_end_jit_test.cc
|
||||
end_to_end_jit_clear_tensor.cc
|
||||
@@ -25,6 +37,27 @@ target_link_libraries(
|
||||
ZamalangSupport
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
end_to_end_jit_clear_tensor
|
||||
gtest_main
|
||||
ZamalangSupport
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
end_to_end_jit_encrypted_tensor
|
||||
gtest_main
|
||||
ZamalangSupport
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
end_to_end_jit_hlfhelinalg
|
||||
gtest_main
|
||||
ZamalangSupport
|
||||
)
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(end_to_end_jit_test)
|
||||
gtest_discover_tests(end_to_end_jit_clear_tensor)
|
||||
gtest_discover_tests(end_to_end_jit_encrypted_tensor)
|
||||
gtest_discover_tests(end_to_end_jit_hlfhelinalg)
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "end_to_end_jit_test.h"
|
||||
|
||||
const mlir::zamalang::V0FHEConstraint defaultV0Constraints{10, 7};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 1D tensor //////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "end_to_end_jit_test.h"
|
||||
|
||||
mlir::zamalang::V0FHEConstraint defaultV0Constraints() { return {10, 7}; }
|
||||
const mlir::zamalang::V0FHEConstraint defaultV0Constraints{10, 7};
|
||||
|
||||
TEST(CompileAndRunHLFHE, add_eint) {
|
||||
mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX(
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "zamalang/Support/CompilerEngine.h"
|
||||
#include "zamalang/Support/JitCompilerEngine.h"
|
||||
|
||||
mlir::zamalang::V0FHEConstraint defaultV0Constraints();
|
||||
extern const mlir::zamalang::V0FHEConstraint defaultV0Constraints;
|
||||
|
||||
#define ASSERT_LLVM_ERROR(err) \
|
||||
if (err) { \
|
||||
@@ -87,7 +87,7 @@ internalCheckedJit(F checkfunc, llvm::StringRef src,
|
||||
mlir::zamalang::JitCompilerEngine engine;
|
||||
|
||||
if (useDefaultFHEConstraints)
|
||||
engine.setFHEConstraints(defaultV0Constraints());
|
||||
engine.setFHEConstraints(defaultV0Constraints);
|
||||
|
||||
llvm::Expected<mlir::zamalang::JitCompilerEngine::Lambda> lambdaOrErr =
|
||||
engine.buildLambda(src, func);
|
||||
|
||||
Reference in New Issue
Block a user