aboutsummaryrefslogtreecommitdiff
path: root/zh-cn/devices/graphics/run-tests.html
blob: dd75284ba527f39024dc62f47c18af232fdbb045 (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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<html devsite><head>
    <title>运行测试</title>
    <meta name="project_path" value="/_project.yaml"/>
    <meta name="book_path" value="/_book.yaml"/>
  </head>
  <body>
  <!--
      Copyright 2017 The Android Open Source Project

      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
  -->

<p>本页将介绍如何在 Linux 和 Windows 环境中运行 deqp 测试、如何使用命令行参数,以及如何使用 Android 应用包。</p>

<h2 id="linux_and_windows_environments">Linux 与 Windows 环境</h2>

<p>首先,请将以下文件及目录复制到目标中。</p>

<table>
 <tbody><tr>
   <th>模块</th>
   <th>目录</th>
   <th>目标</th>
 </tr>

 <tr>
    <td>执行服务器</td>
    <td><code>build/execserver/execserver</code></td>
    <td><code>&lt;dst&gt;/execserver</code></td>
 </tr>

 <tr>
    <td>EGL 模块</td>
    <td><code>build/modules/egl/deqp-egl</code></td>
    <td><code>&lt;dst&gt;/deqp-egl</code></td>
 </tr>

 <tr>
    <td rowspan="2" style="vertical-align:middle">GLES2 模块</td>
    <td><code>build/modules/gles2/deqp-gles2</code></td>
    <td><code>&lt;dst&gt;/deqp-gles2</code></td>
 </tr>

 <tr>
    <td><code>data/gles2</code></td>
    <td><code>&lt;dst&gt;/gles2</code></td>
 </tr>

 <tr>
    <td rowspan="2" style="vertical-align:middle">GLES3 模块</td>
    <td><code>build/modules/gles3/deqp-gles3</code></td>
    <td><code>&lt;dst&gt;/deqp-gles3</code></td>
 </tr>

 <tr>
    <td><code>data/gles3</code></td>
    <td><code>&lt;dst&gt;/gles3</code></td>
 </tr>

 <tr>
    <td rowspan="2" style="vertical-align:middle">GLES3.1 模块</td>
    <td><code>build/modules/gles31/deqp-gles31</code></td>
    <td><code>&lt;dst&gt;/deqp-gles31</code></td>
 </tr>

 <tr>
    <td><code>data/gles31</code></td>
    <td><code>&lt;dst&gt;/gles31</code></td>
 </tr>

  <tr>
    <td rowspan="2" style="vertical-align:middle">GLES3.2 模块</td>
    <td><code>build/modules/gles32/deqp-gles32</code></td>
    <td><code>&lt;dst&gt;/deqp-gles32</code></td>
 </tr>

  <tr>
    <td><code>data/gles32</code></td>
    <td><code>&lt;dst&gt;/gles32</code></td>
 </tr>

</tbody></table>

<p>您可以在目标文件系统的任意位置部署执行服务和测试二进制文件,但是测试二进制文件需要在当前的工作目录中查找数据目录。准备就绪后,在目标设备上启动测试执行服务。有关如何启动服务的详细信息,请参阅<a href="/devices/graphics/port-tests.html#test_execution_service">测试执行服务</a>一节。</p>

<h2 id="command_line_arguments">命令行参数</h2>

<p>下表列出了影响所有测试程序执行的命令行参数。</p>

<table width="100%">
<colgroup><col style="width:50%" />
<col style="width:50%" />
 </colgroup><tbody><tr>
   <th>参数</th>
   <th>说明</th>
 </tr>

 <tr>
<td><code>--deqp-case=&lt;casename&gt;</code></td>
<td>运行与指定模式匹配的用例。支持通配符 (*)。</td>
 </tr>

 <tr>
<td><code>--deqp-log-filename=&lt;filename&gt;</code></td>
<td>将测试结果写入文件,文件名由您提供。测试执行服务将在开始测试时设置文件名。</td>
 </tr>

 <tr>
 <td><code>--deqp-stdin-caselist<br />
--deqp-caselist=&lt;caselist&gt;<br />
--deqp-caselist-file=&lt;filename&gt;</code></td>
<td>通过 stdin 或指定的参数读取用例列表。测试执行服务将根据收到的执行请求设置参数。有关用例列表格式的说明,请参阅下一节。</td>
 </tr>
 <tr>
<td><code>--deqp-test-iteration-count=&lt;count&gt;</code></td>
<td>覆盖迭代次数可变的测试的迭代计数。</td>
 </tr>
 <tr>
    <td><code>--deqp-base-seed=&lt;seed&gt;</code></td>
    <td>为采用随机测试的测试用例设定种子。</td>
 </tr>
</tbody></table>

<h3 id="gles2_and_gles3-specific_arguments">特定于 GLES2 及 GLES3 的参数</h3>

下表列出了特定于 GLES2 及 GLES3 的参数。

<table>
</table><table width="100%">
<colgroup><col style="width:50%" />
<col style="width:50%" />
 </colgroup><tbody><tr>
   <th>参数</th>
   <th>说明</th>
 </tr>
 <tr>
    <td><code>--deqp-gl-context-type=&lt;type&gt;</code></td>
    <td>OpenGL 上下文类型。提供的上下文类型取决于平台。在支持 EGL 的平台上,值 <code>egl</code> 可用于选择 EGL 上下文。</td>
 </tr>
 <tr>
    <td><code>--deqp-gl-config-id=&lt;id&gt;</code></td>
    <td>对所提供的 GL 配置 ID 运行测试。解译取决于平台。在 EGL 平台上,该配置 ID 为 EGL 配置 ID。</td>
 </tr>
 <tr>
    <td><code>--deqp-gl-config-name=&lt;name&gt;</code></td>
    <td>对已命名的 GL 配置运行测试。解译取决于平台。对于 EGL,格式为 <code>rgb(a)&lt;bits&gt;d&lt;bits&gt;s&lt;bits&gt;</code>。例如,值 <code>rgb888s8</code> 会选择第一个配置,其中颜色缓冲区为 RGB888,模板缓冲区为 8 位。</td>
 </tr>
 <tr>
    <td><code>--deqp-gl-context-flags=&lt;flags&gt;</code></td>
    <td>创建一个上下文。指定 <code>robust</code> 或 <code>debug</code>。</td>
 </tr>
 <tr>
    <td><code>--deqp-surface-width=&lt;width&gt;<br />
    --deqp-surface-height=&lt;height&gt;</code></td>
    <td>尝试使用指定的尺寸创建表面。对这项功能的支持为可选项。</td>
 </tr>
 <tr>
    <td><code>--deqp-surface-type=&lt;type&gt;</code></td>
    <td>将指定的表面类型用作主测试渲染目标。可取类型为 <code>window</code>、<code>pixmap</code>、<code>pbuffer</code> 和 <code>fbo</code>。</td>
 </tr>
 <tr>
    <td><code>--deqp-screen-rotation=&lt;rotation&gt;</code></td>
    <td>对于支持该参数的平台,屏幕方向的旋转增量为 90 度。</td>
 </tr>
</tbody></table>

<h3 id="test_case_list_format">测试用例列表格式</h3>

<p>测试用例列表有两种格式。第一种选项是在标准 ASCII 文件的单独一行中列出每个测试的全名。随着测试集的增长,重复添加前缀可能会很麻烦。为避免重复添加前缀,可使用以下所示的 trie(也称为前缀树)语法。</p>

<pre class="devsite-click-to-copy">
{nodeName{firstChild{…},…lastChild{…}}}
</pre>

<p>例如:</p>

<pre class="devsite-click-to-copy">
{dEQP-EGL{config-list,create_context{rgb565_depth_stencil}}}
</pre>

<p>会转换为以下两个测试用例:</p>

<pre class="devsite-click-to-copy">
dEQP-EGL.config_list
dEQP-EGL.create_context.rgb565_depth_stencil
</pre>

<h2 id="android">Android</h2>

<p>Android 应用包包含所需的所有组件,包括测试执行服务、测试二进制文件和数据文件。测试 Activity 是使用 EGL 的 <code>NativeActivity</code>(需要 Android 3.2 或更高版本)。</p>

<p>应用包可使用以下命令安装(所示名称为 Android CTS 包中 APK 的名称;该名称因版本而异):</p>
<pre class="devsite-terminal devsite-click-to-copy">
adb –d install –r com.drawelements.deqp.apk
</pre>

<p>要启动测试执行服务并设置端口转发,请使用以下命令:</p>
<pre class="devsite-click-to-copy">
<code class="devsite-terminal">adb –d forward tcp:50016 tcp:50016</code>
<code class="devsite-terminal">adb –d shell am start –n com.drawelements.deqp/.execserver.ServiceStarter</code>
</pre>

<p>在开始测试之前,可执行以下命令来启用调试打印:</p>

<pre class="devsite-terminal devsite-click-to-copy">
adb –d shell setprop log.tag.dEQP DEBUG
</pre>

<h3 id="executing_tests_on_android_without_android_cts">在没有 Android CTS 的 Android 设备上执行测试</h3>

<p>要手动启动测试执行 Activity,需构造一个目标为 <code>android.app.NativeActivity</code> 的 Android Intent。这些 Activity 可以在 <code>com.drawelements.deqp</code> 包中找到。在 Intent 中,命令行必须以含 <code>"cmdLine"</code> 键的额外字符串提供。</p>

<p>测试日志会写入 <code>/sdcard/dEQP-log.qpa</code>。若测试运行无法正常启动,请查看设备日志,了解其他调试信息。</p>

<p>您可使用 <code>am</code> 实用程序从命令行启动 Activity。例如,要在支持 <code>NativeActivity,</code> 的平台上运行 <code>dEQP-GLES2.info</code> 测试,请执行以下命令。</p>

<pre class="devsite-terminal devsite-click-to-copy">
adb -d shell am start -n com.drawelements.deqp/android.app.NativeActivity -e \
'cmdLine "deqp --deqp-case=dEQP-GLES2.info.* --deqp-log-filename=/sdcard/dEQP-Log.qpa"'
</pre>

<h3 id="debugging_on_android">在 Android 系统上调试</h3>

<p>要采用 Android 系统中的 GDB 调试器运行测试,首先要运行以下两个脚本来编译并安装调试版本:</p>

<pre class="devsite-click-to-copy">
<code class="devsite-terminal">python android/scripts/build.py --native-build-type=Debug</code>
<code class="devsite-terminal">python android/scripts/install.py</code>
</pre>

<p>当设备上安装调试版本后,要采用主机上运行的 GDB 启动测试,请运行以下命令:</p>

<pre class="devsite-terminal devsite-click-to-copy">
python android/scripts/debug.py \
--deqp-commandline="--deqp-log-filename=/sdcard/TestLog.qpa --deqp-case=dEQP-GLES2.functional.*"
</pre>

<p>deqp 命令行取决于要执行的测试用例和其他所需参数。脚本会在开始执行 deqp 时添加一个默认断点 (<code>tcu::App::App</code>)。</p>

<p><code>debug.py</code> 脚本接受多个命令行参数用于相关操作,例如:设置调试断点、gdbserver 连接参数及要调试的其他二进制文件的路径(对于所有参数和解释,都执行 <code>debug.py
--help</code>)。该脚本还会从目标设备中复制一些默认库,以获取符号列表。</p>

<p>要逐步检查驱动程序代码(例如,当 GDB 需要了解具有完整调试信息的二进制文件的位置时),请通过 <code>debug.py</code> 命令行参数添加更多的库。该脚本从脚本文件的第 132 行开始写出 GDB 的配置文件。您还可以提供额外的二进制路径等信息,但提供正确的命令行参数就已足够。</p>

<p class="note"><strong>注意</strong>:在 Windows 上,GDB 二进制文件需要使用 <code>libpython2.7.dll</code>。在启动 <code>debug.py</code> 前,请将 <code>&lt;path-to-ndk&gt;/prebuilt/windows/bin</code> 添加到 PATH 变量中。</p>

<p class="note"><strong>注意</strong>:本机代码调试不适用于原生 Android 4.3。有关解决方法,请参考<a href="https://issuetracker.google.com/issues/36976703">此公开 Bug</a>。Android 4.4 及更高版本不包含此 Bug。</p>

</body></html>