2
2
3
3
% FT_TEST_RESULT checks the status of selected test scripts on the FieldTrip dashboard
4
4
%
5
- % Use as
6
- % ft_test_result
5
+ % To get all dashboard results as a structure array, you would do
6
+ % result = ft_test_result
7
7
%
8
- % Query arguments are specified as key-value pairs and can include
8
+ % To print a table with the results on screen, you would do
9
+ % ft_test_result comparerevision ea3c2b9 314d186
10
+ % ft_test_result comparematlab 2015b 2016b
11
+ %
12
+ % Additional query arguments are specified as key-value pairs and can include
9
13
% matlabversion = string
10
14
% fieldtripversion = string
11
15
% hostname = string
12
16
% user = string
13
- %
14
- % To get a list of all distinct values of a certain parameter, you specify
15
- % distinct = string
17
+ % branch = string
18
+ % result = string
16
19
%
17
20
% See also FT_TEST_RUN, FT_VERSION
18
21
39
42
% set the default
40
43
command = ' query' ;
41
44
42
- if nargin > 0 && isequal(varargin{1 }, ' compare' )
43
- % compare rev1 rev2
44
- command = varargin{1 };
45
- revision1 = varargin{2 };
46
- revision2 = varargin{3 };
47
- varargin = varargin(4 : end );
45
+ if nargin > 0
46
+ if isequal(varargin{1 }, ' compare' ) || isequal(varargin{1 }, ' comparerevision' )
47
+ % comparerevision rev1 rev2
48
+ command = ' comparerevision' ;
49
+ arg1 = varargin{2 };
50
+ arg2 = varargin{3 };
51
+ varargin = varargin(4 : end );
52
+ elseif isequal(varargin{1 }, ' matlab' ) || isequal(varargin{1 }, ' comparematlab' )
53
+ % comparematlab ver1 ver2
54
+ command = ' comparematlab' ;
55
+ arg1 = varargin{2 };
56
+ arg2 = varargin{3 };
57
+ varargin = varargin(4 : end );
58
+ end
48
59
end
49
60
50
61
% construct the query string
51
62
query = ' ?' ;
52
63
53
- queryparam = {' matlabversion' , ' fieldtripversion' , ' hostname' , ' user' , ' functionname' , ' distinct' };
64
+ % the 'distict' parameter is mutually exclusive with all others
65
+ queryparam = {' matlabversion' , ' fieldtripversion' , ' hostname' , ' user' , ' functionname' , ' result' , ' branch' , ' distinct' };
54
66
for i= 1 : numel(queryparam )
55
67
val = ft_getopt(varargin , queryparam{i });
56
68
if ~isempty(val )
63
75
switch command
64
76
case ' query'
65
77
results = webread([' http://dashboard.fieldtriptoolbox.org/api/' query ], options );
66
-
67
- case ' compare '
68
- dashboard1 = webread([' http://dashboard.fieldtriptoolbox.org/api/' query sprintf(' &fieldtripversion=%s ' , revision1 )], options );
69
- dashboard2 = webread([' http://dashboard.fieldtriptoolbox.org/api/' query sprintf(' &fieldtripversion=%s ' , revision2 )], options );
78
+
79
+ case ' comparerevision '
80
+ dashboard1 = webread([' http://dashboard.fieldtriptoolbox.org/api/' query sprintf(' &fieldtripversion=%s ' , arg1 )], options );
81
+ dashboard2 = webread([' http://dashboard.fieldtriptoolbox.org/api/' query sprintf(' &fieldtripversion=%s ' , arg2 )], options );
70
82
assert(~isempty(dashboard1 ), ' no tests were returned for the first revision' );
71
83
assert(~isempty(dashboard2 ), ' no tests were returned for the second revision' );
72
84
functionname1 = {dashboard1 .functionname };
73
85
functionname2 = {dashboard2 .functionname };
74
86
functionname = unique(cat(2 , functionname1 , functionname2 ));
75
87
n = max(cellfun(@length , functionname ));
88
+ line = cell(size(functionname ));
89
+ order = nan(size(functionname ));
90
+ for i= 1 : numel(functionname )
91
+ sel1 = find(strcmp(functionname1 , functionname{i }));
92
+ sel2 = find(strcmp(functionname2 , functionname{i }));
93
+ res1 = getresult(dashboard1 , sel1 );
94
+ res2 = getresult(dashboard2 , sel2 );
95
+ line{i } = sprintf(' %s : %s in %s , %s in %s\n ' , padto(functionname{i }, n ), res1 , arg1 , res2 , arg2 );
96
+
97
+ % determine the order
98
+ if strcmp(res1 , ' passed' ) && strcmp(res2 , ' passed' )
99
+ order(i ) = 1 ;
100
+ elseif strcmp(res1 , ' failed' ) && strcmp(res2 , ' failed' )
101
+ order(i ) = 2 ;
102
+ elseif strcmp(res1 , ' missing' ) && strcmp(res2 , ' passed' )
103
+ order(i ) = 3 ;
104
+ elseif strcmp(res1 , ' passed' ) && strcmp(res2 , ' missing' )
105
+ order(i ) = 4 ;
106
+ elseif strcmp(res1 , ' missing' ) && strcmp(res2 , ' failed' )
107
+ order(i ) = 5 ;
108
+ elseif strcmp(res1 , ' failed' ) && strcmp(res2 , ' missing' )
109
+ order(i ) = 6 ;
110
+ elseif strcmp(res1 , ' failed' ) && strcmp(res2 , ' passed' )
111
+ order(i ) = 7 ;
112
+ elseif strcmp(res1 , ' passed' ) && strcmp(res2 , ' failed' )
113
+ order(i ) = 8 ;
114
+ else
115
+ order(i ) = 9 ;
116
+ end
117
+ end % for each functionname
118
+
119
+ [order , index ] = sort(order );
120
+ line = line(index );
121
+ for i= 1 : length(line )
122
+ fprintf(line{i });
123
+ end
124
+
125
+ case ' comparematlab'
126
+ dashboard1 = webread([' http://dashboard.fieldtriptoolbox.org/api/' query sprintf(' &matlabversion=%s ' , arg1 )], options );
127
+ dashboard2 = webread([' http://dashboard.fieldtriptoolbox.org/api/' query sprintf(' &matlabversion=%s ' , arg2 )], options );
128
+ assert(~isempty(dashboard1 ), ' no tests were returned for the first matab version' );
129
+ assert(~isempty(dashboard2 ), ' no tests were returned for the second matab version' );
130
+ functionname1 = {dashboard1 .functionname };
131
+ functionname2 = {dashboard2 .functionname };
132
+ functionname = unique(cat(2 , functionname1 , functionname2 ));
133
+ n = max(cellfun(@length , functionname ));
134
+ line = cell(size(functionname ));
135
+ order = nan(size(functionname ));
76
136
for i= 1 : numel(functionname )
77
137
sel1 = find(strcmp(functionname1 , functionname{i }));
78
138
sel2 = find(strcmp(functionname2 , functionname{i }));
79
139
res1 = getresult(dashboard1 , sel1 );
80
140
res2 = getresult(dashboard2 , sel2 );
81
- fprintf(' %s : %s in %s , %s in %s\n ' , padto(functionname{i }, n ), res1 , revision1 , res2 , revision2 );
82
- end % for
141
+ line{i } = sprintf(' %s : %s in %s , %s in %s\n ' , padto(functionname{i }, n ), res1 , arg1 , res2 , arg2 );
142
+
143
+ % determine the order
144
+ if strcmp(res1 , ' passed' ) && strcmp(res2 , ' passed' )
145
+ order(i ) = 1 ;
146
+ elseif strcmp(res1 , ' failed' ) && strcmp(res2 , ' failed' )
147
+ order(i ) = 2 ;
148
+ elseif strcmp(res1 , ' missing' ) && strcmp(res2 , ' passed' )
149
+ order(i ) = 3 ;
150
+ elseif strcmp(res1 , ' passed' ) && strcmp(res2 , ' missing' )
151
+ order(i ) = 4 ;
152
+ elseif strcmp(res1 , ' missing' ) && strcmp(res2 , ' failed' )
153
+ order(i ) = 5 ;
154
+ elseif strcmp(res1 , ' failed' ) && strcmp(res2 , ' missing' )
155
+ order(i ) = 6 ;
156
+ elseif strcmp(res1 , ' failed' ) && strcmp(res2 , ' passed' )
157
+ order(i ) = 7 ;
158
+ elseif strcmp(res1 , ' passed' ) && strcmp(res2 , ' failed' )
159
+ order(i ) = 8 ;
160
+ else
161
+ order(i ) = 9 ;
162
+ end
163
+ end % for each functionname
164
+
165
+ [order , index ] = sort(order );
166
+ line = line(index );
167
+ for i= 1 : length(line )
168
+ fprintf(line{i });
169
+ end
83
170
84
171
otherwise
85
172
error(' unsupported command "%s "' , command );
105
192
str = ' failed' ;
106
193
else
107
194
str = ' ambiguous' ;
108
- end
195
+ end
0 commit comments