From f94562858bab6627c939dfeaa58562724ab18888 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Thu, 22 Aug 2024 16:18:50 +0200
Subject: [PATCH] add cd in test

---
 .gitlab-ci.yml                   |  3 ---
 matlab/tests/test_requestnames.m | 10 +++++++++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c7e23169..24877d89 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -76,9 +76,6 @@ deploy:
 # test post-deploy
 test-post-deploy-matlab-9.2.0_tcv:
   extends: .test-post-deploy-template
-  script:
-  - export
-  - mkdir -f /tmp/$USER; cd /tmp/$USER
   variables:
     MATLABCMD: matlab920
 
diff --git a/matlab/tests/test_requestnames.m b/matlab/tests/test_requestnames.m
index 557144cc..6afae507 100644
--- a/matlab/tests/test_requestnames.m
+++ b/matlab/tests/test_requestnames.m
@@ -16,9 +16,17 @@ classdef (SharedTestFixtures={...
   methods(Static)
     function test_gdat_call(testCase,shot,request)
       % actual function to test gdat call
+      import matlab.unittest.fixtures.WorkingFolderFixture;
+
       testCase.assertTrue(isnumeric(str2double(shot)));
       testCase.assertTrue(ischar(request));
-
+      pwd
+      dirname_for_test = sprintf('/tmp/%s/gdat',getenv('USER')); % to have write permission
+      [dummy1,dummy2]=rmdir(dirname_for_test,'s');
+      mkdir(dirname_for_test);
+      f = WorkingFolderFixture(dirname_for_test);
+      testCase.applyFixture(f);
+      pwd
       % gdat call
       gdat_call = sprintf(['gdat_' lower(testCase.Machine) '(%s,''%s'')'],shot,request);
       do_gdat_call = 1;
-- 
GitLab