diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7b4b35d4c37fbe91717448d7b397df9b75295e7d..2eb7cc055286814d0c4d421045f23432b1dcce08 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,18 @@
 image: hpclib/hiepacs
 
+.test_starpu_cuda_mpi_template: &test_starpu_cuda_mpi_def
+  stage: test
+  script:
+    - (cd build &&
+       ctest --no-compress-output -V
+             ${TESTS_RESTRICTION}
+             -D ExperimentalTest
+             -D ExperimentalCoverage
+             -D ExperimentalSubmit
+             | tee -a ../chameleon-build-starpu.log)
+    - lcov --directory build --capture --output-file chameleon_starpu_mpi.lcov
+
+
 stages:
   - build
   - test
@@ -33,6 +46,7 @@ build_starpu_cuda_mpi:
        rm install/ -r)
 
 test_starpu_cuda_mpi:
+  <<: *test_starpu_cuda_mpi_def
   stage: test
   dependencies:
     - build_starpu_cuda_mpi
@@ -43,15 +57,8 @@ test_starpu_cuda_mpi:
       - build
       - chameleon-build-starpu.log
       - chameleon_starpu_mpi.lcov
-  script:
-    - (cd build &&
-       ctest --no-compress-output -V
-             -R "test_shm_s|mpi_s"
-             -D ExperimentalTest
-             -D ExperimentalCoverage
-             -D ExperimentalSubmit
-             | tee -a ../chameleon-build-starpu.log)
-    - lcov --directory build --capture --output-file chameleon_starpu_mpi.lcov
+  variables:
+     TESTS_RESTRICTION: "-R \"test_shm_s|mpi_s\""
 
 build_starpu_simgrid:
   stage: build