From a1c1b7d008a237c5694c75ebc387228f3dc646f3 Mon Sep 17 00:00:00 2001
From: bones_was_here <bones_was_here@xa.org.au>
Date: Tue, 22 Mar 2022 01:09:22 +1000
Subject: [PATCH] pipeline: merge test_sv_unit into test_sv_game

The test only takes a few seconds including engine startup,
most of the time was used in preparing the environment and
compiling the same binaries as used in test_sv_game.

Also removed a bashism for robustness.
---
 .gitlab-ci.yml | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 464693215e..89ac1ce360 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -33,15 +33,23 @@ test_sv_game:
     - make qc || exit 1
 
     - mkdir -p data/maps
+    - wget -O data/maps/gitlab-ci.bsp https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/_init/_init.bsp
+
+    - while read LINE; do
+        echo $LINE;
+        [ "$LINE" = "All tests OK" ] && PASS=1;
+      done < <(${ENGINE} +developer 1 +map gitlab-ci +sv_cmd runtest +wait +quit)
+    - test "$PASS" = "1" || { echo 'sv_cmd runtest failed!'; exit 1; }
+
+    - ${ENGINE} +map gitlab-ci +sv_cmd dumpnotifs +wait +quit
+    - diff notifications.cfg data/data/notifications_dump.cfg ||
+        { echo 'Please update notifications.cfg using `dumpnotifs`!'; exit 1; }
+
     - wget -O data/stormkeep.pk3 http://beta.xonotic.org/autobuild-bsp/latest/stormkeep.pk3
     - wget -O data/maps/stormkeep.mapinfo https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.mapinfo
     - wget -O data/maps/stormkeep.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints
     - wget -O data/maps/stormkeep.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints.cache
 
-    - ${ENGINE} +map stormkeep +dumpnotifs +wait +quit
-    - diff notifications.cfg data/data/notifications_dump.cfg ||
-        { echo 'Please update notifications.cfg using `dumpnotifs`!'; exit 1; }
-
     - EXPECT=d4060caf37a2e60bab68d1f83bc57368
     - HASH=$(${ENGINE} +timestamps 1 +exec serverbench.cfg
       | tee /dev/stderr
@@ -55,20 +63,6 @@ test_sv_game:
     - test "$HASH" == "$EXPECT"
     - exit $?
 
-test_sv_unit:
-  stage: test
-  script:
-    - git clone --depth=1 --branch=div0-stable https://gitlab.com/xonotic/darkplaces.git darkplaces
-    - cd darkplaces && make sv-release || exit 1
-    - export ENGINE="$PWD/darkplaces-dedicated -xonotic" && cd ..
-    - make qc || exit 1
-
-    - mkdir maps && wget -O maps/gitlab-ci.bsp https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/_init/_init.bsp
-    - while read line; do
-        echo $line;
-        if [[ $line == "All tests OK" ]]; then exit 0; fi;
-      done < <(${ENGINE} +developer 1 +map gitlab-ci +sv_cmd runtest +exit)
-    - exit 1
 
 # NOTE: The generated docs are incomplete - they don't contain code behind SVQC CSQC MENUQC GAMEQC ifdefs.
 # With them added to PREDEFINED, it would take over half an hour to generate the docs and even then
-- 
2.39.5