← Back to team overview

canonical-hw-cert team mailing list archive

[Merge] hwcert-jenkins-jobs:add-mir-ci-runs into hwcert-jenkins-jobs:master

 

Michał Sawicz has proposed merging hwcert-jenkins-jobs:add-mir-ci-runs into hwcert-jenkins-jobs:master.

Requested reviews:
  hwcert-jenkins (hwcert-jenkins)

For more details, see:
https://code.launchpad.net/~hwcert-jenkins/hwcert-jenkins-jobs/+git/hwcert-jenkins-jobs/+merge/440765

This adds new integration tests running as part of the Mir test suite.
-- 
Your team hwcert-jenkins is requested to review the proposed merge of hwcert-jenkins-jobs:add-mir-ci-runs into hwcert-jenkins-jobs:master.
diff --git a/jobs/mir/projects/beta-22.yaml b/jobs/mir/projects/beta-22.yaml
index 9280bbf..4ba3817 100644
--- a/jobs/mir/projects/beta-22.yaml
+++ b/jobs/mir/projects/beta-22.yaml
@@ -4,6 +4,7 @@
     queue: intel-gfx
     series: focal
     image: focal
+    ppas: mir-team/rc
     snap: mir-test-tools
     track: 22
     channel: beta
@@ -15,7 +16,8 @@
     queue: 201405-15065
     snap: mir-test-tools
     # The hardware isn't supported by newer drivers
-    gfx_drivers: --no-install-recommends libgles2 nvidia-driver-470
+    gfx_drivers: &nvidia-470 |
+        --no-install-recommends libgles2 nvidia-driver-470 mir-graphics-drivers-nvidia
     gfx_setup: &nvidia-setup |
         echo 'GRUB_CMDLINE_LINUX_DEFAULT="nvidia-drm.modeset=1"' |sudo tee /etc/default/grub.d/99-nvidia.cfg
                 sudo update-grub
@@ -31,7 +33,8 @@
     snap: nvidia-core22
     track: "latest"
     # The version number here needs to correspond to nvidia-core22
-    gfx_drivers: --no-install-recommends libgles2 nvidia-driver-515
+    gfx_drivers: &nvidia-515 |
+        --no-install-recommends libgles2 nvidia-driver-515 mir-graphics-drivers-nvidia
     gfx_setup: *nvidia-setup
 - project:
     <<: *focal
@@ -52,6 +55,7 @@
     queue: intel-gfx
     series: jammy
     image: jammy
+    ppas: mir-team/rc
     snap: mir-test-tools
     track: 22
     channel: beta
@@ -63,7 +67,7 @@
     queue: 201405-15065
     snap: mir-test-tools
     # The hardware isn't supported by newer drivers
-    gfx_drivers: --no-install-recommends libgles2 nvidia-driver-470
+    gfx_drivers: *nvidia-470
     gfx_setup: *nvidia-setup
 - project:
     <<: *jammy-nvidia-470
@@ -77,7 +81,7 @@
     snap: nvidia-core22
     track: "latest"
     # The version number here needs to correspond to nvidia-core22
-    gfx_drivers: --no-install-recommends libgles2 nvidia-driver-515
+    gfx_drivers: *nvidia-515
     gfx_setup: *nvidia-setup
 - project:
     <<: *jammy
diff --git a/jobs/mir/projects/candidate-22.yaml b/jobs/mir/projects/candidate-22.yaml
index 4294485..d4ec512 100644
--- a/jobs/mir/projects/candidate-22.yaml
+++ b/jobs/mir/projects/candidate-22.yaml
@@ -4,6 +4,7 @@
     queue: intel-gfx
     series: focal
     image: focal
+    ppas: mir-team/rc
     snap: mir-test-tools
     track: 22
     channel: candidate
@@ -15,7 +16,8 @@
     queue: 201405-15065
     snap: mir-test-tools
     # The hardware isn't supported by newer drivers
