Skip to content

Commit 328ac2b

Browse files
committed
[bazel] system tests:
- setup wrapper for system tests - integrate unit tests in bazel - adapt documentation
1 parent 76e4ef4 commit 328ac2b

51 files changed

Lines changed: 724 additions & 97 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ common --enable_bzlmod
22

33
build:lint --aspects=//tools/lint:linters.bzl%pylint,//tools/lint:linters.bzl%ty
44
build:lint --output_groups=+rules_lint_human
5+
6+
# --combined_report=lcov merges per-test .dat files into one LCOV report.
7+
# --instrumentation_filter restricts instrumentation to the trlc library only.
8+
coverage --combined_report=lcov
9+
coverage --instrumentation_filter="//trlc[/:]"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# Project ignores
22
docs
3+
htmlcov
34
.coverage*
45
*.lobster
56

67
# Python ignores
78
*.pyc
9+
__pycache__
10+
.ruff_cache
811
*.egg-info
912
.venv/
1013
venv/

BUILD

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,9 @@ alias(
5757
name = "format.fix",
5858
actual = "//tools/format:format",
5959
)
60+
61+
filegroup(
62+
name = "coverage",
63+
srcs = ["coverage.cfg"],
64+
visibility = ["//visibility:public"],
65+
)

CHANGELOG.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,25 @@ generated in the following situations:
2727

2828
### 2.0.4-dev
2929

30-
* [BAZEL] Add Rules Lint for Formatting and Linting
30+
* [TRLC] Rework system tests as Bazel-native golden-file tests: each
31+
test directory is now a single `py_test` with one method per output
32+
mode (`output`, `output.brief`, `output.json`, `output.smtlib`),
33+
selectable via `--test_filter`.
3134

32-
* [BAZEL] Update Bazel to 8.5.1
35+
* [TRLC] Add `--log FILE PREFIX` to write all output to FILE
36+
and strip PREFIX from file paths (used by Bazel system test actions).
37+
38+
* [TRLC] `Message_Handler` now accepts `out_path` to open and manage
39+
its own output file; use as a context manager to ensure it is closed.
40+
41+
* [TRLC] Update Bazel CVC5 version to 1.3.2.
3342

3443
* [BAZEL] Update Rules Python to 1.1.0
3544

45+
* [BAZEL] Add Rules Lint for Formatting and Linting
46+
47+
* [BAZEL] Update Bazel to 8.5.1
48+
3649
### 2.0.3
3750

3851
* [API] Fix incorrect output of `Integer_Literal.dump()` method.

MODULE.bazel

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ python.toolchain(python_version = "3.11")
2929
python.toolchain(
3030
is_default = True,
3131
python_version = "3.12",
32+
configure_coverage_tool = True,
3233
)
3334

3435
use_repo(python, "python_versions")
@@ -68,26 +69,27 @@ use_repo(pip_dev, "trlc_dev_dependencies")
6869

6970
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
7071

72+
7173
http_archive(
7274
name = "cvc5_linux",
7375
build_file = "@trlc//:cvc5.BUILD",
74-
sha256 = "ab9344e2dddda794669c888a3afcd99f25f2627e1d426bd7d08ecb267361b331",
76+
sha256 = "30abf22d8042f3c4d3eb1120c595abd461f92f276a6d1264895fb4403b5fb3fd",
7577
strip_prefix = "cvc5-Linux-x86_64-static-gpl",
76-
url = "https://github.com/cvc5/cvc5/releases/download/cvc5-1.2.0/cvc5-Linux-x86_64-static-gpl.zip",
78+
url = "https://github.com/cvc5/cvc5/releases/download/cvc5-1.3.2/cvc5-Linux-x86_64-static-gpl.zip",
7779
)
7880

7981
http_archive(
8082
name = "cvc5_mac",
8183
build_file = "@trlc//:cvc5.BUILD",
82-
sha256 = "2b983ca743ef1327b51408bf8ba6c08c97beaadde2c3968da701ca16bb1e3740",
84+
sha256 = "9b00ae44d51903cd830e281c97066d7e4c0a57f1aa6c5b275435d3016427be64",
8385
strip_prefix = "cvc5-macOS-arm64-static-gpl",
84-
url = "https://github.com/cvc5/cvc5/releases/download/cvc5-1.2.0/cvc5-macOS-arm64-static-gpl.zip",
86+
url = "https://github.com/cvc5/cvc5/releases/download/cvc5-1.3.2/cvc5-macOS-arm64-static-gpl.zip",
8587
)
8688

8789
http_archive(
8890
name = "cvc5_windows",
8991
build_file = "@trlc//:cvc5.BUILD",
90-
sha256 = "256f4af3f4181e770801df436852cb3c76c86dbf9b69a47064d7f8d5bc0ee1d2",
92+
sha256 = "206d55380f9a0ccf43541756b5ce2be487efcbbf322b93dc1de662856c70e5cc",
9193
strip_prefix = "cvc5-Win64-x86_64-static",
92-
url = "https://github.com/cvc5/cvc5/releases/download/cvc5-1.2.0/cvc5-Win64-x86_64-static.zip",
94+
url = "https://github.com/cvc5/cvc5/releases/download/cvc5-1.3.2/cvc5-Win64-x86_64-static.zip",
9395
)

MODULE.bazel.lock

Lines changed: 2 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,34 @@ test: unit-tests system-tests
1212
make coverage
1313
util/check_local_modifications.sh
1414

15+
# bazel equivalent: bazel test //tests-unit/... //tests-system:all_tests
1516
test-all: unit-tests system-tests-all
1617
make coverage
1718
util/check_local_modifications.sh
1819

20+
# bazel equivalent: bazel coverage --combined_report=lcov //tests-system/... //api-examples/...
21+
# genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat" -o htmlcov
1922
coverage:
2023
coverage combine -q
2124
coverage html --rcfile=coverage.cfg
2225
coverage report --rcfile=coverage.cfg --fail-under=94
2326

27+
# bazel equivalent: bazel test //tests-unit/...
2428
unit-tests:
2529
coverage run -p \
2630
--branch --rcfile=coverage.cfg \
2731
--data-file .coverage \
2832
-m unittest discover -s tests-unit -v
2933

34+
# bazel equivalent: bazel test //tests-system:fast
3035
system-tests:
3136
mkdir -p docs
3237
coverage run -p --rcfile=coverage.cfg --branch --data-file .coverage \
3338
./trlc-lrm-generator.py
3439
make -C tests-system -B -j8 fast
3540
make -C tests-large-partial -B -j8 fast
3641

42+
# bazel equivalent: bazel test //tests-system:all_tests
3743
system-tests-all:
3844
mkdir -p docs
3945
coverage run -p --rcfile=coverage.cfg --branch --data-file .coverage \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ The Python implementation can be used for several purposes:
6565
(required when using the `--verify` option)
6666

6767
Optional dependency (not installed automatically):
68-
* [Binary CVC5](https://github.com/cvc5/cvc5/releases/tag/cvc5-1.0.8)
68+
* [Binary CVC5](https://github.com/cvc5/cvc5/releases/tag/cvc5-1.3.2)
6969
(An alternative to PyPI CVC5, make sure to rename the binary to
7070
`cvc5` and put it on your PATH).

bazel/_private/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exports_files(["mode_test.py"])

0 commit comments

Comments
 (0)