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
32 changes: 8 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@ jobs:
with:
python-version: '3.10'
- run: pip install ruamel.yaml pytest pytest-cov
- name: Unit tests
run: pytest python/tests/unit/ -v
- name: Unit coverage
run: pytest --cov=python/lira python/tests/unit/ --cov-report=term
- name: Integration tests
run: pytest python/tests/integration/ -v
- name: Diff integration output vs reference
run: diff python/tests/integration/integration.yaml tests/integration/reference.yaml
- run: pip install -e python/
- name: Run Python tests (unit, integration, coverage)
run: bash tests/scripts/python.sh

ruby-tests:
runs-on: ubuntu-latest
Expand All @@ -35,18 +30,8 @@ jobs:
python-version: '3.10'
- run: pip install ruamel.yaml
- run: gem install minitest simplecov
- name: Unit tests
run: |
ruby -I ruby -I ruby/lib ruby/tests/unit/test_ir_ser_txt.rb
ruby -I ruby -I ruby/lib ruby/tests/unit/test_arch_ser_yaml.rb
ruby -I ruby -I ruby/lib ruby/tests/unit/test_ir_builder.rb
- name: Unit coverage
run: |
ruby -r simplecov -I ruby -I ruby/lib -e 'SimpleCov.start; Dir["ruby/tests/unit/*.rb"].each { |f| require_relative f }'
- name: Integration tests
run: ruby -I ruby -I ruby/lib ruby/tests/integration/test_integration.rb
- name: Diff integration output vs reference
run: diff ruby/tests/integration/integration.yaml tests/integration/reference.yaml
- name: Run Ruby tests (unit, integration, coverage)
run: bash tests/scripts/ruby.sh

rust-tests:
runs-on: ubuntu-latest
Expand All @@ -56,11 +41,10 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: sudo apt-get update && sudo apt-get install -y z3
- run: pip install ruamel.yaml
- name: Integration tests
run: cd rust && cargo test -p lira-tests --test integration
- name: Diff integration output vs reference
run: diff rust/tests/integration/integration.yaml tests/integration/reference.yaml
- name: Run Rust tests (integration, with coverage)
run: bash tests/scripts/rust.sh

cross-language:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ htmlcov/
*.log
.env
build/
tmp/
2 changes: 1 addition & 1 deletion python/lira/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
Instruction, InstructionEncoding, Snippet,
SystemRegister, SystemRegisterField, TableInt,
)
from .arch_ser_yaml import write_arch, read_arch
from .arch_ser_yaml import write_arch, read_arch, copy_arch
from .ir_ops import BaseOp
4 changes: 4 additions & 0 deletions python/lira/arch_ser_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ def read_arch(filepath: Path) -> Arch:
with open(filepath, 'r', encoding='utf-8') as f:
data = yaml.load(f)
return from_serializable(Arch, data)


def copy_arch(path_input: Path, path_output: Path) -> None:
write_arch(read_arch(path_input), path_output)
14 changes: 14 additions & 0 deletions python/tests/integration/copy_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parents[3]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))

from python.lira.arch_ser_yaml import copy_arch


if __name__ == '__main__':
if len(sys.argv) != 3:
sys.exit('Usage: copy_.py <INPUT> <OUTPUT>')
copy_arch(Path(sys.argv[1]), Path(sys.argv[2]))
Loading
Loading