-    gfx_drivers: --no-install-recommends libgles2 nvidia-driver-470
+    gfx_drivers: &nvidia-470 |
+        --no-install-recommends libgles2 nvidia-driver-470 mir-graphics-drivers-nvidia
     gfx_setup: &nvidia-setup |
         echo 'GRUB_CMDLINE_LINUX_DEFAULT="nvidia-drm.modeset=1"' |sudo tee /etc/default/grub.d/99-nvidia.cfg
                 sudo update-grub
@@ -31,7 +33,8 @@
     snap: nvidia-core22
     track: "latest"
     # The version number here needs to correspond to nvidia-core22
-    gfx_drivers: --no-install-recommends libgles2 nvidia-driver-515
+    gfx_drivers: &nvidia-515 |
+        --no-install-recommends libgles2 nvidia-driver-515 mir-graphics-drivers-nvidia
     gfx_setup: *nvidia-setup
 - project:
     <<: *focal
@@ -52,6 +55,7 @@
     queue: intel-gfx
     series: jammy
     image: jammy
+    ppas: mir-team/rc
     snap: mir-test-tools
     track: 22
     channel: candidate
@@ -63,7 +67,7 @@
     queue: 201405-15065
     snap: mir-test-tools
     # The hardware isn't supported by newer drivers
-    gfx_drivers: --no-install-recommends libgles2 nvidia-driver-470
+    gfx_drivers: *nvidia-470
     gfx_setup: *nvidia-setup
 - project:
     <<: *jammy-nvidia-470
@@ -77,7 +81,7 @@
     snap: nvidia-core22
     track: "latest"
     # The version number here needs to correspond to nvidia-core22
-    gfx_drivers: --no-install-recommends libgles2 nvidia-driver-515
+    gfx_drivers: *nvidia-515
     gfx_setup: *nvidia-setup
 - project:
     <<: *jammy
diff --git a/jobs/mir/projects/edge-22.yaml b/jobs/mir/projects/edge-22.yaml
index fe4d340..5578dd8 100644
--- a/jobs/mir/projects/edge-22.yaml
+++ b/jobs/mir/projects/edge-22.yaml
@@ -4,6 +4,7 @@
     queue: intel-gfx
     series: focal
     image: focal
+    ppas: mir-team/dev
     snap: mir-test-tools
     track: 22
     channel: edge
@@ -15,7 +16,7 @@
     queue: 201405-15065
     snap: mir-test-tools
     # The hardware isn't supported by newer drivers
-    gfx_drivers: --no-install-recommends libgles2 nvidia-driver-470
+    gfx_drivers: --no-install-recommends libgles2 nvidia-driver-470 mir-graphics-drivers-nvidia
     gfx_setup: &nvidia-setup |
         echo 'GRUB_CMDLINE_LINUX_DEFAULT="nvidia-drm.modeset=1"' |sudo tee /etc/default/grub.d/99-nvidia.cfg
                 sudo update-grub
@@ -32,6 +33,7 @@
     queue: intel-gfx
     series: jammy
     image: jammy
+    ppas: mir-team/dev
     snap: mir-test-tools
     track: 22
     channel: edge
@@ -42,7 +44,7 @@
     name: jammy-mir-22-edge-nvidia-gfx
     queue: 202008-28167
     snap: mir-test-tools
-    gfx_drivers: --no-install-recommends libgles2 nvidia-driver-515
+    gfx_drivers: --no-install-recommends libgles2 nvidia-driver-515 mir-graphics-drivers-nvidia
     gfx_setup: *nvidia-setup
 - project:
     <<: *jammy
diff --git a/jobs/mir/run-core-mir-track.sh b/jobs/mir/run-core-mir-track.sh
index b626629..1fe4e58 100644
--- a/jobs/mir/run-core-mir-track.sh
+++ b/jobs/mir/run-core-mir-track.sh
@@ -106,7 +106,8 @@ cat > job.yaml <<EOF
             _run_retry sudo "snap \$( _run snap list {snap} >&2 && echo refresh --ignore-validation || echo install ) {snap} --channel={track}/{channel} --no-wait {extra_args}"
             _run_retry sudo snap install mir-test-tools --channel={mir-base}/{channel} --no-wait
         else
