1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2011 - DIGITEO - Michael BAUDIN
// Copyright (C) 2011 - DIGITEO - Allan CORNET
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
function isok = atomsCheckModule(modulenames, verbose)
// Check the given list of ATOMS modules.
//
// Calling Sequence
// isok = atomsCheckModule(modulenames, verbose)
//
// Parameters
// names : a matrix of strings, the names of the modules to check
// verbose : a 1-by-1 matrix of booleans, set to true to display messages
//
// Description
// Installs, load, launch the tests and remove all the modules
// in modulenames.
//
// Examples
// atomsCheckModule("scibench", %t)
// atomsCheckModule(["apifun" "scibench"],%t)
//
tabsp = " * ";
if ~isdef("verbose") then
verbose = %t;
end
//============================================================================
function isok = atomsCheckModuleInstall(modulename, verbose)
isok = %f;
if verbose then
mprintf(gettext("\n%s Installing ...\n"), tabsp);
end
if execstr("r = [];r = atomsInstall(modulename, ''user'');", "errcatch") == 0 then
isok = (r <> []);
if isok & verbose then
disp(r);
end
end
endfunction
//============================================================================
function isok = atomsCheckModuleLoad(modulename, verbose)
isok = %f;
if verbose then
mprintf(gettext("\n%s Loading ...\n"), tabsp);
end
if execstr("r = [];r = atomsLoad(modulename);", "errcatch") <> 0 then
isok = %f;
else
isok = (r <> []);
if isok & verbose then
disp(r);
end
end
endfunction
//============================================================================
function isok = atomsCheckModuleTest(modulename, verbose)
isok = %f;
if verbose then
mprintf(gettext("\n%s Testing ...\n"), tabsp);
end
isok = atomsTest(modulename);
endfunction
//============================================================================
function isok = atomsCheckModuleRemove(modulename, verbose)
isok = %f;
if verbose then
mprintf(gettext("\n%s Removing ...\n"), tabsp);
end
if execstr("r = atomsRemove(modulename, ''user'', %t);", "errcatch") <> 0 then
isok = %f;
else
isok = (r == []);
end
endfunction
//============================================================================
isok = %f;
if type(modulenames) <> 10 then
error(msprintf(gettext("%s: Wrong type for input argument #%d: a matrix of string expected.\n"), "atomsCheckModule", 1));
end
if type(verbose) <> 4 then
error(msprintf(gettext("%s: Wrong type for input argument #%d: a boolean expected.\n"), "atomsCheckModule", 2));
end
if size(verbose, "*") <> 1 then
error(msprintf(gettext("%s: Wrong size for input argument #%d: a boolean expected.\n"), "atomsCheckModule", 2));
end
nm = size(modulenames, "*");
for k = 1:nm
modulename = modulenames(k);
im = atomsIsInstalled(modulename);
if im then
error(msprintf(gettext("%s: Module %s is already installed. Please remove it before checking it.\n"), "atomsCheckModule", modulename));
end
end
for k = 1:nm
modulename = modulenames(k);
r = atomsSearch(modulename);
if grep(r(:, 1), modulename) == [] then
error(msprintf(gettext("%s: Module %s does not exist in current repositories.\n"), "atomsCheckModule", modulename));
end
end
if nm > 1 then
u = unique(modulenames);
if size(u, "*") <> nm then
error(msprintf(gettext("%s: Wrong value(s) for input argument #%d: some unique module names expected.\n"), "atomsCheckModule", 1));
end
end
for k = 1:nm
im = atomsIsInstalled(modulename);
if im then
error(msprintf(gettext("%s: Module %s is already installed. Please remove it before checking it.\n"), "atomsCheckModule", modulename));
end
end
if verbose then
mprintf(gettext("\nNumber of modules to check: %d\n"), nm);
end
for k = 1:nm
modulename = modulenames(k);
isok(k) = atomsCheckModuleInstall(modulename, verbose);
isok(k) = isok(k) & atomsCheckModuleLoad(modulename, verbose);
isok(k) = isok(k) & atomsCheckModuleTest(modulename, verbose);
isok(k) = isok(k) & atomsCheckModuleRemove(modulename, verbose);
end
isok = matrix(isok, size(modulenames, "r"), size(modulenames, "c"));
endfunction
|