Skip to content

Commit 33b2fed

Browse files
committed
ci: some systems block Cwd changes (windows-2025 GA)
1 parent 1ddc8b4 commit 33b2fed

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

test/TestDisk.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
TestDisk < matlab.unittest.TestCase
33

44
properties
5-
CI = getenv("CI") == "true" || getenv("GITHUB_ACTIONS") == "true"
5+
CI = is_ci()
66
end
77

88
properties (TestParameter)

test/TestSubprocess.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
classdef (TestTags = {'R2019b'}) ...
22
TestSubprocess < matlab.unittest.TestCase
33

4+
properties
5+
CI = is_ci()
6+
end
7+
48
properties (TestParameter)
59
lang_out = {"c", "fortran"}
610
lang_in = {"cpp", "fortran"}
@@ -35,7 +39,10 @@ function test_cwd(tc)
3539

3640
[s, mc] = stdlib.subprocess_run(c, 'cwd', matlabroot, 'echo', cmd_echo);
3741
tc.assertEqual(s, 0, "status non-zero")
38-
tc.verifyNotEqual(m, mc, "expected different directory to have different contents")
42+
43+
tc.assumeFalse(strcmp(m, mc) && tc.CI, "Some CI block cwd changes")
44+
45+
tc.verifyNotEqual(m, mc, sprintf('same directories: CI %d', tc.CI))
3946

4047
end
4148

test/private/is_ci.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function ok = is_ci()
2+
3+
ok = getenv("CI") == "true" || getenv("GITHUB_ACTIONS") == "true";
4+
5+
end

test_main.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ function test_main(context, sel)
2222
suite = testsuite(test_root, 'Tag', tags, 'InvalidFileFoundAction', "error");
2323
end
2424

25+
if ~has_dotnet()
26+
sel = sel & ~matlab.unittest.selectors.HasParameter('Value', 'dotnet');
27+
end
28+
2529
% selectIf takes the subset of suite tests that meet "sel" conditions
2630
suite = suite.selectIf(sel);
2731

@@ -42,5 +46,15 @@ function test_main(context, sel)
4246

4347
fprintf("%d / %d tests succeeded\n", Lok, Lt);
4448

49+
end
50+
51+
52+
function y = has_dotnet()
53+
54+
try
55+
y = NET.isNETSupported;
56+
catch
57+
y = false;
58+
end
4559

4660
end

0 commit comments

Comments
 (0)