Skip to content

Commit 28f3a88

Browse files
committed
remove MEX as native/sys always available
users would rather not bother with MEX. It could be restored in the future.
1 parent 3f1387f commit 28f3a88

File tree

8 files changed

+64
-104
lines changed

8 files changed

+64
-104
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ jobs:
5151
with:
5252
command: stdlib.platform_tell()
5353

54-
- name: Non-MEX tests
54+
- name: Main Tests
5555
uses: ./.github/workflows/composite-nomex
5656

57-
- name: Mex & Exe Test (>= R2024b)
58-
if: ${{ matrix.release >= 'R2024b' }}
59-
uses: matlab-actions/run-build@v2
60-
with:
61-
startup-options: -logfile ${{ matrix.release }}-${{ runner.os }}-test.log
62-
tasks: test:mex test:exe
57+
# - name: Mex & Exe Test (>= R2024b)
58+
# if: ${{ matrix.release >= 'R2024b' }}
59+
# uses: matlab-actions/run-build@v2
60+
# with:
61+
# startup-options: -logfile ${{ matrix.release }}-${{ runner.os }}-test.log
62+
# tasks: test:mex test:exe
6363

6464
- name: Exe Test (legacy)
6565
if: ${{ matrix.release >= 'R2023a' && matrix.release < 'R2024b' }}
@@ -95,7 +95,7 @@ jobs:
9595
with:
9696
command: stdlib.platform_tell()
9797

98-
- name: Non-MEX tests
98+
- name: Main Tests
9999
uses: ./.github/workflows/composite-nomex
100100

101101
- name: Exe Test (legacy)
@@ -130,5 +130,5 @@ jobs:
130130
with:
131131
command: stdlib.platform_tell()
132132

133-
- name: Non-MEX tests
133+
- name: Main Tests
134134
uses: ./.github/workflows/composite-nomex

.github/workflows/composite-nomex/action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ runs:
66

77
steps:
88

9-
- name: Non-Mex Test
9+
- name: Main Tests
1010
if: ${{ matrix.release >= 'R2024b' }}
1111
uses: matlab-actions/run-build@v2
1212
with:
1313
startup-options: ${{ matrix.startup-options }}
14-
tasks: test:nomex
14+
tasks: test:main
1515

1616

17-
- name: Non-Mex Test (< R2024b)
17+
- name: Main Tests (< R2024b)
1818
if: ${{ matrix.release >= 'R2022b' && matrix.release < 'R2024b' }}
1919
uses: matlab-actions/run-build@v2
2020
with:
2121
startup-options: ${{ matrix.startup-options }}
22-
tasks: test_nomex
22+
tasks: test_main
2323

2424

2525
- name: Java Test
@@ -44,9 +44,9 @@ runs:
4444
if: ${{ matrix.release < 'R2022b' }}
4545
uses: matlab-actions/run-command@v2
4646
with:
47-
command: run('test/test_nomex.m')
47+
command: run('test/test_main.m')
4848
startup-options: -logfile ${{ matrix.release }}-${{ runner.os }}-test.log
49-
# test/test_nomex.m adds path internally
49+
# test/test_main.m adds path internally
5050

5151
- name: upload logfile
5252
if: ${{ hashFiles(matrix.release-runner.os-test.log) != '' }}