-            _run_retry sudo "snap \$( _run snap list {snap} >&2 && echo refresh --ignore-validation || echo install ) {snap} --channel={track}/{channel} --no-wait {extra_args}"
+            # **Do** wait, in case it's a graphics-core22 provider snap. Otherwise the default provider would get installed.
+            _run_retry sudo "snap \$( _run snap list {snap} >&2 && echo refresh --ignore-validation || echo install ) {snap} --channel={track}/{channel} {extra_args}"
             _run_retry sudo snap install mir-test-tools --channel={mir-base}/stable --no-wait
         fi
         wait_for_snap_complete
@@ -115,19 +116,7 @@ cat > job.yaml <<EOF
             true; {gfx-setup}
         fi
 
-        if [ '{mir-base}' == 22 ]; then
-            # temporary, until the auto-connects are in place
-            # https://forum.snapcraft.io/t/global-auto-connect-request-mesa-core22-graphics-core22/34455
-            if [ '{snap}' == nvidia-core22 ]; then
-                _run sudo snap disconnect mir-test-tools:graphics-core22
-                _run sudo snap connect mir-test-tools:graphics-core22 nvidia-core22
-            else
-                _run sudo snap connect mir-test-tools:graphics-core22 mesa-core22
-                _run sudo snap connect {snap}:graphics-core22 mesa-core22 || true
-            fi
-        fi
-
-        if [ "{snap}" == "mir-kiosk" -o "{snap}" == "ubuntu-frame" ]; then
+        if [ "{snap}" == "ubuntu-frame" ]; then
             TEST_ENV=(MIR_SERVER_WAYLAND_HOST=wayland-0)
             if ! _run sudo timeout 30 sh -c '"while ! [ -S /run/user/0/wayland-0 ]; do sleep 5; done"'; then
                 echo "ERROR: {snap} did not come up"
diff --git a/jobs/mir/run-mir-track.sh b/jobs/mir/run-mir-track.sh
index af5df68..0f2ddcd 100644
--- a/jobs/mir/run-mir-track.sh
+++ b/jobs/mir/run-mir-track.sh
@@ -80,7 +80,7 @@ cat > job.yaml <<EOF
         for ppa in {ppas}; do
           sudo add-apt-repository -y --update ppa:\\\$ppa
         done
-        [ -n '{gfx_drivers}' ] && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y {gfx_drivers}
+        sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3-pip {gfx_drivers}
         {gfx_setup}
 
         if [ '{snap}' == 'mir-test-tools' ]; then
@@ -93,22 +93,22 @@ cat > job.yaml <<EOF
             sudo snap install mir-test-tools --channel {mir-base}/stable
         fi
 
-        if [ '{mir-base}' == 22 ]; then
-            # temporary, until the auto-connects are in place
-            # https://forum.snapcraft.io/t/global-auto-connect-request-mesa-core22-graphics-core22/34455
-            if [ '{snap}' == nvidia-core22 ]; then
-                sudo snap connect mir-test-tools:graphics-core22 nvidia-core22
-            else
-                sudo snap connect mir-test-tools:graphics-core22 mesa-core22
-                sudo snap connect {snap}:graphics-core22 mesa-core22 || true
-            fi
-        fi
-
         sudo snap connect mir-test-tools:login-session-control
         sudo snap disconnect mir-test-tools:x11
         if [ '{snap}' == 'ubuntu-frame' ]; then
             sudo snap connect {snap}:login-session-control
         fi
