fix(tests): Define defaultV0Constraints in a single place

The variable `defaultV0Constraints` is defined in multiple source
files for unit test, but missing in other tests. Put a single, extern
declaration in `globals.h` and the definition in `globals.cc`.
This commit is contained in:
Andi Drebes
2021-11-15 10:40:32 +01:00
parent 6fb907295d
commit 99fe188e66
6 changed files with 12 additions and 6 deletions

View File

@@ -5,21 +5,25 @@ include_directories(${PROJECT_SOURCE_DIR}/include)
add_executable(
end_to_end_jit_test
end_to_end_jit_test.cc
globals.cc
)
add_executable(
end_to_end_jit_clear_tensor
end_to_end_jit_clear_tensor.cc
globals.cc
)
add_executable(
end_to_end_jit_encrypted_tensor
end_to_end_jit_encrypted_tensor.cc
globals.cc
)
add_executable(
end_to_end_jit_hlfhelinalg
end_to_end_jit_hlfhelinalg.cc
globals.cc
)
set_source_files_properties(
@@ -27,6 +31,7 @@ set_source_files_properties(
end_to_end_jit_clear_tensor.cc
end_to_end_jit_encrypted_tensor.cc
end_to_end_jit_hlfhelinalg.cc
globals.cc
PROPERTIES COMPILE_FLAGS "-fno-rtti"
)

View File

@@ -1,7 +1,5 @@
#include "end_to_end_jit_test.h"
const mlir::zamalang::V0FHEConstraint defaultV0Constraints{10, 7};
///////////////////////////////////////////////////////////////////////////////
// 1D tensor //////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

View File

@@ -5,8 +5,6 @@
#include "end_to_end_jit_test.h"
const mlir::zamalang::V0FHEConstraint defaultV0Constraints{10, 7};
TEST(CompileAndRunHLFHE, add_eint) {
mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX(
func @main(%arg0: !HLFHE.eint<7>, %arg1: !HLFHE.eint<7>) -> !HLFHE.eint<7> {

View File

@@ -5,8 +5,7 @@
#include "zamalang/Support/CompilerEngine.h"
#include "zamalang/Support/JitCompilerEngine.h"
extern const mlir::zamalang::V0FHEConstraint defaultV0Constraints;
#include "globals.h"
#define ASSERT_LLVM_ERROR(err) \
if (err) { \

View File

@@ -0,0 +1,3 @@
#include "globals.h"
const mlir::zamalang::V0FHEConstraint defaultV0Constraints{10, 7};

View File

@@ -0,0 +1,3 @@
#include <zamalang/Conversion/Utils/GlobalFHEContext.h>
extern const mlir::zamalang::V0FHEConstraint defaultV0Constraints;