Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Run backward compatibility tests
name: aws_tfhe_backward_compat_tests
# Run data related tests
name: aws_data_tests

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -30,8 +30,8 @@ permissions:
# zizmor: ignore[concurrency-limits] concurrency is managed after instance setup to ensure safe provisioning

jobs:
backward-compat-tests:
name: aws_tfhe_backward_compat_tests/backward-compat-tests (bpr)
data-tests:
name: aws_data_tests/data-tests (bpr)
if: (github.event_name == 'push' && github.repository == 'zama-ai/tfhe-rs') ||
github.event_name != 'push'
runs-on: "runs-on=${{ github.run_id }}/runner=cpu-small"
Expand All @@ -49,7 +49,7 @@ jobs:
- name: Get LFS data sha
id: hash-lfs-data
run: |
SHA=$(git lfs ls-files -l -I utils/tfhe-backward-compat-data | sha256sum | cut -d' ' -f1)
SHA=$(git lfs ls-files -l -I utils/tfhe-backward-compat-data,tests/corrupted_inputs_deserialization | sha256sum | cut -d' ' -f1)
echo "sha=${SHA}" >> "${GITHUB_OUTPUT}"

- name: Retrieve data from cache
Expand All @@ -59,12 +59,14 @@ jobs:
path: |
utils/tfhe-backward-compat-data/**/*.cbor
utils/tfhe-backward-compat-data/**/*.bcode
tests/corrupted_inputs_deserialization/**/*.bcode
key: ${{ steps.hash-lfs-data.outputs.sha }}

- name: Pull test data
if: steps.retrieve-data-cache.outputs.cache-hit != 'true'
run: |
make pull_backward_compat_data
make pull_corrupted_inputs_data

# Pull token was stored by action/checkout to be used by lfs, we don't need it anymore
- name: Remove git credentials
Expand All @@ -80,6 +82,10 @@ jobs:
run: |
make test_backward_compatibility_ci

- name: Run corrupted inputs deserialization tests
run: |
make test_corrupted_inputs_ci

- name: Store data in cache
if: steps.retrieve-data-cache.outputs.cache-hit != 'true'
continue-on-error: true
Expand All @@ -88,6 +94,7 @@ jobs:
path: |
utils/tfhe-backward-compat-data/**/*.cbor
utils/tfhe-backward-compat-data/**/*.bcode
tests/corrupted_inputs_deserialization/**/*.bcode
key: ${{ steps.hash-lfs-data.outputs.sha }}

- name: Set pull-request URL
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/backward_compat_pr_change_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ name: backward_compat_pr_change_report

on:
pull_request:
paths:
- 'utils/tfhe-lints/snapshots/lint_enum_snapshots_*.json'

permissions:
contents: read
Expand Down Expand Up @@ -53,6 +51,7 @@ jobs:
fi

- name: Find existing comment
if: steps.report.outputs.has_report == 'true'
id: find-comment
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
with:
Expand Down
1 change: 1 addition & 0 deletions .linelint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ignore:
- utils/tfhe-lints/**/main.stderr
- utils/tfhe-lints/**/*.json
- utils/tfhe-backward-compat-data/**/*.ron # ron files are autogenerated
- tests/corrupted_inputs_deserialization/data/proven_compact_list/**/metadata.txt

rules:
# checks if file ends in a newline character
Expand Down
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ BENCH_CUSTOM_COMMAND:=
NODE_VERSION=24.12
BACKWARD_COMPAT_DATA_DIR=utils/tfhe-backward-compat-data
BACKWARD_COMPAT_DATA_GEN_VERSION:=$(TFHE_VERSION)
CORRUPTED_INPUTS_TEST=tests/corrupted_inputs_deserialization
TEST_VECTORS_DIR=apps/test-vectors
CURRENT_TFHE_VERSION:=$(shell grep '^version[[:space:]]*=' tfhe/Cargo.toml | cut -d '=' -f 2 | xargs)
WASM_PACK_VERSION="0.13.1"
Expand Down Expand Up @@ -503,7 +504,7 @@ clippy_trivium: install_rs_check_toolchain
.PHONY: clippy_ws_tests # Run clippy on the workspace level tests
clippy_ws_tests: install_rs_check_toolchain
RUSTFLAGS="$(RUSTFLAGS)" cargo "$(CARGO_RS_CHECK_TOOLCHAIN)" clippy --tests \
-p tests --features=shortint,integer,zk-pok -- --no-deps -D warnings
-p tests --features=shortint,integer,zk-pok,strings -- --no-deps -D warnings

.PHONY: clippy_all_targets # Run clippy lints on all targets (benches, examples, etc.)
clippy_all_targets: install_rs_check_toolchain
Expand Down Expand Up @@ -1237,11 +1238,19 @@ new_backward_compat_crate:
.PHONY: test_backward_compatibility_ci
test_backward_compatibility_ci:
TFHE_BACKWARD_COMPAT_DATA_DIR="../$(BACKWARD_COMPAT_DATA_DIR)" RUSTFLAGS="$(RUSTFLAGS)" cargo test --profile $(CARGO_PROFILE) \
--features=shortint,integer,zk-pok -p tests test_backward_compatibility -- --nocapture
--features=shortint,integer,zk-pok,strings -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: pull_backward_compat_data test_backward_compatibility_ci

.PHONY: test_corrupted_inputs_ci
test_corrupted_inputs_ci:
RUSTFLAGS="$(RUSTFLAGS)" cargo test --profile $(CARGO_PROFILE) \
--features=integer,zk-pok,strings -p tests test_corrupted_inputs_deserialization -- --nocapture

.PHONY: test_corrupted_inputs # Same as test_corrupted_inputs_ci but pulls data first
test_corrupted_inputs: pull_corrupted_inputs_data test_corrupted_inputs_ci

# Generate the test vectors and update the hash file
.PHONY: gen_test_vectors
gen_test_vectors:
Expand Down Expand Up @@ -2033,6 +2042,10 @@ write_params_to_file: install_rs_check_toolchain
pull_backward_compat_data:
./scripts/pull_lfs_data.sh $(BACKWARD_COMPAT_DATA_DIR)

.PHONY: pull_corrupted_inputs_data # Pull the data files needed for corrupted inputs deserialization tests
pull_corrupted_inputs_data:
./scripts/pull_lfs_data.sh $(CORRUPTED_INPUTS_TEST)

.PHONY: pull_hpu_files # Pull the hpu files
pull_hpu_files:
./scripts/pull_lfs_data.sh backends/tfhe-hpu-backend/
Expand Down
5 changes: 5 additions & 0 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ semver = "1.0"
name = "backward_compatibility_tests"
path = "backward_compatibility_tests.rs"

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

[features]
shortint = ["tfhe/shortint"]
integer = ["shortint", "tfhe/integer"]
zk-pok = ["tfhe/zk-pok"]
strings = ["integer", "tfhe/strings"]
Loading
Loading