+        [ -x /snap/{snap}/current/bin/setup.sh ] && /snap/{snap}/current/bin/setup.sh
+
+        git clone https://github.com/MirServer/mir-ci.git --depth 1
+        TEST_ARGS=( -v -m {suite} )
+        if [[ '{snap}' == 'ubuntu-frame' ]]; then
+            TEST_ARGS+=( -k ubuntu_frame )
+        else
+            TEST_ARGS+=( -k mir_demo_server )
+        fi
+        pip install -r mir-ci/frame/requirements.txt
+        (cd mir-ci/frame; python3 -m pytest -v --deps "\\\${{TEST_ARGS[@]}}")
 
         cat << EOF > override.conf
         [Service]
@@ -123,13 +123,15 @@ cat > job.yaml <<EOF
           set -x
           exec &> /tmp/mir-bashrc.log
 
-          if [ ! -f /tmp/mir-done ]; then
+          if [ ! -f /tmp/mir-done ] && [ ! -f /tmp/mir-running ]; then
+            touch /tmp/mir-running
             loginctl activate
 
             if [ '{snap}' == 'ubuntu-frame' ]; then
               echo "Spawning {snap}..."
               TEST_ENV=(MIR_SERVER_WAYLAND_HOST=wayland-0)
               {snap} &> /tmp/{snap}.log &
+              SERVER_PID=\\\\\\\$!
               if ! timeout 10 sh -c "until [ -S \\\\\\\$XDG_RUNTIME_DIR/wayland-0 ]; do sleep 1; done"; then
                 echo "ERROR {snap} failed to create its socket." | tee -a /tmp/{snap}.log
                 touch /tmp/mir-done
@@ -141,10 +143,24 @@ cat > job.yaml <<EOF
             echo "Starting tests..."
             (env "\\\\\\\${{TEST_ENV[@]}}" mir-test-tools.{suite}-test --gtest_filter={filter} --gtest_output=xml:snap/mir-test-tools/current/mir.xml && echo "OUTCOME: PASS" || echo "OUTCOME: FAIL") &> /tmp/mir.log
 
+            if [ -n "\\\\\\\${{SERVER_PID}}" ]; then
+              kill \\\\\\\${{SERVER_PID}}
+              if ! timeout 10 tail --pid=\\\\\\\${{SERVER_PID}} -f /dev/null; then
+                echo "Server refused to stop." | tee -a /tmp/{snap}.log
+                kill -9 \\\\\\\${{SERVER_PID}}
+                if ! timeout 10 tail --pid=\\\\\\\${{SERVER_PID}} -f /dev/null; then
+                  echo "Server refused to die." | tee -a /tmp/{snap}.log
+                  touch /tmp/mir-done
+                  exit 2
+                fi
+              fi
+            fi
+
+            echo "Starting mir-ci tests..."
+            (cd mir-ci/frame; python3 -m pytest \\\${{TEST_ARGS[@]}} --junitxml=/tmp/mir-ci.xml && echo "OUTCOME: PASS" || echo "OUTCOME: FAIL") &>> /tmp/mir.log
+
             echo "Tests done."
             touch /tmp/mir-done
-
-            pkill miral-kiosk
           fi
         fi
         EOF
@@ -174,8 +190,9 @@ cat > job.yaml <<EOF
         _get /tmp/{snap}.log artifacts
         _get /tmp/mir-bashrc.log artifacts
         _get snap/mir-test-tools/current/mir.xml artifacts
+        _get /tmp/mir-ci.xml artifacts
         _get snap/mir-test-tools/current/*.log artifacts
-        grep -q "OUTCOME: PASS" artifacts/mir.log || exit 1
+        [ \$( grep -c "^OUTCOME: PASS" artifacts/mir.log ) -eq 2 ]
 EOF
 #Remove previous venv
 rm -rf env
@@ -205,4 +222,4 @@ set -x
 mkdir -p artifacts
 echo Jenkins build details: $BUILD_URL > artifacts/summary
 echo "Test exit status: $TEST_STATUS"
-grep -q "OUTCOME: PASS" artifacts/mir.log || exit 1
+exit $TEST_STATUS

Follow ups