From a41943e43eca0e60b7bebb4c669ad163600a2a77 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Fri, 31 Jul 2020 10:22:08 +0200
Subject: [PATCH] CI: Snake-case the CI file, add a really basic test

---
 .gitlab-ci.yml        | 44 +++++++++++++++++++++++++++----------------
 scripts/validate.bash | 19 ++++++++++++++++++-
 2 files changed, 46 insertions(+), 17 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 90ba2b60..fc01ebef 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,8 +1,9 @@
 stages:
-    - Initialization
-    - Configures
-    - Builds
-    - Finalization
+    - initialization
+    - configure
+    - build
+    - test
+    - finalization
 
 .main_tests: &main_tests
     tags:
@@ -18,16 +19,16 @@ stages:
 ### Initialization and Finalization #############
 #################################################
 
-Env Sanitize:
+env_sanitize:
     <<: *main_tests
-    stage: Initialization
+    stage: initialization
     script:
         - mkdir -p $HOME/$CI_PIPELINE_ID/{build.clang,build.gcc,install.clang,install.gcc}
         - echo "Env is intialized"
 
-Env Finalize:
+env_finalize:
     <<: *main_tests
-    stage: Finalization
+    stage: finalization
     allow_failure: true
     when: always
     script:
@@ -37,16 +38,16 @@ Env Finalize:
 ### Configures ##################################
 #################################################
 
-Configure with gcc:
+configure_gcc:
     <<: *main_tests
-    stage: Configures
+    stage: configure
     script:
         - cd $HOME/$CI_PIPELINE_ID/
         - scripts/validate.bash --compiler=clang --debug --static-modules --step=configure
 
-Configure with clang:
+configure_clang:
     <<: *main_tests
-    stage: Configures
+    stage: configure
     script:
         - cd $HOME/$CI_PIPELINE_ID/
         - scripts/validate.bash --compiler=clang --debug --static-modules --step=configure
@@ -55,16 +56,27 @@ Configure with clang:
 ### Builds ######################################
 #################################################
 
-Build with gcc:
+build_gcc:
     <<: *main_tests
-    stage: Builds
+    stage: build
     script:
         - cd $HOME/$CI_PIPELINE_ID/
         - scripts/validate.bash --compiler=gcc --step=build
 
-Build with clang:
+build_clang:
     <<: *main_tests
-    stage: Builds
+    stage: build
     script:
         - cd $HOME/$CI_PIPELINE_ID/build.clang
         - scripts/validate.bash --compiler=clang --step=build
+
+#################################################
+### Tests #######################################
+#################################################
+
+test_basic:
+    <<: *main_tests
+    stage: test
+    script:
+        - cd $HOME/$CI_PIPELINE_ID/build.clang
+        - scripts/validate.bash --compiler=clang --step=launch --test=simple
diff --git a/scripts/validate.bash b/scripts/validate.bash
index 12907fa7..996cab2a 100644
--- a/scripts/validate.bash
+++ b/scripts/validate.bash
@@ -15,6 +15,18 @@ LKT_CONFIGURE_OPTIONS=""    # Options to pass to the configure command
 LKT_CORE_NUMBER=4           # Number of cores to use with make
 LKT_TEST=""                 # Which tests to perform
 
+### AVAILABLE TESTS ##########################################################
+
+function test_simple ()
+{
+    check_cd $LKT_DIR/install.$LKT_COMPILER/
+    ./lektord &
+    local _child_pid=$!
+    ./lkt pwd=hashire adm kil
+    sleep 5
+    kill $_child_pid
+}
+
 ### Utility functions ########################################################
 function die ()
 {
@@ -121,7 +133,12 @@ function do_steps ()
 function do_launch ()
 {
     check_cd $LKT_DIR
-    die "No test available"
+    for test in $LKT_TEST ; do
+        case "$test" in
+            simple)     test_simple;;
+            *)          die "Test not available"
+        esac
+    done
 }
 
 ### PROCESS ARGS #############################################################
-- 
GitLab