mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
Simplified test set up and tear down methods
This commit is contained in:
parent
9375e8dbc7
commit
4dc301b0d7
@ -7,38 +7,17 @@
|
||||
% run interfaces/matlab_experimental/testpath.m
|
||||
|
||||
% get the list of directories on the Matlab path
|
||||
dirs = regexp(path, ['([^' pathsep ']*)'], 'match');
|
||||
dirs = split(path, pathsep);
|
||||
|
||||
% if 'cantera' is already in the path, remove it
|
||||
for i = 1:length(dirs)
|
||||
if strfind(dirs{i}, 'Cantera')
|
||||
rmpath(dirs{i});
|
||||
continue;
|
||||
end
|
||||
if strfind(dirs{i}, 'cantera')
|
||||
if contains(dirs{i}, 'CANTERA', 'IgnoreCase', true)
|
||||
rmpath(dirs{i});
|
||||
end
|
||||
end
|
||||
|
||||
cantera_root = getenv('CANTERA_ROOT');
|
||||
|
||||
% Copy the Cantera shared library from the build directory if necessary
|
||||
if ispc
|
||||
libname = 'cantera_shared.dll';
|
||||
elseif ismac
|
||||
libname = 'libcantera_shared.dylib';
|
||||
elseif isunix
|
||||
libname = 'libcantera_shared.so';
|
||||
end
|
||||
|
||||
copyfile(fullfile(cantera_root, 'build', 'lib', libname), ...
|
||||
fullfile(cantera_root, 'test', 'matlab_experimental'));
|
||||
|
||||
% Add the Cantera toolbox to the Matlab path
|
||||
addpath(genpath([cantera_root, '/interfaces/matlab_experimental']));
|
||||
addpath(genpath([cantera_root, '/test/matlab_experimental']));
|
||||
|
||||
% Set path to Python module
|
||||
if strcmp(getenv('PYTHONPATH'), '')
|
||||
setenv('PYTHONPATH', fullfile(cantera_root, 'build', 'python'))
|
||||
end
|
||||
|
@ -7,11 +7,11 @@ ctTestPath;
|
||||
rootDir = getenv('CANTERA_ROOT');
|
||||
|
||||
if ispc
|
||||
ctName = '/test/matlab_experimental/cantera_shared.dll';
|
||||
ctName = '/build/lib/cantera_shared.dll';
|
||||
elseif ismac
|
||||
ctname = '/test/matlab_experimental/libcantera_shared.dylib';
|
||||
ctName = '/build/lib/libcantera_shared.dylib';
|
||||
elseif isunix
|
||||
ctname = '/test/matlab_experimental/libcantera_shared.so';
|
||||
ctName = '/build/lib/libcantera_shared.so';
|
||||
end
|
||||
% Load Cantera
|
||||
if ~libisloaded('libcantera_shared')
|
||||
|
@ -1,17 +1,4 @@
|
||||
clear all
|
||||
|
||||
cantera_root = getenv('CANTERA_ROOT');
|
||||
|
||||
if ispc
|
||||
ctName = '/test/matlab_experimental/cantera_shared.dll';
|
||||
elseif ismac
|
||||
ctname = '/test/matlab_experimental/libcantera_shared.dylib';
|
||||
elseif isunix
|
||||
ctname = '/test/matlab_experimental/libcantera_shared.so';
|
||||
end
|
||||
|
||||
% Unload Cantera and remove temporary library file
|
||||
% Unload Cantera
|
||||
unloadlibrary('libcantera_shared');
|
||||
delete([cantera_root, ctName]);
|
||||
|
||||
disp('Cantera has been unloaded');
|
||||
|
Loading…
Reference in New Issue
Block a user