From 096adbe369ab6e02c79c87e6730a87b4bc245d68 Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Wed, 10 Jun 2020 14:44:17 +0200 Subject: [PATCH] ci: bare-metal: use nginx to get results from DUT Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2655 Signed-off-by: Christian Gmeiner Reviewed-by: Eric Anholt Part-of: --- .gitlab-ci.yml | 4 ++-- .gitlab-ci/bare-metal/fastboot.sh | 17 ++++++++++++++++- .gitlab-ci/bare-metal/init.sh | 12 ++++++++++++ .gitlab-ci/bare-metal/nginx-default-site | 20 ++++++++++++++++++++ .gitlab-ci/container/arm_test-base.sh | 5 +++++ .gitlab-ci/create-rootfs.sh | 1 + docs/ci/bare-metal.rst | 14 +++++++++----- 7 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 .gitlab-ci/bare-metal/nginx-default-site diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ab224341985..498e1fd0589 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -336,7 +336,7 @@ arm_test-base: - .fdo.container-build@debian - .container variables: - FDO_DISTRIBUTION_TAG: &arm_test-base "2020-07-09-cache" + FDO_DISTRIBUTION_TAG: &arm_test-base "2020-07-18-nginx" .use-arm_test-base: extends: @@ -354,7 +354,7 @@ arm64_test: extends: - .use-arm_test-base variables: - FDO_DISTRIBUTION_TAG: &arm64_test "2020-07-09-cache" + FDO_DISTRIBUTION_TAG: &arm64_test "2020-07-18-nginx" .use-arm64_test: variables: diff --git a/.gitlab-ci/bare-metal/fastboot.sh b/.gitlab-ci/bare-metal/fastboot.sh index ad4a665055b..9adda125113 100755 --- a/.gitlab-ci/bare-metal/fastboot.sh +++ b/.gitlab-ci/bare-metal/fastboot.sh @@ -45,6 +45,13 @@ if [ -z "$BM_ROOTFS" ]; then exit 1 fi +if [ -z "$BM_WEBDAV_IP" -o -z "$BM_WEBDAV_PORT" ]; then + echo "BM_WEBDAV_IP and/or BM_WEBDAV_PORT is not set - no results will be uploaded from DUT!" + WEBDAV_CMDLINE="" +else + WEBDAV_CMDLINE="webdav=http://$BM_WEBDAV_IP:$BM_WEBDAV_PORT" +fi + set -ex # Clear out any previous run's artifacts. @@ -72,9 +79,17 @@ abootimg \ --create artifacts/fastboot.img \ -k Image.gz-dtb \ -r rootfs.cpio.gz \ - -c cmdline="$BM_CMDLINE" + -c cmdline="$BM_CMDLINE $WEBDAV_CMDLINE" rm Image.gz-dtb +# Start nginx to get results from DUT +if [ -n "$WEBDAV_CMDLINE" ]; then + ln -s `pwd`/results /results + sed -i s/80/$BM_WEBDAV_PORT/g /etc/nginx/sites-enabled/default + sed -i s/www-data/root/g /etc/nginx/nginx.conf + nginx +fi + # Start watching serial, and power up the device. if [ -n "$BM_SERIAL" ]; then $BM/serial-buffer.py $BM_SERIAL | tee artifacts/serial-output.txt & diff --git a/.gitlab-ci/bare-metal/init.sh b/.gitlab-ci/bare-metal/init.sh index 9dfef684977..00bee38a616 100755 --- a/.gitlab-ci/bare-metal/init.sh +++ b/.gitlab-ci/bare-metal/init.sh @@ -13,6 +13,18 @@ mount -t devpts devpts /dev/pts echo "nameserver 8.8.8.8" > /etc/resolv.conf if sh $BARE_METAL_TEST_SCRIPT; then + OK=1 +else + OK=0 +fi + +# upload artifacts via webdav +WEBDAV=$(cat /proc/cmdline | tr " " "\n" | grep webdav | cut -d '=' -f 2 || true) +if [ -n "$WEBDAV" ]; then + find /results -type f -exec curl -T {} $WEBDAV/{} \; +fi + +if [ $OK -eq 1 ]; then echo "bare-metal result: pass" else echo "bare-metal result: fail" diff --git a/.gitlab-ci/bare-metal/nginx-default-site b/.gitlab-ci/bare-metal/nginx-default-site new file mode 100644 index 00000000000..7c46fa21c2c --- /dev/null +++ b/.gitlab-ci/bare-metal/nginx-default-site @@ -0,0 +1,20 @@ +server { + listen 80 default_server; + listen [::]:80 default_server; + + server_name _; + + location / { + dav_methods PUT; + dav_ext_methods PROPFIND OPTIONS; + dav_access user:rw group:rw all:r; + + client_body_temp_path /tmp; + client_max_body_size 0; + create_full_put_path on; + + root /results; + + autoindex on; + } +} diff --git a/.gitlab-ci/container/arm_test-base.sh b/.gitlab-ci/container/arm_test-base.sh index 5f5be0464fe..9b3da12fbc5 100644 --- a/.gitlab-ci/container/arm_test-base.sh +++ b/.gitlab-ci/container/arm_test-base.sh @@ -24,6 +24,7 @@ apt-get install -y --no-remove \ flex \ git \ netcat \ + nginx-full \ python3-distutils \ python3-minimal \ python3-serial \ @@ -37,4 +38,8 @@ apt-get install -y --no-remove \ apt install -t buster-backports -y --no-remove \ meson +# setup nginx +sed -i '/gzip_/ s/#\ //g' /etc/nginx/nginx.conf +cp .gitlab-ci/bare-metal/nginx-default-site /etc/nginx/sites-enabled/default + . .gitlab-ci/container/container_post_build.sh diff --git a/.gitlab-ci/create-rootfs.sh b/.gitlab-ci/create-rootfs.sh index e9a2c787041..21c2844f73f 100644 --- a/.gitlab-ci/create-rootfs.sh +++ b/.gitlab-ci/create-rootfs.sh @@ -4,6 +4,7 @@ set -ex apt-get -y install --no-install-recommends \ ca-certificates \ + curl \ initramfs-tools \ libpng16-16 \ strace \ diff --git a/docs/ci/bare-metal.rst b/docs/ci/bare-metal.rst index b14e99585d2..800469eae2b 100644 --- a/docs/ci/bare-metal.rst +++ b/docs/ci/bare-metal.rst @@ -28,9 +28,8 @@ The boards need to be able to have a kernel/initramfs supplied by the gitlab-runner system, since the initramfs is what contains the Mesa testing payload. -The boards should have networking, so that (in a future iteration of -this code) we can extract the dEQP .xml results to artifacts on -gitlab. +The boards should have networking, so that we can extract the dEQP .xml +results to artifacts on gitlab. Requirements (servo) -------------------- @@ -104,8 +103,8 @@ We need privileged mode and the /dev bind mount in order to get at the serial console and fastboot USB devices (--device arguments don't apply to devices that show up after container start, which is the case with fastboot, and the servo serial devices are actually links to -/dev/pts). We use host network mode so that we can (in the future) -spin up a server to collect XML results for fastboot. +/dev/pts). We use host network mode so that we can spin up a nginx +server to collect XML results for fastboot. Once you've added your boards, you're going to need to add a little more customization in ``/etc/gitlab-runner/config.toml``. First, add @@ -119,5 +118,10 @@ required by your bare-metal script, something like:: name = "google-freedreno-db410c-1" environment = ["BM_SERIAL=/dev/ttyDB410c8", "BM_POWERUP=google-power-up.sh 8", "BM_FASTBOOT_SERIAL=15e9e390"] +If you want to collect the results for fastboot you need to add the following +two board-specific environment variables ``BM_WEBDAV_IP`` and ``BM_WEBDAV_PORT``. +These represent the IP address of the docker host and the board specific port number +that gets used to start a nginx server. + Once you've updated your runners' configs, restart with ``sudo service gitlab-runner restart`` -- 2.30.2