Files
reactics/.github/workflows/tests.yml
2026-04-10 18:13:31 +01:00

100 lines
2.9 KiB
YAML

name: Tests
on:
push:
branches: [master, refactor]
pull_request:
branches: [master]
jobs:
bdd:
name: BDD tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y g++ make bison flex
- name: Build CUDD
working-directory: reactics-bdd
run: ./build_cudd.sh
- name: Build ReactICS BDD module
working-directory: reactics-bdd
run: make
- name: Run BDD tests
run: bash tests/run_tests.sh
smt:
name: SMT tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Python dependencies
run: pip install z3-solver pytest
- name: Run SMT tests
run: python3 -m pytest tests/test_smt.py -v
generators:
name: Generator tests
runs-on: ubuntu-latest
needs: bdd
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y g++ make bison flex
- name: Build CUDD
working-directory: reactics-bdd
run: ./build_cudd.sh
- name: Build ReactICS BDD module
working-directory: reactics-bdd
run: make
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run generator tests
run: |
REACTICS="$PWD/reactics-bdd/reactics"
GENERATORS="$PWD/examples/bdd/generators"
failed=0
check_gen() {
local name="$1" gen_cmd="$2" property="$3" expected="$4"
local tmpfile=$(mktemp /tmp/reactics_gen_XXXXXX.drs)
eval "$gen_cmd" > "$tmpfile" 2>&1
local result=$("$REACTICS" -c "$property" "$tmpfile" 2>&1 | grep -oE "(holds|does not hold)" || true)
rm -f "$tmpfile"
if [ "$result" = "$expected" ]; then
echo " PASS: $name"
else
echo " FAIL: $name (expected '$expected', got '$result')"
failed=1
fi
}
check_gen "tgc(3) f1" "python3 $GENERATORS/gen_tgc.py 3" f1 "holds"
check_gen "tgc(3) f3" "python3 $GENERATORS/gen_tgc.py 3" f3 "holds"
check_gen "tgc(4) f2" "python3 $GENERATORS/gen_tgc.py 4" f2 "holds"
check_gen "asm(3) f1" "python3 $GENERATORS/gen_asm.py 3" f1 "holds"
check_gen "asm(3) f2" "python3 $GENERATORS/gen_asm.py 3" f2 "holds"
check_gen "drs(2,2,2,a) f0" "python3 $GENERATORS/gen_drs.py 2 2 2 a" f0 "does not hold"
check_gen "drs(2,2,2,b) f0" "python3 $GENERATORS/gen_drs.py 2 2 2 b" f0 "holds"
exit $failed