Readme.md

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,40 +27,19 @@ Matlab R2024b and newer:
2727
buildtool test
2828
```
2929

30-
Matlab R2023a..R2024a, inclusive:
30+
Matlab R2022b..R2024a, inclusive:
3131

3232
```matlab
33-
buildtool test_nomex
34-
buildtool test_java
35-
buildtool test_exe
36-
buildtool test_mex
37-
```
38-
39-
Matlab R2022b:
40-
41-
```matlab
42-
buildtool test_nomex
33+
buildtool test_main
4334
buildtool test_java
4435
```
4536

4637
Matlab older than R2022b:
4738

4839
```matlab
49-
run('test/test_nomex.m')
40+
run('test/test_main.m')
5041
```
5142

52-
## MEX functions
53-
54-
With Matlab R2023a and newer, optionally build high-performance
55-
[MEX](https://www.mathworks.com/help/matlab/cpp-mex-file-applications.html)
56-
functions (the same functions are provided by default without MEX) from the Matlab prompt in Matlab R2023a or newer:
57-
58-
```matlab
59-
buildtool mex
60-
```
61-
62-
If just building MEX functions for the first time, to ensure the MEX functions are used instead of the plain Matlab script, one-time type `clear functions` in Matlab.
63-
6443
## Java-based functions
6544

6645
Most Matlab-stdlib filesystem functions work without the

buildfile.m

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
cnomex = cnomex & ~HasTag("windows");
1717
end
1818

19-
cmex = HasTag("mex");
19+
% cmex = HasTag("mex");
2020

2121
cjava = HasTag("java") & ~HasTag("exe");
2222

@@ -32,14 +32,14 @@
3232
if isMATLABReleaseOlderThan("R2024b")
3333

3434
plan("test_java") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cjava));
35-
plan("test_nomex") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cnomex), Dependencies="clean");
35+
plan("test_main") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cnomex));
3636

3737
elseif isMATLABReleaseOlderThan("R2025a")
3838
% Matlab == R2024b
3939
plan("test:java") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cjava));
4040
plan("test:exe") = matlab.buildtool.tasks.TestTask(test_root, Tag="exe", Dependencies="exe");
41-
plan("test:nomex") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cnomex), Dependencies="clean");
42-
plan("test:mex") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cmex), Dependencies="mex");
41+
plan("test:main") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cnomex));
42+
% plan("test:mex") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cmex), Dependencies="mex");
4343

4444
else
4545
% Matlab >= R2025a
@@ -48,37 +48,32 @@
4848
RunOnlyImpactedTests=true,...
4949
Dependencies="exe", TestResults="TestResults_exe.xml", Strict=true);
5050

51-
plan("test:nomex") = matlab.buildtool.tasks.TestTask(test_root, Description="Test non-MEX targets",...
51+
plan("test:main") = matlab.buildtool.tasks.TestTask(test_root, Description="Test non-MEX targets",...
5252
Selector=cnomex, ...
5353
SourceFiles=pkg_root, RunOnlyImpactedTests=true,...
54-
dependencies="clean_mex", TestResults="TestResults_nomex.xml", Strict=true);
54+
TestResults="TestResults_nomex.xml", Strict=true);
5555

56-
plan("test:mex") = matlab.buildtool.tasks.TestTask(test_root, Description="Test mex targts",...
57-
Selector=cmex, ...
58-
SourceFiles=[pkg_root, plan.RootFolder + "/src"], RunOnlyImpactedTests=true,...
59-
Dependencies="mex", TestResults="TestResults_mex.xml", Strict=true);
56+
% plan("test:mex") = matlab.buildtool.tasks.TestTask(test_root, Description="Test mex targts",...
57+
% Selector=cmex, ...
58+
% SourceFiles=[pkg_root, plan.RootFolder + "/src"], RunOnlyImpactedTests=true,...
59+
% Dependencies="mex", TestResults="TestResults_mex.xml", Strict=true);
6060

6161
plan("test:java") = matlab.buildtool.tasks.TestTask(test_root, Description="test Java targets", ...
6262
Selector=cjava, ...
6363
SourceFiles=pkg_root, RunOnlyImpactedTests=true,...
6464
TestResults="TestResults_java.xml", Strict=true);
6565

66-
plan("test:python") = matlab.buildtool.tasks.TestTask(test_root, Description="test Python targets", ...
67-
Tag="python", ...
68-
SourceFiles=pkg_root, RunOnlyImpactedTests=true,...
69-
TestResults="TestResults_python.xml", Strict=true);
70-
7166
addons = matlab.addons.installedAddons;
7267
if contains(addons.Name, "Matlab Test")
7368
plan("coverage") = matlab.buildtool.tasks.TestTask(test_root, ...
7469
Description="code coverage", ...
75-
Dependencies=["clean_mex", "exe"], ...
70+
Dependencies="exe", ...
7671
SourceFiles=pkg_root, ...
7772
Selector=cnomex | HasTag("java") | HasTag("exe") | HasTag("python"), ...
7873
Strict=false).addCodeCoverage(matlabtest.plugins.codecoverage.StandaloneReport("coverage-report.html"));
7974
end
8075

81-
plan("clean_mex") = matlab.buildtool.Task(Actions=@clean_mex, Description="Clean only MEX files to enable incremental tests");
76+
% plan("clean_mex") = matlab.buildtool.Task(Actions=@clean_mex, Description="Clean only MEX files to enable incremental tests");
8277
end
8378

8479
if isMATLABReleaseOlderThan("R2023a"), return, end
@@ -102,26 +97,26 @@
10297
WarningThreshold=0, Results="CodeIssues.sarif");
10398
end
10499

105-
if isMATLABReleaseOlderThan("R2024b"), return, end
106100

107101
%% MexTask
108-
109-
for s = get_mex_sources()
110-
src = s{1};
111-
[~, name] = fileparts(src(1));
112-
113-
% name of MEX target function is name of first source file
114-
plan("mex:" + name) = matlab.buildtool.tasks.MexTask(src, pkg_root, ...
115-
Description="Build MEX target " + name, ...
116-
Options=get_compiler_options());
102+
if ~isMATLABReleaseOlderThan("R2024b")
103+
% for s = get_mex_sources()
104+
% src = s{1};
105+
% [~, name] = fileparts(src(1));
106+
%
107+
% % name of MEX target function is name of first source file
108+
% plan("mex:" + name) = matlab.buildtool.tasks.MexTask(src, pkg_root, ...
109+
% Description="Build MEX target " + name, ...
110+
% Options=get_compiler_options());
111+
% end
117112
end
118113

119114
end
120115

121116

122-
function clean_mex(context)
123-
run(context.Plan, "clean", {"mex"});
124-
end
117+
% function clean_mex(context)
118+
% run(context.Plan, "clean", {"mex"});
119+
% end
125120

126121

127122
function legacy_test(context, sel)
@@ -159,17 +154,16 @@ function publishTask(context)
159154
end
160155

161156
srcs = {
162-
"src/remove.cpp", ...
163-
["src/normalize.cpp", "src/normalize_fs.cpp", "src/pure.cpp"], ...
164-
"src/set_permissions.cpp"
157+
% "src/remove.cpp", ...
158+
%["src/normalize.cpp", "src/normalize_fs.cpp", "src/pure.cpp"], ...
159+
% "src/set_permissions.cpp"
165160
};
166161

167162
if ~stdlib.has_python() || build_all
168163
srcs{end+1} = "src/is_char_device.cpp";
169164
srcs{end+1} = ["src/is_admin.cpp", "src/admin_fs.cpp"];
170-
srcs{end+1} = "src/disk_available.cpp";
171-
srcs{end+1} = "src/disk_capacity.cpp";
165+
% srcs{end+1} = "src/disk_available.cpp";
166+
% srcs{end+1} = "src/disk_capacity.cpp";
172167
end
173168

174169
end
175-
File renamed without changes.

test/TestExists.m

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,20 @@ function test_is_rw(tc, Ps, method, fname)
4141
end
4242
end
4343

44+
45+
function test_is_char_device(tc)
46+
is_capable(tc, @stdlib.python.is_char_device)
47+
48+
% /dev/stdin may not be available on CI systems
49+
if ispc
50+
n = "NUL";
51+
else
52+
n = "/dev/null";
53+
end
54+
55+
tc.verifyTrue(stdlib.is_char_device(n))
56+
end
57+
58+
4459
end
4560
end

test/TestPython.m

Lines changed: 0 additions & 28 deletions
This file was deleted.

test/test_nomex.m renamed to test/test_main.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function test_nomex()
1+
function test_main()
22
import matlab.unittest.TestRunner
33
import matlab.unittest.selectors.HasTag
44

0 commit comments

Comments
 (0)