Skip to content

Commit e010760

Browse files
committed
riscv32 toolchain via nix test
1 parent c849a90 commit e010760

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.github/workflows/python-package.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
# uses: actions/setup-python@v3
2424
# with:
2525
# python-version: ${{ matrix.python-version }}
26+
- uses: cachix/install-nix-action@v31
27+
with:
28+
nix_path: nixpkgs=channel:nixos-unstable
2629
- name: Set up Rust
2730
uses: actions-rust-lang/setup-rust-toolchain@v1
2831
- name: Set up Lean

tests/test_pcode.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,23 @@ def test_cli():
168168
f.write(code)
169169
f.flush()
170170
res = subprocess.run("python3 -m kdrag.contrib.pcode /tmp/mov42.s", shell=True, capture_output=True, text=True)
171-
assert "verification conditions failed. ❌❌❌❌" in res.stdout
171+
assert "verification conditions failed. ❌❌❌❌" in res.stdout
172+
173+
@pytest.mark.slow
174+
def test_riscv32():
175+
code = """
176+
.include "/tmp/knuckle.s"
177+
.text
178+
.globl myfunc
179+
kd_entry myfunc, "true"
180+
addi sp, sp, -4 # make room on the stack
181+
li t0, 42 # t0 ← 42
182+
sw t0, 0(sp) # [sp] = 42
183+
kd_exit myfunc_end, "(= (select ram32 sp) (_ bv42 32))"
184+
ret
185+
"""
186+
with open("/tmp/mov42.s", "w") as f:
187+
f.write(code)
188+
f.flush()
189+
res = subprocess.run("""nix-shell -p pkgsCross.riscv32-embedded.buildPackages.gcc \
190+
--run "riscv32-none-elf-as /tmp/mov42.s -o /tmp/mov42.o" """, shell=True, check=True, capture_output=True, text=True)

0 commit comments

Comments
 (0)