Skip to content

Commit 647e59e

Browse files
committed
add ninja check-rules
1 parent cdd46e6 commit 647e59e

4 files changed

Lines changed: 17 additions & 23 deletions

File tree

‎.github/workflows/run-tests.yml‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ jobs:
99
matrix:
1010
os: [ubuntu-latest, macos-latest]
1111
build_type: [Debug, Release]
12-
test:
13-
- name: unit-tests
14-
target: check
15-
- name: benchmarks (skip-run)
16-
target: check-benchmarks
17-
skip_run: "1"
1812

1913
runs-on: ${{ matrix.os }}
2014
name: ${{ matrix.test.name }} (${{ matrix.os }}, ${{ matrix.build_type }})
@@ -53,8 +47,16 @@ jobs:
5347
run: ninja
5448
working-directory: build
5549

56-
- name: Run tests
57-
run: ninja ${{ matrix.test.target }}
50+
- name: Run unit tests
51+
run: ninja check
52+
working-directory: build
53+
54+
- name: Check rules
55+
run: ninja check-rules
56+
working-directory: build
57+
58+
- name: Check benchmarks (don't run)
59+
run: ninja check-benchmarks
5860
working-directory: build
5961
env:
60-
SKIP_RUN: ${{ matrix.test.skip_run }}
62+
SKIP_RUN: 1

‎CMakeLists.txt‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,15 @@ add_custom_target("check"
138138
DEPENDS check-libcc2rs check-unit
139139
)
140140

141-
add_custom_target("gen-rules"
141+
add_custom_target("check-rules"
142142
COMMAND find ${PROJECT_SOURCE_DIR}/rules -name "ir*.json" -delete
143143
COMMAND cargo build
144-
COMMAND ${CMAKE_COMMAND} -E chdir ${PROJECT_SOURCE_DIR}/rule-preprocessor
145-
${CMAKE_COMMAND} -E env
146-
CARGO_TARGET_DIR=${PROJECT_SOURCE_DIR}/rule-preprocessor/target
147-
cargo clean
148144
COMMAND ${CMAKE_COMMAND} -E chdir ${PROJECT_SOURCE_DIR}/rule-preprocessor
149145
${CMAKE_COMMAND} -E env
150146
CARGO_TARGET_DIR=${PROJECT_SOURCE_DIR}/rule-preprocessor/target
151147
cargo run
148+
COMMAND ${CMAKE_COMMAND} -E chdir ${PROJECT_SOURCE_DIR}
149+
git diff --exit-code -- rules/
152150
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/rules"
153151
DEPENDS install-rust-toolchain
154152
USES_TERMINAL

‎README.md‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ ninja
5151
ninja check
5252
```
5353

54-
If any change was made to the translation rules, regenerate the IR with:
55-
56-
```bash
57-
ninja gen-rules
58-
```
59-
6054

6155
## Run
6256

@@ -139,6 +133,9 @@ ninja check-benchmarks
139133
# Check benchmark output without executing binaries
140134
SKIP_RUN=1 ninja check-benchmarks
141135

136+
# Regenerate and check if the IR for the rules changed
137+
ninja check-rules
138+
142139
# Regenerate expected output for unit tests after intentional changes
143140
REPLACE_EXPECTED=1 ninja check-unit
144141
```

‎rules/src/modules.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Copyright (c) 2022-present INESC-ID.
2-
// Distributed under the MIT license that can be found in the LICENSE file.
3-
41
#[path = r#"../algorithm/tgt_refcount.rs"#]
52
pub mod algorithm_tgt_refcount;
63
#[path = r#"../algorithm/tgt_unsafe.rs"#]

0 commit comments

Comments
 (0)