From 1d66595114e2e057e4cc6a6ef84ceaeacafe51e2 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Thu, 15 Aug 2019 19:35:53 +0100
Subject: [PATCH] Improve test coverage

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 .gitlab-ci.yml                   | 24 ++++++++++++++++++++++++
 debian/tests/control             |  2 ++
 debian/tests/relocatable-install | 24 ++++++++++++++++++++++++
 3 files changed, 50 insertions(+)
 create mode 100644 debian/tests/control
 create mode 100755 debian/tests/relocatable-install

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fd63f5ef6..3c667e62d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,22 @@
+include:
+    - project: 'steam/steam-ci-pipeline'
+      file: '/steam-gitlab-ci-common.yml'
+
+    - project: 'steam/steam-ci-pipeline'
+      file: '/steam-gitlab-ci-pipeline.yml'
+
 variables:
+    BUILD_IMAGE: docker.internal.steamos.cloud/steamrt/sdk:scout-latest
+    STEAM_CI_USE_BINARIES_FROM: autopkgtest
+    STEAM_CI_DEPENDENCIES: >-
+        debhelper
+        libglib2.0-dev
+        libxau-dev
+        meson
+        python3
+        python3.5
+        zlib1g
+
     DEBIAN_FRONTEND: noninteractive
 
     SCOUT_DOCKER_REGISTRY: docker.steamos.cloud
@@ -7,7 +25,12 @@ variables:
     DEVEL_DOCKER_REGISTRY: docker.steamos.cloud
     DEVEL_DOCKER_IMAGE: steamos/package-builder:buster
 
+build:
+    variables:
+        BUILD_IMAGE: docker.internal.steamos.cloud/steamos/package-builder:buster
+
 build:devel:
+    stage: build
     image: "${DEVEL_DOCKER_REGISTRY}/${DEVEL_DOCKER_IMAGE}"
     script:
         - |
@@ -25,6 +48,7 @@ build:devel:
             meson test --verbose -C _build
 
 build:scout:
+    stage: build
     image: "${SCOUT_DOCKER_REGISTRY}/${SCOUT_DOCKER_IMAGE}"
     script:
         - |
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 000000000..550f3cf37
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Tests: relocatable-install
+Restrictions: allow-stderr, needs-root
diff --git a/debian/tests/relocatable-install b/debian/tests/relocatable-install
new file mode 100755
index 000000000..6c3685bef
--- /dev/null
+++ b/debian/tests/relocatable-install
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+set -eux
+
+dpkg --add-architecture amd64
+dpkg --add-architecture i386
+apt-get -y install \
+    libcapsule-tools-relocatable:amd64 \
+    libcapsule-tools-relocatable:i386 \
+    ${NULL+}
+
+/usr/lib/pressure-vessel/relocatable/bin/pressure-vessel-build-relocatable-install \
+    --output "${AUTOPKGTEST_TMP}/relocatable-install" \
+    --archive "${AUTOPKGTEST_TMP}"
+
+./tests/relocatable-install.py "${AUTOPKGTEST_TMP}/relocatable-install"
+
+for archive in "${AUTOPKGTEST_TMP}"/*.tar.*; do
+    echo "==== $(basename "$archive") ===="
+    tar -tvf "$archive"
+done
+
+# TODO: When the coordinator can accept bigger artifacts, use
+# --archive=${AUTOPKGTEST_ARTIFACTS} instead
-- 
GitLab