# Define stages
stages:
    - test

# MATLABCMD: Command used to launch correct matlab version for tests, builds..
# TESTCASE: Input into matlab test script to choose which tests to run.
# GIT_SUBMODULE_STRATEGY: Way to handle gitlab submodules - Recurse into all submodules
# BUILD_DIR/TEST_DIR: Target directory for builds/tests
# CLEAN: Set 1 to force cleaning of target directories

variables: # default values
  MATLABCMD: "matlab960"
  TESTCASE: ""
  GIT_STRATEGY: none
  GIT_SUBMODULE_STRATEGY: none
  CLEAN: 0 
  TIMEOUT: "2h"


# TESTS
.test-template:
 stage: test
 tags:
 - scd
 before_script:
 - hostname && date
 - echo "Testing with $MATLABCMD, $TESTCASE"
 - chmod u+x ./test_script.sh
 script:
  # Call test script with timeout to kill it
  - timeout -s 9 $TIMEOUT ./test_script.sh $MATLABCMD $TESTCASE
 interruptible: true

unit-tests:
 extends: .test-template
 variables:
  TESTCASE: "unit"

template-tests:
 extends: .test-template
 variables:
  TESTCASE: "template"
