Skip to content

Commit b284ad5

Browse files
committed
[ot] .gitlab-ci.d: opentitan: add GitLab CI scripts
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
1 parent cb753a7 commit b284ad5

File tree

5 files changed

+140
-0
lines changed

5 files changed

+140
-0
lines changed

.gitlab-ci.d/opentitan/build.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#------------------------------------------------------------------------------
2+
# QEMU OpenTitan CI
3+
#------------------------------------------------------------------------------
4+
5+
build-clang:
6+
tags:
7+
- qemu_ot
8+
stage: build
9+
# build QEMU for OT platforms, ensure subprojects are cleaned up first
10+
# store generated header files and ninja command file as artifacts, which are
11+
# required to run the clang-tidy stage
12+
# libvhost-user.c generates sign-compare warnings with clang, so disable
13+
# warning-as-error
14+
# the alternative would be to build here with GCC, then rebuild everything
15+
# with clang in clang-tidy stage, as meson generates different, incompatible
16+
# warning list between GCC and clang...
17+
script:
18+
- rm -rf build
19+
- git clean -dffx subprojects
20+
- mkdir build
21+
- cd build
22+
- ../configure --cc=clang-19 --disable-werror $QEMU_BUILD_OPTS
23+
--target-list=riscv32-softmmu,riscv64-softmmu,x86_64-linux-user
24+
- ninja
25+
- ninja qemu-img
26+
- strip qemu-system-riscv32 qemu-img
27+
- QEMU_DIR="$(cd .. && pwd -P)"; cat compile_commands.json |
28+
sed -E 's,'"$QEMU_DIR"',@QEMU_DIR@,g' > compile_commands.json.tpl
29+
- ../scripts/opentitan/swexit.py -t ibexdemo -b 0x0 -o exit_id.bin
30+
- ../scripts/opentitan/swexit.py -t earlgrey -b 0x80 -o exit_eg.bin
31+
artifacts:
32+
public: false
33+
expire_in: 1 hour
34+
name: "qemu-ot"
35+
paths:
36+
- subprojects/libtomcrypt/src/headers/*.h
37+
- build/*.h
38+
- build/qapi/*.h
39+
- build/trace/*.h
40+
- build/compile_commands.json.tpl
41+
- build/qemu-system-riscv32
42+
- build/qemu-img
43+
- build/exit_*.bin
44+
45+
build-gcc:
46+
tags:
47+
- qemu_ot
48+
stage: build
49+
# build QEMU for OT platforms, ensure subprojects are cleaned up first
50+
# build with GCC to may need different warnings
51+
script:
52+
- rm -rf build-gcc
53+
- mkdir build-gcc
54+
- cd build-gcc
55+
- ../configure --cc=gcc $QEMU_BUILD_OPTS --target-list=riscv32-softmmu,riscv64-softmmu
56+
- ninja
57+
58+
format:
59+
tags:
60+
- qemu_ot
61+
stage: build
62+
script:
63+
- scripts/opentitan/ot-format.sh --ci -i
64+
- git status -s
65+
- test -z "$(git status -s)" || git diff
66+
- test -z "$(git status -s)"
67+
68+
tidy:
69+
tags:
70+
- qemu_ot
71+
stage: build
72+
needs: ["build-clang"]
73+
script:
74+
- QEMU_DIR="$(pwd -P)"; cat build/compile_commands.json.tpl |
75+
sed -E 's,@QEMU_DIR@,'"$QEMU_DIR"',g' > build/compile_commands.json
76+
- scripts/opentitan/ot-tidy.sh --ci -p build

.gitlab-ci.d/opentitan/ot-bmtests.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Baremetal Tests for Earlgrey
2+
3+
baremetal-eg-tests:
4+
tags:
5+
- qemu_ot
6+
stage: test
7+
needs:
8+
- "build-clang"
9+
- project: rv/sandbox/rot/baremetal_test
10+
job: build-eg
11+
ref: $BAREMETAL_REF
12+
artifacts: true
13+
variables:
14+
BASEDIR: bmtests/eg
15+
CI_EXEC: 1
16+
script:
17+
- python3 -m virtualenv .venv
18+
- . .venv/bin/activate
19+
- pip3 install -r scripts/opentitan/requirements.txt
20+
- rm -rf ${BASEDIR}
21+
- mkdir -p ${BASEDIR}
22+
- zstd -d --stdout ot-eg-bmtest.tar.zst | tar xf - -C ${BASEDIR}
23+
- find ${BASEDIR}
24+
- scripts/opentitan/pyot.py -vv -c ${BASEDIR}/data/qemu/ot-earlgrey/pyot-eflash.hjson
25+
-w ot-earlgrey.csv -R -T 3
26+
artifacts:
27+
public: false
28+
expire_in: 1 year
29+
name: "bm-ot-earlgrey"
30+
paths:
31+
- ot-earlgrey.csv

.gitlab-ci.d/opentitan/ot-smoke.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
smoke-tests-ot:
2+
tags:
3+
- qemu_ot
4+
stage: test
5+
needs: ["build-clang"]
6+
script:
7+
- build/qemu-system-riscv32 -M help | grep ibexdemo
8+
- build/qemu-system-riscv32 -M help | grep ot-earlgrey
9+
- timeout -s KILL 4 build/qemu-system-riscv32 -M ibexdemo -nographic
10+
-device loader,addr=0x100080,file=build/exit_id.bin -d in_asm,int
11+
- timeout -s KILL 4 build/qemu-system-riscv32 -M ot-earlgrey,no_epmp_cfg=true -nographic
12+
-object ot-rom_img,id=rom,file=build/exit_eg.bin -d in_asm,int

.gitlab-ci.d/opentitan/pylint-ot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
pylint-ot:
2+
tags:
3+
- qemu_ot
4+
stage: build
5+
script:
6+
# disable duplicate code as all front end are tested at once (false positive)
7+
# disable fixme ("# TODO" comments)
8+
- python3 -m virtualenv .venv
9+
- . .venv/bin/activate
10+
- pip3 install -r scripts/opentitan/requirements.txt
11+
- pylint --rcfile scripts/opentitan/.pylintrc -d 'duplicate-code' -d 'fixme'
12+
scripts/opentitan/*.py python/qemu/jtagtools python/qemu/ot

.gitlab-ci.d/opentitan/qemu-ot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
variables:
2+
BAREMETAL_REF: "b0-250310-1"
3+
QEMU_BUILD_OPTS: "--disable-install-blobs"
4+
5+
include:
6+
- local: '/.gitlab-ci.d/opentitan/build.yml'
7+
- local: '/.gitlab-ci.d/opentitan/pylint-ot.yml'
8+
- local: '/.gitlab-ci.d/opentitan/ot-smoke.yml'
9+
- local: '/.gitlab-ci.d/opentitan/ot-bmtests.yml'

0 commit comments

Comments
 (0)