Skip to content

Commit 9653d15

Browse files
committed
simplify test
1 parent 15ecaad commit 9653d15

File tree

4 files changed

+44
-268
lines changed

4 files changed

+44
-268
lines changed

+stdlib/java_run_octave.m

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

Readme.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,49 @@
55
[![ci](https://github.com/geospace-code/matlab-stdlib/actions/workflows/ci.yml/badge.svg)](https://github.com/geospace-code/matlab-stdlib/actions/workflows/ci.yml)
66
[![ci-nojvm](https://github.com/geospace-code/matlab-stdlib/actions/workflows/ci-nojvm.yml/badge.svg)](https://github.com/geospace-code/matlab-stdlib/actions/workflows/ci-nojvm.yml)
77

8-
Matlab or
9-
[GNU Octave](./Readme_octave.md)
10-
users coming from other languages will benefit from the functionality contained within this user-developed, unofficial "stdlib" standard library of functions.
11-
These system, filesystem, and HDF5 / HDF4 / NetCDF functions are used across numerous projects.
8+
Matlab users coming from other languages will benefit from the functionality contained within this user-developed, unofficial "stdlib" standard library of functions.
9+
These system, filesystem, and HDF5 / HDF4 / NetCDF functions are used by numerous independent projects.
1210

13-
Matlab R2019b is the minimum required due to use of
11+
Matlab R2019b is the minimum version required due to use of
1412
[function argument validation](https://www.mathworks.com/help/matlab/ref/arguments.html).
15-
Full functionality on macOS and Windows require minimum of Matlab R2020b (most functions work in R2019b and newer).
16-
Full functionality on Linux with minimum Matlab R2019b.
13+
Full functionality is available with:
1714

15+
* Linux: Matlab R2019b and newer
16+
* macOS, Windows: Matlab R2020b and newer
1817

1918
## Self-tests
2019

21-
The self-tests require at least Matlab R2020b and can be run from the matlab-stdlib/ directory.
20+
The self-tests can be run from the top matlab-stdlib/ directory.
2221

23-
Matlab R2024b and newer:
22+
Matlab R2022b and newer:
2423

2524
```matlab
2625
buildtool test
2726
```
2827

29-
Matlab R2022b..R2024a, inclusive:
30-
31-
```matlab
32-
buildtool test_main
33-
```
34-
3528
Matlab older than R2022b:
3629

3730
```matlab
3831
test_main
3932
```
4033

41-
## Java-based functions
42-
43-
Most Matlab-stdlib filesystem functions work without the
44-
[Java interface](./Readme_java.md).
45-
If Matlab was started without Java using
46-
[-nojvm](https://www.mathworks.com/help/matlab/matlab_env/commonly-used-startup-options.html),
47-
most Matlab-stdlib functions still work.
48-
This
49-
[CI job](https://github.com/geospace-code/matlab-stdlib/actions/workflows/ci-nojvm.yml)
50-
tests without Java.
34+
## External language backends
35+
36+
Our functions that aren't possible in native Matlab code are implemented using Matlab's no-compile
37+
[external language interfaces](https://www.mathworks.com/support/requirements/language-interfaces.html).
38+
The
39+
[API listing](https://geospace-code.github.io/matlab-stdlib/)
40+
"backend" column tells which functions have selectable backend implementations.
41+
By default, when the "backend" is not specified to a function having selectable backend, the algorithm searches for the first available backend and uses that.
42+
The user can specify the backend as listed in the API for those functions by specifying say "java" etc. as available per-function.
43+
Normally the user will not specify the backend as we prioritize faster backends.
44+
45+
* [.NET](https://www.mathworks.com/help/matlab/call-net-from-matlab.html)
46+
* Windows: all supported Matlab releases
47+
* Linux / macOS: R2024b and newer
48+
* [Java](https://www.mathworks.com/help/matlab/using-java-libraries-in-matlab.html): all supported Matlab releases. A few Java functions are Linux / macOS only, but have other backends available.
49+
* [Python](https://www.mathworks.com/help/matlab/call-python-libraries.html): Matlab R2022b and newer
50+
* System shell calls: all supported Matlab releases. As a backup when the platform doesn't have the primary (faster) methods available, the system shell can be called for some functions.
5151

5252
## Acknowledgments
5353

Readme_java.md

Lines changed: 10 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ However, Matlab's intrinsic file functions do work with Windows App Execution Al
88
Matlab's Java interface was
99
[introduced in Matlab 6.0 R12](http://www.ece.northwestern.edu/local-apps/matlabhelp/base/relnotes/matlab/matlab124.html#20684)
1010
in the year 2000.
11-
GNU Octave also can
12-
[use Java](https://docs.octave.org/latest/Set-up-the-JVM.html).
1311
Matlab-Stdlib uses only factory JRE classes where intrinsic Matlab code isn't easily capable of provided the needed algorithms.
1412

1513
Tell JVM version:
@@ -37,25 +35,26 @@ stdlib.java_version()
3735
```
3836

3937
From before Matlab R2019b to at least Matlab R2025a, the Matlab factory Java version is 1.8, which is adequate for most Matlab-stdlib functionality.
40-
Java 11 or newer is recommended for more robustness if relying on Java functionality.
38+
39+
Java won't be available if Matlab was started with
40+
[-nojvm](https://www.mathworks.com/help/matlab/matlab_env/commonly-used-startup-options.html).
41+
This
42+
[CI job](https://github.com/geospace-code/matlab-stdlib/actions/workflows/ci-nojvm.yml)
43+
tests without Java.
4144

4245
If desired (not used by Matlab-stdlib), one can use non-factory Java classes in
43-
[Matlab](https://www.mathworks.com/help/matlab/matlab_external/static-path-of-java-class-path.html))
44-
and
45-
[GNU Octave](https://docs.octave.org/interpreter/Making-Java-Classes-Available.html).
46+
[Matlab](https://www.mathworks.com/help/matlab/matlab_external/static-path-of-java-class-path.html).
4647

4748
## Configure Matlab JVM
4849

4950
The Matlab Java interface is like other Matlab external languages such as Python.
5051
The Matlab default
5152
[JVM can be configured](https://www.mathworks.com/help/matlab/matlab_external/configure-your-system-to-use-java.html)
52-
to
53-
[compatible JRE](https://www.mathworks.com/support/requirements/language-interfaces.html)
54-
across
55-
[Matlab versions](https://www.mathworks.com/support/requirements/openjdk.html)
56-
by using the
53+
to a compatible Java library by using the
5754
[jenv](https://www.mathworks.com/help/matlab/ref/jenv.html)
5855
Matlab function.
56+
Matlab vs. Java
57+
[version compatibility table](https://www.mathworks.com/support/requirements/openjdk.html).
5958

6059
Tell JVM details:
6160

@@ -94,68 +93,3 @@ if Matlab can't start or has problems, from system Terminal (not within Matlab):
9493
```sh
9594
matlab_jenv factory
9695
```
97-
98-
## Configure GNU Octave JVM
99-
100-
GNU
101-
[Octave JVM](https://docs.octave.org/latest/Set-up-the-JVM.html)
102-
can be configured with the JAVA_HOME environment variable.
103-
Some install packages don't include Java.
104-
For example, with Homebrew:
105-
106-
```sh
107-
brew install octave openjdk
108-
```
109-
110-
On Windows install JDK as like Matlab above.
111-
112-
```octave
113-
setenv("JAVA_HOME", "/path/to/openjdk/")
114-
```
115-
116-
This `setenv()` is not persistent.
117-
If it works, add the working `setenv()` command to
118-
[.octaverc](https://docs.octave.org/interpreter/Startup-Files.html)
119-
120-
### Use Matlab JRE in GNU Octave
121-
122-
If Matlab is installed, GNU Octave can use the same JRE as Matlab.
123-
Do so like:
124-
125-
```matlab
126-
je = jenv();
127-
% Tell the JAVA_HOME directory
128-
disp(je.Home)
129-
```
130-
131-
Then set the JAVA_HOME environment variable to the JRE directory in Octave:
132-
133-
```octave
134-
setenv("JAVA_HOME", "value from je.Home")
135-
```
136-
137-
Be sure on Windows to use file separator "/" as "\" will not work.
138-
Within Octave:
139-
140-
```octave
141-
setenv("JAVA_HOME", "C:/Program Files/MATLAB/R2025a/sys/java/jre/win64/jre")
142-
143-
version("-java")
144-
```
145-
146-
> ans = Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
147-
148-
### Troubleshooting
149-
150-
If OpenJDK version updates, GNU Octave might not automatically find the new version:
151-
152-
> libjvm: failed to load
153-
154-
To correct this, find the path to the new JVM..
155-
For example, on macOS:
156-
157-
```sh
158-
gfind $(brew --prefix) -name libjvm.dylib
159-
```
160-
161-
Within Octave, tell Octave the directory that libjvm is under by `setenv("JAVA_HOME", "<path to libjvm directory>")`.

test/TestSys.m

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
end
88

99
properties (TestParameter)
10-
fun = {@stdlib.isoctave, @stdlib.has_dotnet, ...
11-
@stdlib.has_java, @stdlib.has_python}
1210
cpu_arch_fun = {'java', 'dotnet', 'native'}
1311
cr_method = {'sys', 'java', 'python'}
1412
all_fun = {'java', 'python', 'dotnet', 'sys'}
@@ -26,6 +24,15 @@ function setup_paths(tc)
2624

2725
methods (Test, TestTags=["R2019b", "impure"])
2826

27+
function test_has_ext_lang(tc)
28+
29+
tc.verifyClass(stdlib.isoctave(), 'logical')
30+
tc.verifyClass(stdlib.has_dotnet(), 'logical')
31+
tc.verifyClass(stdlib.has_java(), 'logical')
32+
tc.verifyClass(stdlib.has_python(), 'logical')
33+
34+
end
35+
2936
function test_toolbox_used(tc)
3037
[mathworksUsed, userFun] = stdlib.toolbox_used(fullfile(tc.root, "+stdlib"));
3138
Nlicense = length(mathworksUsed);
@@ -49,9 +56,6 @@ function test_platform_tell(tc)
4956
tc.verifyClass(stdlib.platform_tell(), 'char')
5057
end
5158

52-
function test_platform_logical(tc, fun)
53-
tc.verifyClass(fun(), 'logical')
54-
end
5559

5660
function test_is_cygwin(tc)
5761
tc.verifyFalse(stdlib.is_cygwin())

0 commit comments

Comments
 (0)