ci: Enable --compact-display false on all dEQP runs.
[mesa.git] / .gitlab-ci / bare-metal / fastboot.sh
1 #!/bin/bash
2
3 BM=$CI_PROJECT_DIR/.gitlab-ci/bare-metal
4
5 if [ -z "$BM_SERIAL" ]; then
6 echo "Must set BM_SERIAL in your gitlab-runner config.toml [[runners]] environment"
7 echo "This is the serial device to talk to for waiting for fastboot to be ready and logging from the kernel."
8 exit 1
9 fi
10
11 if [ -z "$BM_POWERUP" ]; then
12 echo "Must set BM_POWERUP in your gitlab-runner config.toml [[runners]] environment"
13 echo "This is a shell script that should reset the device and begin its boot sequence"
14 echo "such that it pauses at fastboot."
15 exit 1
16 fi
17
18 if [ -z "$BM_FASTBOOT_SERIAL" ]; then
19 echo "Must set BM_FASTBOOT_SERIAL in your gitlab-runner config.toml [[runners]] environment"
20 echo "This must be the a stable-across-resets fastboot serial number."
21 exit 1
22 fi
23
24 if [ -z "$BM_KERNEL" ]; then
25 echo "Must set BM_KERNEL to your board's kernel vmlinuz or Image.gz in the job's variables:"
26 exit 1
27 fi
28
29 if [ -z "$BM_DTB" ]; then
30 echo "Must set BM_DTB to your board's DTB file in the job's variables:"
31 exit 1
32 fi
33
34 if [ -z "$BM_ROOTFS" ]; then
35 echo "Must set BM_ROOTFS to your board's rootfs directory in the job's variables:"
36 exit 1
37 fi
38
39 set -ex
40
41 # Copy the rootfs to a temporary for our setup, as I believe changes to the
42 # container can end up impacting future runs.
43 cp -Rp $BM_ROOTFS rootfs
44
45 # Set up the init script that brings up the system.
46 cp $BM/init.sh rootfs/init
47 sed -i "s|DEQP_VER_REPLACE|$DEQP_VER|g" rootfs/init
48 sed -i "s|DEQP_PARALLEL_REPLACE|$DEQP_PARALLEL|g" rootfs/init
49 sed -i "s|CI_NODE_INDEX_REPLACE|$CI_NODE_INDEX|g" rootfs/init
50 sed -i "s|CI_NODE_TOTAL_REPLACE|$CI_NODE_TOTAL|g" rootfs/init
51
52 # Add the Mesa drivers we built, and make a consistent symlink to them.
53 mkdir -p rootfs/$CI_PROJECT_DIR
54 tar -C rootfs/$CI_PROJECT_DIR/ -xf $CI_PROJECT_DIR/artifacts/install.tar
55 ln -sf $CI_PROJECT_DIR/install rootfs/install
56
57 # Copy the deqp runner script and metadata.
58 cp .gitlab-ci/deqp-runner.sh rootfs/deqp/.
59 cp .gitlab-ci/$DEQP_SKIPS rootfs/$CI_PROJECT_DIR/install/deqp-skips.txt
60 if [ -n "$DEQP_EXPECTED_FAILS" ]; then
61 cp .gitlab-ci/$DEQP_EXPECTED_FAILS rootfs/$CI_PROJECT_DIR/install/deqp-expected-fails.txt
62 fi
63
64 # Finally, pack it up into a cpio rootfs.
65 pushd rootfs
66 find -H | cpio -H newc -o | xz --check=crc32 -T4 - > $CI_PROJECT_DIR/rootfs.cpio.gz
67 popd
68
69 cat $BM_KERNEL $BM_DTB > Image.gz-dtb
70
71 abootimg \
72 --create artifacts/fastboot.img \
73 -k Image.gz-dtb \
74 -r rootfs.cpio.gz \
75 -c cmdline="$BM_CMDLINE"
76 rm Image.gz-dtb
77
78 # Start watching serial, and power up the device.
79 $BM/serial-buffer.py $BM_SERIAL | tee artifacts/serial-output.txt &
80 while [ ! -e artifacts/serial-output.txt ]; do
81 sleep 1
82 done
83 PATH=$BM:$PATH $BM_POWERUP
84
85 # Once fastboot is ready, boot our image.
86 $BM/expect-output.sh artifacts/serial-output.txt "fastboot: processing commands"
87 fastboot boot -s $BM_FASTBOOT_SERIAL artifacts/fastboot.img
88
89 # Wait for the device to complete the deqp run
90 $BM/expect-output.sh artifacts/serial-output.txt "DEQP RESULT"
91
92 set +e
93 if grep -q "DEQP RESULT: pass" artifacts/serial-output.txt; then
94 exit 0
95 else
96 exit 1
97 fi
98