aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests/interop/interop_html_report.template
blob: 46cce426b7af3e05adfe568a59e150a997a304f5 (plain)
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!DOCTYPE html>
<html lang="en">
<head><title>Interop Test Result</title></head>
<body>

<%def name="fill_one_test_result(shortname, resultset)">
  % if shortname in resultset:
    ## Because interop tests does not have runs_per_test flag, each test is 
    ## run once. So there should only be one element for each result.
    <% result = resultset[shortname][0] %>
    % if result.state == 'PASSED':      
        <td bgcolor="green">PASS</td>
    % else:
      <% 
        tooltip = ''
        if result.returncode > 0 or result.message:
          if result.returncode > 0:
            tooltip = 'returncode: %d ' % result.returncode
          if result.message:
            tooltip = '%smessage: %s' % (tooltip, result.message)  
      %>     
      % if result.state == 'FAILED':
        <td bgcolor="red">
        % if tooltip:  
          <a href="#" data-toggle="tooltip" data-placement="auto" title="${tooltip | h}">FAIL</a></td>
        % else:
          FAIL</td>
        % endif
      % elif result.state == 'TIMEOUT':
        <td bgcolor="yellow">
        % if tooltip:
          <a href="#" data-toggle="tooltip" data-placement="auto" title="${tooltip | h}">TIMEOUT</a></td> 
        % else:
          TIMEOUT</td>
        % endif
      % endif
    % endif
  % else:
     <td bgcolor="magenta">Not implemented</td>
  % endif
</%def>

<%def name="fill_one_http2_test_result(shortname, resultset)">
    ## keep this mostly in sync with the template above
  % if shortname in resultset:
    ## Because interop tests does not have runs_per_test flag, each test is 
    ## run once. So there should only be one element for each result.
    <% result = resultset[shortname][0] %>
    % if result.http2results:
      <td bgcolor="white">
        <div style="width:95%; border: 1px solid black; position: relative; padding: 3px;">
          <span style="position: absolute; left: 45%;">${int(result.http2results['percent'] * 100)}&#37;</span>
          <div style="height: 20px; 
            background-color: hsl(${result.http2results['percent'] * 120}, 100%, 50%); 
            width: ${result.http2results['percent'] * 100}%;"
            title="${result.http2results['failed_cases'] | h}"></div>
        </div>
      </td>
    % else: 
      <td bgcolor="red">No result is found!</td>
    % endif
  % else:
     <td bgcolor="magenta">Not implemented</td>
  % endif
</%def>

<%def name="display_cloud_to_prod_result(prod_server)">
  ## Each column header is the client language.
  <table style="width:100%" border="1">
  <tr bgcolor="#00BFFF">
  <th>Client languages &#9658;<br/>Test Cases &#9660;</th>
  % for client_lang in client_langs:
    <th>${client_lang}</th>
  % endfor
  </tr>
  % for test_case in test_cases + auth_test_cases:
    <tr><td><b>${test_case}</b></td>
    % for client_lang in client_langs:
      <% 
        if test_case in auth_test_cases:
          shortname = 'cloud_to_prod_auth:%s:%s:%s' % (
              prod_server, client_lang, test_case)
        else:
          shortname = 'cloud_to_prod:%s:%s:%s' % (
              prod_server, client_lang, test_case)
      %>
      ${fill_one_test_result(shortname, resultset)}
    % endfor
    </tr> 
  % endfor
  </table>
</%def>

% if num_failures > 1:
  <p><h2><font color="red">${num_failures} tests failed!</font></h2></p>
% elif num_failures:
  <p><h2><font color="red">${num_failures} test failed!</font></h2></p>
% else:
  <p><h2><font color="green">All tests passed!</font></h2></p>
% endif

% if cloud_to_prod:
  % for prod_server in prod_servers:
    <h2>Cloud to ${prod_server}</h2>
    ${display_cloud_to_prod_result(prod_server)}
  % endfor
% endif

% if http2_interop:
  ## Each column header is the server language.
  <h2>HTTP/2 Interop</h2> 
  <table style="width:100%" border="1">
  <tr bgcolor="#00BFFF">
  <th>Servers &#9658;<br/>Test Cases &#9660;</th>
  % for server_lang in server_langs:
    <th>${server_lang}</th>
  % endfor
  % if cloud_to_prod:
    % for prod_server in prod_servers:
      <th>${prod_server}</th>
    % endfor
  % endif
  </tr>
  % for test_case in http2_cases:
    <tr><td><b>${test_case}</b></td>
    ## Fill up the cells with test result.
    % for server_lang in server_langs:
      <% 
        shortname = 'cloud_to_cloud:http2:%s_server:%s' % (
            server_lang, test_case)
      %>
      ${fill_one_http2_test_result(shortname, resultset)}
    % endfor
    % if cloud_to_prod:
      % for prod_server in prod_servers:
        <% shortname = 'cloud_to_prod:%s:http2:%s' % (prod_server, test_case) %>
        ${fill_one_http2_test_result(shortname, resultset)}
      % endfor
    % endif
    </tr>
  % endfor
  </table>
% endif

% if server_langs:
  % for test_case in test_cases:
    ## Each column header is the client language.
    <h2>${test_case}</h2> 
    <table style="width:100%" border="1">
    <tr bgcolor="#00BFFF">
    <th>Client languages &#9658;<br/>Server languages &#9660;</th>
    % for client_lang in client_langs:
      <th>${client_lang}</th>
    % endfor
    </tr>
    ## Each row head is the server language.
    % for server_lang in server_langs:
      <tr>
      <td><b>${server_lang}</b></td>
      % for client_lang in client_langs:
        <% 
          shortname = 'cloud_to_cloud:%s:%s_server:%s' % (
              client_lang, server_lang, test_case)
        %>
        ${fill_one_test_result(shortname, resultset)}
      % endfor
      </tr>
    % endfor
    </table>
  % endfor
% endif

<script>
  $(document).ready(function(){$('[data-toggle="tooltip"]').tooltip();});
</script>
</body>
</html>