ci/bare-metal: Fix capturing of serial output as job artifacts.
[mesa.git] / .gitlab-ci / bare-metal / cros-servo.sh
index 0b978df73a36f8c5bbbf5d0541300555d3c25b64..b05eaec50ec31dc512105dccacca42a8b8dd05aa 100755 (executable)
@@ -4,7 +4,7 @@
 # NFS and TFTP to boot.
 
 # We're run from the root of the repo, make a helper var for our paths
-BM=$CI_PROJECT_DIR/.gitlab-ci/bare-metal
+BM=$CI_PROJECT_DIR/install/bare-metal
 
 # Runner config checks
 if [ -z "$BM_SERIAL" ]; then
@@ -47,6 +47,10 @@ fi
 
 set -ex
 
+# Clear out any previous run's artifacts.
+rm -rf results/
+mkdir -p results
+
 # Create the rootfs in the NFS directory.  rm to make sure it's in a pristine
 # state, since it's volume-mounted on the host.
 rsync -a --delete $BM_ROOTFS/ /nfs/
@@ -59,39 +63,15 @@ rm -rf /tftp/*
 cp $BM_KERNEL /tftp/vmlinuz
 echo "$BM_CMDLINE" > /tftp/cmdline
 
-# Start watching serials, and power up the device.
-$BM/serial-buffer.py $BM_SERIAL_EC | tee serial-ec-output.txt | sed -u 's|^|SERIAL-EC> |g' &
-$BM/serial-buffer.py $BM_SERIAL | tee serial-output.txt | sed -u 's|^|SERIAL-CPU> |g'  &
-while [ ! -e serial-output.txt ]; do
-  sleep 1
-done
-# Flush any partial commands in the EC's prompt, then ask for a reboot.
-$BM/write-serial.py $BM_SERIAL_EC ""
-$BM/write-serial.py $BM_SERIAL_EC reboot
-
-# This is emitted right when the bootloader pauses to check for input.  Emit a
-# ^N character to request network boot, because we don't have a
-# direct-to-netboot firmware on cheza.
-$BM/expect-output.sh serial-output.txt -f "load_archive: loading locale_en.bin"
-$BM/write-serial.py $BM_SERIAL `printf '\016'`
-
-# Wait for the device to complete the deqp run
-$BM/expect-output.sh serial-output.txt -f "DEQP RESULT"
-
-# power down the CPU on the device
-$BM/write-serial.py $BM_SERIAL_EC 'power off'
-
-set -ex
+set +e
+python3 $BM/cros_servo_run.py \
+        --cpu $BM_SERIAL \
+        --ec $BM_SERIAL_EC
+ret=$?
+set -e
 
 # Bring artifacts back from the NFS dir to the build dir where gitlab-runner
-# will look for them.  Note that results/ may already exist, so be careful
-# with cp.
-mkdir -p results
+# will look for them.
 cp -Rp /nfs/results/. results/
 
-set +e
-if grep -q "DEQP RESULT: pass" serial-output.txt; then
-   exit 0
-else
-   exit 1
-fi
+exit $ret