Skip to content

Commit

Permalink
chore(backward): move compat tests to avoid compiling them everytime
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarlin-zama committed Jan 9, 2025
1 parent a9fb3e9 commit 18e6290
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aws_tfhe_backward_compat_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
with:
persist-credentials: 'false'
repository: zama-ai/tfhe-backward-compat-data
path: tfhe/tfhe-backward-compat-data
path: tests/tfhe-backward-compat-data
lfs: 'true'
ref: ${{ steps.backward_compat_branch.outputs.branch }}

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node_modules/
package-lock.json

# Dir used for backward compatibility test data
tfhe/tfhe-backward-compat-data/
tests/tfhe-backward-compat-data/
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ members = [
"backends/tfhe-cuda-backend",
"utils/tfhe-versionable",
"utils/tfhe-versionable-derive",
"tests"
]

exclude = [
"tfhe/backward_compatibility_tests",
"tests/backward_compatibility_tests",
"utils/cargo-tfhe-lints-inner",
"utils/cargo-tfhe-lints"
]
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -892,11 +892,11 @@ test_versionable: install_rs_build_toolchain
.PHONY: test_backward_compatibility_ci
test_backward_compatibility_ci: install_rs_build_toolchain
TFHE_BACKWARD_COMPAT_DATA_DIR="$(BACKWARD_COMPAT_DATA_DIR)" RUSTFLAGS="$(RUSTFLAGS)" cargo $(CARGO_RS_BUILD_TOOLCHAIN) test --profile $(CARGO_PROFILE) \
--config "patch.'$(BACKWARD_COMPAT_DATA_URL)'.$(BACKWARD_COMPAT_DATA_PROJECT).path=\"tfhe/$(BACKWARD_COMPAT_DATA_DIR)\"" \
--features=shortint,integer,zk-pok -p $(TFHE_SPEC) test_backward_compatibility -- --nocapture
--config "patch.'$(BACKWARD_COMPAT_DATA_URL)'.$(BACKWARD_COMPAT_DATA_PROJECT).path=\"tests/$(BACKWARD_COMPAT_DATA_DIR)\"" \
--features=shortint,integer,zk-pok -p tests test_backward_compatibility -- --nocapture

.PHONY: test_backward_compatibility # Same as test_backward_compatibility_ci but tries to clone the data repo first if needed
test_backward_compatibility: tfhe/$(BACKWARD_COMPAT_DATA_DIR) test_backward_compatibility_ci
test_backward_compatibility: tests/$(BACKWARD_COMPAT_DATA_DIR) test_backward_compatibility_ci

.PHONY: backward_compat_branch # Prints the required backward compatibility branch
backward_compat_branch:
Expand Down Expand Up @@ -1275,9 +1275,9 @@ write_params_to_file: install_rs_check_toolchain

.PHONY: clone_backward_compat_data # Clone the data repo needed for backward compatibility tests
clone_backward_compat_data:
./scripts/clone_backward_compat_data.sh $(BACKWARD_COMPAT_DATA_URL) $(BACKWARD_COMPAT_DATA_BRANCH) tfhe/$(BACKWARD_COMPAT_DATA_DIR)
./scripts/clone_backward_compat_data.sh $(BACKWARD_COMPAT_DATA_URL) $(BACKWARD_COMPAT_DATA_BRANCH) tests/$(BACKWARD_COMPAT_DATA_DIR)

tfhe/$(BACKWARD_COMPAT_DATA_DIR): clone_backward_compat_data
tests/$(BACKWARD_COMPAT_DATA_DIR): clone_backward_compat_data

#
# Real use case examples
Expand Down
2 changes: 1 addition & 1 deletion tasks/src/check_tfhe_docs_are_tested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const DIR_TO_IGNORE: [&str; 3] = [
".git",
"target",
// If the data repo has been cloned, we ignore its README
"tfhe/tfhe-backward-compat-data",
"tests/tfhe-backward-compat-data",
];

const FILES_TO_IGNORE: [&str; 5] = [
Expand Down
23 changes: 23 additions & 0 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "tests"
version = "0.1.0"
edition = "2021"
publish = false

[dev-dependencies]
tfhe = { path = "../tfhe" }
tfhe-versionable = { path = "../utils/tfhe-versionable" }
tfhe-backward-compat-data = { git = "https://github.com/zama-ai/tfhe-backward-compat-data.git", branch = "v0.4", default-features = false, features = [
"load",
] }
ron = "0.8"


[[test]]
name = "backward_compatibility_tests"
path = "backward_compatibility_tests.rs"

[features]
shortint = ["tfhe/shortint"]
integer = ["shortint", "tfhe/integer"]
zk-pok = ["tfhe/zk-pok"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 0 additions & 5 deletions tfhe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ env_logger = "0.10.0"
log = "0.4.19"
hex = "0.4.3"
# End regex-engine deps
# Used for backward compatibility test metadata
ron = "0.8"
tfhe-backward-compat-data = { git = "https://github.com/zama-ai/tfhe-backward-compat-data.git", branch = "v0.4", default-features = false, features = [
"load",
] }
strum = { version = "0.26", features = ["derive"] }

[build-dependencies]
Expand Down

0 comments on commit 18e6290

Please sign in to comment.