Skip to content

Commit dde21d2

Browse files
committed
testBackend: create_symlink specify full path
robustness on HPC
1 parent f15766c commit dde21d2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/TestBackend.m

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@
1111

1212
properties
1313
root = fileparts(fileparts(mfilename('fullpath')))
14+
wd
1415
end
1516

1617
methods(TestClassSetup)
1718
function test_dirs(tc)
18-
tc.applyFixture(matlab.unittest.fixtures.WorkingFolderFixture())
19+
fx = matlab.unittest.fixtures.WorkingFolderFixture();
20+
tc.wd = fx.Folder;
21+
tc.applyFixture(fx)
1922
end
2023
end
2124

@@ -24,7 +27,7 @@ function test_backend(tc)
2427
import matlab.unittest.constraints.IsSubsetOf
2528

2629

27-
readme = tc.root + "/Readme.md";
30+
readme = fullfile(tc.root, 'Readme.md');
2831
if stdlib.matlabOlderThan('R2018a')
2932
tc.assertTrue(isfile(readme))
3033
else
@@ -36,9 +39,11 @@ function test_backend(tc)
3639
tc.verifyGreaterThanOrEqual(i, 0)
3740
% some CI systems report 0
3841

39-
[i, b] = stdlib.create_symlink(readme, "Readme.lnk");
42+
% best to use full path to avoid issues on HPC etc.
43+
sym_fn = fullfile(tc.wd, 'Readme.lnk');
44+
[i, b] = stdlib.create_symlink(readme, sym_fn);
4045
tc.assertThat(b, IsSubsetOf(stdlib.Backend('create_symlink').backends))
41-
tc.verifyTrue(i, "backend " + b + " should have been available in Backend.backends()")
46+
tc.verifyTrue(i, "could not create_symlink " + sym_fn)
4247

4348
[i, b] = stdlib.device('.');
4449
tc.assertThat(b, IsSubsetOf(stdlib.Backend('device').backends))

0 commit comments

Comments
 (0)