xref: /openbmc/qemu/.gitlab-ci.yml (revision f7160f32)
1# Currently we have two build stages after our containers are built:
2#  - build (for traditional build and test or first stage build)
3#  - test (for test stages, using build artefacts from a build stage)
4stages:
5  - containers
6  - containers-layer2
7  - containers-layer3
8  - build
9  - test
10
11# We assume GitLab has it's own caching set up for RPM/APT repositories so we
12# just take care of avocado assets here.
13cache:
14  paths:
15    - $HOME/avocado/data/cache
16
17include:
18  - local: '/.gitlab-ci.d/edk2.yml'
19  - local: '/.gitlab-ci.d/opensbi.yml'
20  - local: '/.gitlab-ci.d/containers.yml'
21
22.native_build_job_template: &native_build_job_definition
23  stage: build
24  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
25  before_script:
26    - JOBS=$(expr $(nproc) + 1)
27  script:
28    - mkdir build
29    - cd build
30    - if test -n "$TARGETS";
31      then
32        ../configure --enable-werror $CONFIGURE_ARGS --target-list="$TARGETS" ;
33      else
34        ../configure --enable-werror $CONFIGURE_ARGS ;
35      fi
36    - make -j"$JOBS"
37    - if test -n "$MAKE_CHECK_ARGS";
38      then
39        make -j"$JOBS" $MAKE_CHECK_ARGS ;
40      fi
41
42.native_test_job_template: &native_test_job_definition
43  stage: test
44  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
45  script:
46    - cd build
47    - find . -type f -exec touch {} +
48    - make $MAKE_CHECK_ARGS
49
50.post_acceptance_template: &post_acceptance
51  after_script:
52    - cd build
53    - python3 -c 'import json; r = json.load(open("tests/results/latest/results.json")); [print(t["logfile"]) for t in r["tests"] if t["status"] not in ("PASS", "SKIP")]' | xargs cat
54    - du -chs $HOME/avocado/data/cache
55
56build-system-ubuntu-main:
57  <<: *native_build_job_definition
58  variables:
59    IMAGE: ubuntu2004
60    TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu lm32-softmmu
61      moxie-softmmu microblazeel-softmmu mips64el-softmmu m68k-softmmu ppc-softmmu
62      riscv64-softmmu sparc-softmmu
63    MAKE_CHECK_ARGS: check-build
64  artifacts:
65    paths:
66      - build
67
68check-system-ubuntu-main:
69  <<: *native_test_job_definition
70  needs:
71    - job: build-system-ubuntu-main
72      artifacts: true
73  variables:
74    IMAGE: ubuntu2004
75    MAKE_CHECK_ARGS: check
76
77acceptance-system-ubuntu-main:
78  <<: *native_test_job_definition
79  needs:
80    - job: build-system-ubuntu-main
81      artifacts: true
82  variables:
83    IMAGE: ubuntu2004
84    MAKE_CHECK_ARGS: check-acceptance
85  <<: *post_acceptance
86
87build-system-fedora-alt:
88  <<: *native_build_job_definition
89  variables:
90    IMAGE: fedora
91    TARGETS: tricore-softmmu unicore32-softmmu microblaze-softmmu mips-softmmu
92      riscv32-softmmu s390x-softmmu sh4-softmmu sparc64-softmmu x86_64-softmmu
93      xtensa-softmmu nios2-softmmu or1k-softmmu
94    MAKE_CHECK_ARGS: check-build
95  artifacts:
96    paths:
97      - build
98
99check-system-fedora-alt:
100  <<: *native_test_job_definition
101  needs:
102    - job: build-system-fedora-alt
103      artifacts: true
104  variables:
105    IMAGE: fedora
106    MAKE_CHECK_ARGS: check
107
108acceptance-system-fedora-alt:
109  <<: *native_test_job_definition
110  needs:
111    - job: build-system-fedora-alt
112      artifacts: true
113  variables:
114    IMAGE: fedora
115    MAKE_CHECK_ARGS: check-acceptance
116  <<: *post_acceptance
117
118build-disabled:
119  <<: *native_build_job_definition
120  variables:
121    IMAGE: fedora
122    CONFIGURE_ARGS: --disable-rdma --disable-slirp --disable-curl
123      --disable-capstone --disable-live-block-migration --disable-glusterfs
124      --disable-replication --disable-coroutine-pool --disable-smartcard
125      --disable-guest-agent --disable-curses --disable-libxml2 --disable-tpm
126      --disable-qom-cast-debug --disable-spice --disable-vhost-vsock
127      --disable-vhost-net --disable-vhost-crypto --disable-vhost-user
128    TARGETS: i386-softmmu ppc64-softmmu mips64-softmmu i386-linux-user
129    MAKE_CHECK_ARGS: check-qtest SPEED=slow
130
131build-tcg-disabled:
132  <<: *native_build_job_definition
133  variables:
134    IMAGE: centos8
135  script:
136    - mkdir build
137    - cd build
138    - ../configure --disable-tcg --audio-drv-list=""
139    - make -j"$JOBS"
140    - make check-unit
141    - make check-qapi-schema
142    - cd tests/qemu-iotests/
143    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
144            052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
145            170 171 183 184 192 194 197 208 215 221 222 226 227 236 253 277
146    - ./check -qcow2 028 051 056 057 058 065 067 068 082 085 091 095 096 102 122
147            124 132 139 142 144 145 151 152 155 157 165 194 196 197 200 202
148            208 209 215 216 218 222 227 234 246 247 248 250 254 255 257 258
149            260 261 262 263 264 270 272 273 277 279
150
151build-user:
152  <<: *native_build_job_definition
153  variables:
154    IMAGE: debian-all-test-cross
155    CONFIGURE_ARGS: --disable-tools --disable-system
156    MAKE_CHECK_ARGS: check-tcg
157
158build-clang:
159  <<: *native_build_job_definition
160  variables:
161    IMAGE: fedora
162    CONFIGURE_ARGS: --cc=clang --cxx=clang++
163    TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu
164      ppc-softmmu s390x-softmmu arm-linux-user
165    MAKE_CHECK_ARGS: check
166
167build-oss-fuzz:
168  <<: *native_build_job_definition
169  variables:
170    IMAGE: fedora
171  script:
172    - mkdir build-oss-fuzz
173    - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
174      ./scripts/oss-fuzz/build.sh
175    - for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
176                      | grep -v slirp); do
177        grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
178        echo Testing ${fuzzer} ... ;
179        ASAN_OPTIONS="fast_unwind_on_malloc=0"
180         "${fuzzer}" -runs=1000 -seed=1 || exit 1 ;
181      done
182
183build-tci:
184  <<: *native_build_job_definition
185  variables:
186    IMAGE: fedora
187  script:
188    - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
189    - mkdir build
190    - cd build
191    - ../configure --enable-tcg-interpreter
192        --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
193    - make -j"$JOBS"
194    - make run-tcg-tests-x86_64-softmmu
195    - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
196    - for tg in $TARGETS ; do
197        export QTEST_QEMU_BINARY="${tg}-softmmu/qemu-system-${tg}" ;
198        ./tests/qtest/boot-serial-test || exit 1 ;
199        ./tests/qtest/cdrom-test || exit 1 ;
200      done
201    - QTEST_QEMU_BINARY="x86_64-softmmu/qemu-system-x86_64" ./tests/qtest/pxe-test
202    - QTEST_QEMU_BINARY="s390x-softmmu/qemu-system-s390x" ./tests/qtest/pxe-test -m slow
203