Skip to content

Commit

Permalink
ci - initial
Browse files Browse the repository at this point in the history
  • Loading branch information
bieganski committed Aug 16, 2024
1 parent 3e17f10 commit 50ede4e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
- name: Run OCD tests
shell: bash
run: ./docker_run.py --cmd 'poetry run python3 mtkcpu/tests/test_jtag.py && cat ckpt.log'

- name: Run (external) riscv-tests tests
shell: bash
run: |
make fetch-riscv-tests-isa # 'isa' directory will be created locally.
mtkcpu/tests/test_external_riscv_tests.py ./isa
- name: Synthesisze SoC
shell: bash
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile.riscv-tests
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ from bieganski/riscv-fpga:16-07-2024
# RUN apt-get update
# RUN apt-get install -y build-essential git automake gcc-riscv64-unknown-elf

WORKDIR /

RUN git clone https://github.com/riscv-software-src/riscv-tests

ENV PATH="/root/.local/xPacks/@xpack-dev-tools/riscv-none-elf-gcc/13.2.0-1.2/.content/bin:$PATH"
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ build:
build-docker:
bash ./build_docker_image.sh

build-docker-riscv-tests:
docker build -f Dockerfile.riscv-tests -t riscv-tests .

fetch-riscv-tests-isa: build-docker-riscv-tests
@rm -r riscv-tests-isa
@mkdir riscv-tests-isa
@docker rm -f dummy
docker create --name dummy riscv-tests
docker cp dummy:/riscv-tests/isa .
docker rm -f dummy

fetch-gcc: export id := $(shell docker create $(DOCKER_IMAGE_NAME))
fetch-gcc: export temp := $(shell mktemp -p .)
fetch-gcc:
Expand Down
1 change: 0 additions & 1 deletion mtkcpu/cli/top.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ def main():
elif args.command == "sim":
cpu = get_board_cpu(elf_path=args.elf, cpu_config=cpu_config, num_bytes=None)
sim(
elf_path=args.elf,
cpu=cpu,
with_uart=True,
verbose=args.verbose,
Expand Down
9 changes: 7 additions & 2 deletions mtkcpu/tests/test_external_riscv_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ def end_of_sim():

if __name__ == "__main__":

from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("riscv_tests_binaries_dir", type=Path)
dir = parser.parse_args().riscv_tests_binaries_dir

# see https://github.com/bieganski/mtkcpu/issues/74
excluded = ["rv32ui-p-ma_data"]
user_excluded = ["rv32ui-p-ma_data"]

test_paths = [x for x in glob("/home/mateusz/tb/github/riscv-tests/isa/rv32ui-p-*") if not x.endswith(".dump") and not Path(x).name in excluded]
test_paths = [x for x in dir.glob("rv32ui-p*") if not str(x).endswith(".dump") and not Path(x).name in user_excluded]

for p in test_paths:
logging.info(f"starting {p}")
Expand Down

0 comments on commit 50ede4e

Please sign in to comment.