From b7e95e9dcc4547614724d2e0dc1812a3884e21ae Mon Sep 17 00:00:00 2001
From: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Date: Thu, 1 Oct 2020 15:45:09 -0400
Subject: [PATCH] Set up each test variation to exit with an error if it cant
 detect a GPU or if it expect not GPU and detects one.

---
 .gitlab-ci.yml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9e38e42e..d0a7214f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -38,6 +38,10 @@ test-nvidia-gpu:
   stage: test
   script:
     - clinfo
+    - PLATFORMS=$(clinfo | grep "Number of platforms" | sed "s/Number of platforms[[:space:]]*\([0-9]*\)[^0-9]*/\1/g")
+    - if [ $PLATFORMS == "0" ]; then
+        exit -1;
+      fi
     - mvn $MAVEN_CLI_OPTS test
   tags:
     - opencl
@@ -47,6 +51,9 @@ test-nvidia-cpu:
   stage: test
   script:
     - clinfo
+    - if [ $PLATFORMS != "0" ]; then
+        exit -1;
+      fi
     - mvn $MAVEN_CLI_OPTS test
   tags:
     - compute
@@ -56,6 +63,9 @@ test-amdgpu-cpu:
   stage: test
   script:
     - clinfo
+    - if [ $PLATFORMS != "0" ]; then
+        exit -1;
+      fi
     - mvn $MAVEN_CLI_OPTS test
   tags:
     - compute
@@ -65,6 +75,9 @@ test-pocl-gpu:
   stage: test
   script:
     - clinfo
+    - if [ $PLATFORMS == "0" ]; then
+        exit -1;
+      fi
     - mvn $MAVEN_CLI_OPTS test
   tags:
     - opencl
@@ -74,6 +87,9 @@ test-amdgpu-cpu:
   stage: test
   script:
     - clinfo
+    - if [ $PLATFORMS != "0" ]; then
+        exit -1;
+      fi
     - mvn $MAVEN_CLI_OPTS test
   tags:
     - compute
-- 
GitLab