diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 15ef70c..98bdee9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -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
@@ -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
@@ -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
diff --git a/.gitignore b/.gitignore
index 915133f..85ca188 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,3 +38,4 @@ htmlcov/
*.log
.env
build/
+tmp/
diff --git a/python/lira/__init__.py b/python/lira/__init__.py
index ea7988d..5b84bd5 100644
--- a/python/lira/__init__.py
+++ b/python/lira/__init__.py
@@ -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
diff --git a/python/lira/arch_ser_yaml.py b/python/lira/arch_ser_yaml.py
index 6151ed7..ff6d7a0 100644
--- a/python/lira/arch_ser_yaml.py
+++ b/python/lira/arch_ser_yaml.py
@@ -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)
diff --git a/python/tests/integration/copy_.py b/python/tests/integration/copy_.py
new file mode 100644
index 0000000..98d869e
--- /dev/null
+++ b/python/tests/integration/copy_.py
@@ -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