1# Copyright (C) 2016 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15'''Module that contains the test TestAllocationDump2'''
16
17from __future__ import absolute_import
18
19from harness.test_base_remote import TestBaseRemote
20from harness.decorators import (
21    wimpy,
22    ordered_test
23)
24
25
26class TestAllocationDump2(TestBaseRemote):
27    '''Tests printing the contents of allocations.'''
28
29    bundle_target = {
30        'java': 'Allocations'
31    }
32
33    @wimpy
34    @ordered_test(0)
35    def test_allocation_dump1(self):
36        # pylint: disable=line-too-long
37        self.try_command('language renderscript kernel breakpoint all enable',
38            ['Breakpoints will be set on all kernels'])
39
40        self.try_command('process continue',
41                         ['resuming',
42                          'stopped',
43                          'stop reason = breakpoint'])
44
45        self.try_command('breakpoint del 1',
46                         ['1 breakpoints deleted'])
47
48        # Hit second kernel
49        self.try_command('process continue',
50                         ['resuming',
51                          'stopped',
52                          'stop reason = breakpoint'])
53
54        # uchar
55        self.try_command('language renderscript allocation dump 20',
56                         ['(0, 0, 0) = 0',
57                          '(1, 0, 0) = 1',
58                          '(2, 0, 0) = 2',
59                          '(3, 0, 0) = 3',
60                          '(4, 0, 0) = 4',
61                          '(5, 0, 0) = 5',
62                          '(6, 0, 0) = 6',
63                          '(7, 0, 0) = 7',
64                          '(8, 0, 0) = 8',
65                          '(9, 0, 0) = 9',
66                          '(10, 0, 0) = 10',
67                          '(11, 0, 0) = 11',
68                          '(12, 0, 0) = 12',
69                          '(13, 0, 0) = 13',
70                          '(14, 0, 0) = 14',
71                          '(15, 0, 0) = 15',
72                          '(16, 0, 0) = 16',
73                          '(17, 0, 0) = 17',
74                          '(18, 0, 0) = 18',
75                          '(19, 0, 0) = 19',
76                          '(20, 0, 0) = 20',
77                          '(21, 0, 0) = 21',
78                          '(22, 0, 0) = 22',
79                          '(23, 0, 0) = 23'])
80
81    @ordered_test(1)
82    def test_allocation_dump_unsigned_types(self):
83        # uchar2
84        self.try_command('language renderscript allocation dump 21',
85                         ['(0, 0, 0) = {0x00 0x01}',
86                          '(1, 0, 0) = {0x02 0x03}',
87                          '(0, 1, 0) = {0x04 0x05}',
88                          '(1, 1, 0) = {0x06 0x07}',
89                          '(0, 2, 0) = {0x08 0x09}',
90                          '(1, 2, 0) = {0x0a 0x0b}',
91                          '(0, 3, 0) = {0x0c 0x0d}',
92                          '(1, 3, 0) = {0x0e 0x0f}',
93                          '(0, 4, 0) = {0x10 0x11}',
94                          '(1, 4, 0) = {0x12 0x13}',
95                          '(0, 5, 0) = {0x14 0x15}',
96                          '(1, 5, 0) = {0x16 0x17}'])
97
98        # uchar3
99        self.try_command('language renderscript allocation dump 22',
100                         ['(0, 0, 0) = {0x00 0x01 0x02}',
101                          '(1, 0, 0) = {0x04 0x05 0x06}',
102                          '(2, 0, 0) = {0x08 0x09 0x0a}',
103                          '(3, 0, 0) = {0x0c 0x0d 0x0e}',
104                          '(4, 0, 0) = {0x10 0x11 0x12}',
105                          '(5, 0, 0) = {0x14 0x15 0x16}'])
106
107        # uchar4
108        self.try_command('language renderscript allocation dump 23',
109                         ['(0, 0, 0) = {0x00 0x01 0x02 0x03}',
110                          '(1, 0, 0) = {0x04 0x05 0x06 0x07}',
111                          '(2, 0, 0) = {0x08 0x09 0x0a 0x0b}',
112                          '(3, 0, 0) = {0x0c 0x0d 0x0e 0x0f}',
113                          '(4, 0, 0) = {0x10 0x11 0x12 0x13}',
114                          '(5, 0, 0) = {0x14 0x15 0x16 0x17}'])
115
116        # ushort
117        self.try_command('language renderscript allocation dump 24',
118                         ['(0, 0, 0) = 0',
119                          '(1, 0, 0) = 1',
120                          '(2, 0, 0) = 2',
121                          '(3, 0, 0) = 3',
122                          '(4, 0, 0) = 4',
123                          '(5, 0, 0) = 5',
124                          '(6, 0, 0) = 6',
125                          '(7, 0, 0) = 7',
126                          '(8, 0, 0) = 8',
127                          '(9, 0, 0) = 9',
128                          '(10, 0, 0) = 10',
129                          '(11, 0, 0) = 11',
130                          '(12, 0, 0) = 12',
131                          '(13, 0, 0) = 13',
132                          '(14, 0, 0) = 14',
133                          '(15, 0, 0) = 15',
134                          '(16, 0, 0) = 16',
135                          '(17, 0, 0) = 17',
136                          '(18, 0, 0) = 18',
137                          '(19, 0, 0) = 19',
138                          '(20, 0, 0) = 20',
139                          '(21, 0, 0) = 21',
140                          '(22, 0, 0) = 22',
141                          '(23, 0, 0) = 23'])
142
143        # ushort2
144        self.try_command('language renderscript allocation dump 25',
145                         ['(0, 0, 0) = {0x0000 0x0001}',
146                          '(1, 0, 0) = {0x0002 0x0003}',
147                          '(2, 0, 0) = {0x0004 0x0005}',
148                          '(3, 0, 0) = {0x0006 0x0007}',
149                          '(4, 0, 0) = {0x0008 0x0009}',
150                          '(5, 0, 0) = {0x000a 0x000b}',
151                          '(6, 0, 0) = {0x000c 0x000d}',
152                          '(7, 0, 0) = {0x000e 0x000f}',
153                          '(8, 0, 0) = {0x0010 0x0011}',
154                          '(9, 0, 0) = {0x0012 0x0013}',
155                          '(10, 0, 0) = {0x0014 0x0015}',
156                          '(11, 0, 0) = {0x0016 0x0017}'])
157
158        # ushort3
159        self.try_command('language renderscript allocation dump 26',
160                         ['(0, 0, 0) = {0x0000 0x0001 0x0002}',
161                          '(0, 1, 0) = {0x0004 0x0005 0x0006}',
162                          '(0, 2, 0) = {0x0008 0x0009 0x000a}',
163                          '(0, 3, 0) = {0x000c 0x000d 0x000e}',
164                          '(0, 4, 0) = {0x0010 0x0011 0x0012}',
165                          '(0, 5, 0) = {0x0014 0x0015 0x0016}'])
166
167        # ushort4
168        self.try_command('language renderscript allocation dump 27',
169                         ['(0, 0, 0) = {0x0000 0x0001 0x0002 0x0003}',
170                          '(1, 0, 0) = {0x0004 0x0005 0x0006 0x0007}',
171                          '(2, 0, 0) = {0x0008 0x0009 0x000a 0x000b}',
172                          '(3, 0, 0) = {0x000c 0x000d 0x000e 0x000f}',
173                          '(4, 0, 0) = {0x0010 0x0011 0x0012 0x0013}',
174                          '(5, 0, 0) = {0x0014 0x0015 0x0016 0x0017}'])
175
176        # uint
177        self.try_command('language renderscript allocation dump 28',
178                         ['(0, 0, 0) = 0',
179                          '(1, 0, 0) = 1',
180                          '(2, 0, 0) = 2',
181                          '(3, 0, 0) = 3',
182                          '(4, 0, 0) = 4',
183                          '(5, 0, 0) = 5',
184                          '(6, 0, 0) = 6',
185                          '(7, 0, 0) = 7',
186                          '(8, 0, 0) = 8',
187                          '(9, 0, 0) = 9',
188                          '(10, 0, 0) = 10',
189                          '(11, 0, 0) = 11',
190                          '(12, 0, 0) = 12',
191                          '(13, 0, 0) = 13',
192                          '(14, 0, 0) = 14',
193                          '(15, 0, 0) = 15',
194                          '(16, 0, 0) = 16',
195                          '(17, 0, 0) = 17',
196                          '(18, 0, 0) = 18',
197                          '(19, 0, 0) = 19',
198                          '(20, 0, 0) = 20',
199                          '(21, 0, 0) = 21',
200                          '(22, 0, 0) = 22',
201                          '(23, 0, 0) = 23'])
202
203        # uint2
204        self.try_command('language renderscript allocation dump 29',
205                         ['(0, 0, 0) = {0x00000000 0x00000001}',
206                          '(1, 0, 0) = {0x00000002 0x00000003}',
207                          '(2, 0, 0) = {0x00000004 0x00000005}',
208                          '(3, 0, 0) = {0x00000006 0x00000007}',
209                          '(4, 0, 0) = {0x00000008 0x00000009}',
210                          '(5, 0, 0) = {0x0000000a 0x0000000b}',
211                          '(6, 0, 0) = {0x0000000c 0x0000000d}',
212                          '(7, 0, 0) = {0x0000000e 0x0000000f}',
213                          '(8, 0, 0) = {0x00000010 0x00000011}',
214                          '(9, 0, 0) = {0x00000012 0x00000013}',
215                          '(10, 0, 0) = {0x00000014 0x00000015}',
216                          '(11, 0, 0) = {0x00000016 0x00000017}'])
217
218        # uint3
219        self.try_command('language renderscript allocation dump 30',
220                         ['(0, 0, 0) = {0x00000000 0x00000001 0x00000002}',
221                          '(1, 0, 0) = {0x00000004 0x00000005 0x00000006}',
222                          '(2, 0, 0) = {0x00000008 0x00000009 0x0000000a}',
223                          '(3, 0, 0) = {0x0000000c 0x0000000d 0x0000000e}',
224                          '(4, 0, 0) = {0x00000010 0x00000011 0x00000012}',
225                          '(5, 0, 0) = {0x00000014 0x00000015 0x00000016}'])
226
227        # uint4
228        self.try_command('language renderscript allocation dump 31',
229                         ['(0, 0, 0) = {0x00000000 0x00000001 0x00000002 0x00000003}',
230                          '(0, 0, 1) = {0x00000004 0x00000005 0x00000006 0x00000007}',
231                          '(0, 0, 2) = {0x00000008 0x00000009 0x0000000a 0x0000000b}',
232                          '(0, 0, 3) = {0x0000000c 0x0000000d 0x0000000e 0x0000000f}',
233                          '(0, 0, 4) = {0x00000010 0x00000011 0x00000012 0x00000013}',
234                          '(0, 0, 5) = {0x00000014 0x00000015 0x00000016 0x00000017}'])
235
236        # ulong
237        self.try_command('language renderscript allocation dump 32',
238                         ['(0, 0, 0) = 0',
239                          '(1, 0, 0) = 1',
240                          '(2, 0, 0) = 2',
241                          '(3, 0, 0) = 3',
242                          '(0, 1, 0) = 4',
243                          '(1, 1, 0) = 5',
244                          '(2, 1, 0) = 6',
245                          '(3, 1, 0) = 7',
246                          '(0, 2, 0) = 8',
247                          '(1, 2, 0) = 9',
248                          '(2, 2, 0) = 10',
249                          '(3, 2, 0) = 11',
250                          '(0, 0, 1) = 12',
251                          '(1, 0, 1) = 13',
252                          '(2, 0, 1) = 14',
253                          '(3, 0, 1) = 15',
254                          '(0, 1, 1) = 16',
255                          '(1, 1, 1) = 17',
256                          '(2, 1, 1) = 18',
257                          '(3, 1, 1) = 19',
258                          '(0, 2, 1) = 20',
259                          '(1, 2, 1) = 21',
260                          '(2, 2, 1) = 22',
261                          '(3, 2, 1) = 23'])
262
263        # ulong2
264        self.try_command('language renderscript allocation dump 33',
265                         ['(0, 0, 0) = {0x0000000000000000 0x0000000000000001}',
266                          '(1, 0, 0) = {0x0000000000000002 0x0000000000000003}',
267                          '(2, 0, 0) = {0x0000000000000004 0x0000000000000005}',
268                          '(3, 0, 0) = {0x0000000000000006 0x0000000000000007}',
269                          '(4, 0, 0) = {0x0000000000000008 0x0000000000000009}',
270                          '(5, 0, 0) = {0x000000000000000a 0x000000000000000b}',
271                          '(6, 0, 0) = {0x000000000000000c 0x000000000000000d}',
272                          '(7, 0, 0) = {0x000000000000000e 0x000000000000000f}',
273                          '(8, 0, 0) = {0x0000000000000010 0x0000000000000011}',
274                          '(9, 0, 0) = {0x0000000000000012 0x0000000000000013}',
275                          '(10, 0, 0) = {0x0000000000000014 0x0000000000000015}',
276                          '(11, 0, 0) = {0x0000000000000016 0x0000000000000017}'])
277
278        # ulong3
279        self.try_command('language renderscript allocation dump 34',
280                         ['(0, 0, 0) = {0x0000000000000000 0x0000000000000001 0x0000000000000002}',
281                          '(1, 0, 0) = {0x0000000000000004 0x0000000000000005 0x0000000000000006}',
282                          '(2, 0, 0) = {0x0000000000000008 0x0000000000000009 0x000000000000000a}',
283                          '(3, 0, 0) = {0x000000000000000c 0x000000000000000d 0x000000000000000e}',
284                          '(4, 0, 0) = {0x0000000000000010 0x0000000000000011 0x0000000000000012}',
285                          '(5, 0, 0) = {0x0000000000000014 0x0000000000000015 0x0000000000000016}'])
286
287        # ulong4
288        self.try_command('language renderscript allocation dump 35',
289                         ['(0, 0, 0) = {0x0000000000000000 0x0000000000000001 '
290                                       '0x0000000000000002 0x0000000000000003}',
291                          '(1, 0, 0) = {0x0000000000000004 0x0000000000000005 '
292                                       '0x0000000000000006 0x0000000000000007}',
293                          '(2, 0, 0) = {0x0000000000000008 0x0000000000000009 '
294                                       '0x000000000000000a 0x000000000000000b}',
295                          '(3, 0, 0) = {0x000000000000000c 0x000000000000000d '
296                                       '0x000000000000000e 0x000000000000000f}',
297                          '(4, 0, 0) = {0x0000000000000010 0x0000000000000011 '
298                                       '0x0000000000000012 0x0000000000000013}',
299                          '(5, 0, 0) = {0x0000000000000014 0x0000000000000015 '
300                                       '0x0000000000000016 0x0000000000000017}'])
301
302    @wimpy
303    @ordered_test(3)
304    def test_dump_square_kernel(self):
305        self.try_command('breakpoint del 2',
306                         ['1 breakpoints deleted'])
307
308        # Hit third kernel
309        self.try_command('process continue',
310                         ['resuming',
311                          'stopped',
312                          'stop reason = breakpoint'])
313
314        # Test that uint allocation has been squared by square_kernel
315        self.try_command('language renderscript allocation dump 28',
316                         ['(0, 0, 0) = 0',
317                          '(1, 0, 0) = 1',
318                          '(2, 0, 0) = 4',
319                          '(3, 0, 0) = 9',
320                          '(4, 0, 0) = 16',
321                          '(5, 0, 0) = 25',
322                          '(6, 0, 0) = 36',
323                          '(7, 0, 0) = 49',
324                          '(8, 0, 0) = 64',
325                          '(9, 0, 0) = 81',
326                          '(10, 0, 0) = 100',
327                          '(11, 0, 0) = 121',
328                          '(12, 0, 0) = 144',
329                          '(13, 0, 0) = 169',
330                          '(14, 0, 0) = 196',
331                          '(15, 0, 0) = 225',
332                          '(16, 0, 0) = 256',
333                          '(17, 0, 0) = 289',
334                          '(18, 0, 0) = 324',
335                          '(19, 0, 0) = 361',
336                          '(20, 0, 0) = 400',
337                          '(21, 0, 0) = 441',
338                          '(22, 0, 0) = 484',
339                          '(23, 0, 0) = 529'])
340
341    @ordered_test(4)
342    def test_alloction_dump_floating_types(self):
343        # half
344        self.try_command('language renderscript allocation dump 36',
345                         ['(0, 0, 0) = 1',
346                          '(1, 0, 0) = 1.00098',
347                          '(2, 0, 0) = 1.00195',
348                          '(3, 0, 0) = 1.00293',
349                          '(4, 0, 0) = 1.00391',
350                          '(5, 0, 0) = 1.00488',
351                          '(6, 0, 0) = 1.00586',
352                          '(7, 0, 0) = 1.00684',
353                          '(8, 0, 0) = 1.00781',
354                          '(9, 0, 0) = 1.00879',
355                          '(10, 0, 0) = 1.00977',
356                          '(11, 0, 0) = 1.01074',
357                          '(12, 0, 0) = 1.01172',
358                          '(13, 0, 0) = 1.0127',
359                          '(14, 0, 0) = 1.01367',
360                          '(15, 0, 0) = 1.01465',
361                          '(16, 0, 0) = 1.0156',
362                          '(17, 0, 0) = 1.0166',
363                          '(18, 0, 0) = 1.01758',
364                          '(19, 0, 0) = 1.01855',
365                          '(20, 0, 0) = 1.01953',
366                          '(21, 0, 0) = 1.02051',
367                          '(22, 0, 0) = 1.02148',
368                          '(23, 0, 0) = 1.02246'])
369
370        # half2
371        self.try_command('language renderscript allocation dump 37',
372                         ['(0, 0, 0) = {1 1.00098}',
373                          '(1, 0, 0) = {1.00195 1.00293}',
374                          '(2, 0, 0) = {1.00391 1.00488}',
375                          '(3, 0, 0) = {1.00586 1.00684}',
376                          '(4, 0, 0) = {1.00781 1.00879}',
377                          '(5, 0, 0) = {1.00977 1.01074}',
378                          '(6, 0, 0) = {1.01172 1.0127}',
379                          '(7, 0, 0) = {1.01367 1.01465}',
380                          '(9, 0, 0) = {1.01758 1.01855}',
381                          '(10, 0, 0) = {1.01953 1.02051}',
382                          '(11, 0, 0) = {1.02148 1.02246}'],
383                          [r'\(8, 0, 0\) = \{1\.0156[23] 1\.0166\}'])
384
385        # half3
386        self.try_command('language renderscript allocation dump 38',
387                         ['(0, 0, 0) = {1 1.00098 1.00195}',
388                          '(0, 1, 0) = {1.00391 1.00488 1.00586}',
389                          '(0, 2, 0) = {1.00781 1.00879 1.00977}',
390                          '(0, 3, 0) = {1.01172 1.0127 1.01367}',
391                          '(0, 5, 0) = {1.01953 1.02051 1.02148}'],
392                        [r'\(0, 4, 0\) = \{1\.0156[23] 1\.0166 1\.01758\}'])
393
394        # half4
395        self.try_command('language renderscript allocation dump 39',
396                         ['(0, 0, 0) = {1 1.00098 1.00195 1.00293}',
397                          '(1, 0, 0) = {1.00391 1.00488 1.00586 1.00684}',
398                          '(2, 0, 0) = {1.00781 1.00879 1.00977 1.01074}',
399                          '(3, 0, 0) = {1.01172 1.0127 1.01367 1.01465}',
400                          '(5, 0, 0) = {1.01953 1.02051 1.02148 1.02246}'],
401                         [r'\(4, 0, 0\) = \{1\.0156[23] 1\.0166 1\.01758 1\.01855\}'])
402
403        # float
404        self.try_command('language renderscript allocation dump 40',
405                         ['(0, 0, 0) = inf',
406                          '(1, 0, 0) = 1',
407                          '(2, 0, 0) = 0.5',
408                          '(3, 0, 0) = 0.333333',
409                          '(4, 0, 0) = 0.25',
410                          '(5, 0, 0) = 0.2',
411                          '(6, 0, 0) = 0.166667',
412                          '(7, 0, 0) = 0.142857',
413                          '(8, 0, 0) = 0.125',
414                          '(9, 0, 0) = 0.111111',
415                          '(10, 0, 0) = 0.1',
416                          '(11, 0, 0) = 0.0909091',
417                          '(12, 0, 0) = 0.0833333',
418                          '(13, 0, 0) = 0.0769231',
419                          '(14, 0, 0) = 0.0714286',
420                          '(15, 0, 0) = 0.0666667',
421                          '(16, 0, 0) = 0.0625',
422                          '(17, 0, 0) = 0.0588235',
423                          '(18, 0, 0) = 0.0555556',
424                          '(19, 0, 0) = 0.0526316',
425                          '(20, 0, 0) = 0.05',
426                          '(21, 0, 0) = 0.047619',
427                          '(22, 0, 0) = 0.0454545',
428                          '(23, 0, 0) = 0.0434783'])
429
430        # float2
431        self.try_command('language renderscript allocation dump 41',
432                         ['(0, 0, 0) = {inf 1}',
433                          '(1, 0, 0) = {0.5 0.333333}',
434                          '(2, 0, 0) = {0.25 0.2}',
435                          '(3, 0, 0) = {0.166667 0.142857}',
436                          '(4, 0, 0) = {0.125 0.111111}',
437                          '(5, 0, 0) = {0.1 0.0909091}',
438                          '(6, 0, 0) = {0.0833333 0.0769231}',
439                          '(7, 0, 0) = {0.0714286 0.0666667}',
440                          '(8, 0, 0) = {0.0625 0.0588235}',
441                          '(9, 0, 0) = {0.0555556 0.0526316}',
442                          '(10, 0, 0) = {0.05 0.047619}',
443                          '(11, 0, 0) = {0.0454545 0.0434783}'])
444
445        # float3
446        self.try_command('language renderscript allocation dump 42',
447                         ['(0, 0, 0) = {inf 1 0.5}',
448                          '(1, 0, 0) = {0.25 0.2 0.166667}',
449                          '(2, 0, 0) = {0.125 0.111111 0.1}',
450                          '(3, 0, 0) = {0.0833333 0.0769231 0.0714286}',
451                          '(4, 0, 0) = {0.0625 0.0588235 0.0555556}',
452                          '(5, 0, 0) = {0.05 0.047619 0.0454545}'])
453
454        # float4
455        self.try_command('language renderscript allocation dump 43',
456                         ['(0, 0, 0) = {inf 1 0.5 0.333333}',
457                          '(1, 0, 0) = {0.25 0.2 0.166667 0.142857}',
458                          '(2, 0, 0) = {0.125 0.111111 0.1 0.0909091}',
459                          '(0, 1, 0) = {0.0833333 0.0769231 0.0714286 0.0666667}',
460                          '(1, 1, 0) = {0.0625 0.0588235 0.0555556 0.0526316}',
461                          '(2, 1, 0) = {0.05 0.047619 0.0454545 0.0434783}'])
462
463        # double
464        self.try_command('language renderscript allocation dump 44',
465                         ['(0, 0, 0) = inf',
466                          '(1, 0, 0) = 1',
467                          '(2, 0, 0) = 0.5',
468                          '(3, 0, 0) = 0.333333333333333',
469                          '(4, 0, 0) = 0.25',
470                          '(5, 0, 0) = 0.2',
471                          '(6, 0, 0) = 0.166666666666667',
472                          '(7, 0, 0) = 0.142857142857143',
473                          '(8, 0, 0) = 0.125',
474                          '(9, 0, 0) = 0.111111111111111',
475                          '(10, 0, 0) = 0.1',
476                          '(11, 0, 0) = 0.0909090909090909',
477                          '(12, 0, 0) = 0.0833333333333333',
478                          '(13, 0, 0) = 0.0769230769230769',
479                          '(14, 0, 0) = 0.0714285714285714',
480                          '(15, 0, 0) = 0.0666666666666667',
481                          '(16, 0, 0) = 0.0625',
482                          '(17, 0, 0) = 0.0588235294117647',
483                          '(18, 0, 0) = 0.0555555555555556',
484                          '(19, 0, 0) = 0.0526315789473684',
485                          '(20, 0, 0) = 0.05',
486                          '(21, 0, 0) = 0.0476190476190476',
487                          '(22, 0, 0) = 0.0454545454545455',
488                          '(23, 0, 0) = 0.0434782608695652'])
489
490        # double2
491        self.try_command('language renderscript allocation dump 45',
492                         ['(0, 0, 0) = {inf 1}',
493                          '(1, 0, 0) = {0.5 0.333333333333333}',
494                          '(2, 0, 0) = {0.25 0.2}',
495                          '(3, 0, 0) = {0.166666666666667 0.142857142857143}',
496                          '(0, 0, 1) = {0.125 0.111111111111111}',
497                          '(1, 0, 1) = {0.1 0.0909090909090909}',
498                          '(2, 0, 1) = {0.0833333333333333 0.0769230769230769}',
499                          '(3, 0, 1) = {0.0714285714285714 0.0666666666666667}',
500                          '(0, 0, 2) = {0.0625 0.0588235294117647}',
501                          '(1, 0, 2) = {0.0555555555555556 0.0526315789473684}',
502                          '(2, 0, 2) = {0.05 0.0476190476190476}',
503                          '(3, 0, 2) = {0.0454545454545455 0.0434782608695652}'])
504
505        # double3
506        self.try_command('language renderscript allocation dump 46',
507                         ['(0, 0, 0) = {inf 1 0.5}',
508                          '(0, 1, 0) = {0.25 0.2 0.166666666666667}',
509                          '(0, 0, 1) = {0.125 0.111111111111111 0.1}',
510                          '(0, 1, 1) = {0.0833333333333333 0.0769230769230769 '
511                                       '0.0714285714285714}',
512                          '(0, 0, 2) = {0.0625 0.0588235294117647 0.0555555555555556}',
513                          '(0, 1, 2) = {0.05 0.0476190476190476 0.0454545454545455}'])
514
515        # double4
516        self.try_command('language renderscript allocation dump 47',
517                         ['(0, 0, 0) = {inf 1 0.5 0.333333333333333}',
518                          '(0, 1, 0) = {0.25 0.2 0.166666666666667 0.142857142857143}',
519                          '(0, 0, 1) = {0.125 0.111111111111111 0.1 0.0909090909090909}',
520                          '(0, 1, 1) = {0.0833333333333333 0.0769230769230769 '
521                                       '0.0714285714285714 0.0666666666666667}',
522                          '(0, 0, 2) = {0.0625 0.0588235294117647 '
523                                       '0.0555555555555556 0.0526315789473684}',
524                          '(0, 1, 2) = {0.05 0.0476190476190476 '
525                                       '0.0454545454545455 0.0434782608695652}'])
526
527    @wimpy
528    @ordered_test(5)
529    def test_allocation_dump_half_kernel(self):
530        # Delete kernel breakpoint on add_half_kernel
531        self.try_command('breakpoint del 3',
532                         ['1 breakpoints deleted'])
533
534        # Hit struct_kernel
535        self.try_command('process continue',
536                         ['resuming',
537                          'stopped',
538                          'stop reason = breakpoint'])
539
540        # Double 3 has been modified by add_half_kernel
541        self.try_command('language renderscript allocation dump 46',
542                         ['(0, 0, 0) = {inf 1.5 1}',
543                          '(0, 1, 0) = {0.75 0.7 0.666666666666667}',
544                          '(0, 0, 1) = {0.625 0.611111111111111 0.6}',
545                          '(0, 1, 1) = {0.583333333333333 0.576923076923077 0.571428571428571}',
546                          '(0, 0, 2) = {0.5625 0.558823529411765 0.555555555555556}',
547                          '(0, 1, 2) = {0.55 0.547619047619048 0.545454545454545}'])
548
549        # Floating point allocation data should have been overwritten
550        self.try_command('language renderscript allocation dump 40',
551                         ['(0, 0, 0) = -inf',
552                          '(1, 0, 0) = -1',
553                          '(2, 0, 0) = -0.5',
554                          '(3, 0, 0) = -0.333333',
555                          '(4, 0, 0) = -0.25',
556                          '(5, 0, 0) = -0.2',
557                          '(6, 0, 0) = -0.166667',
558                          '(7, 0, 0) = -0.142857',
559                          '(8, 0, 0) = -0.125',
560                          '(9, 0, 0) = -0.111111',
561                          '(10, 0, 0) = -0.1',
562                          '(11, 0, 0) = -0.0909091',
563                          '(12, 0, 0) = -0.0833333',
564                          '(13, 0, 0) = -0.0769231',
565                          '(14, 0, 0) = -0.0714286',
566                          '(15, 0, 0) = -0.0666667',
567                          '(16, 0, 0) = -0.0625',
568                          '(17, 0, 0) = -0.0588235',
569                          '(18, 0, 0) = -0.0555556',
570                          '(19, 0, 0) = -0.0526316',
571                          '(20, 0, 0) = -0.05',
572                          '(21, 0, 0) = -0.047619',
573                          '(22, 0, 0) = -0.0454545',
574                          '(23, 0, 0) = -0.0434783'])
575
576        self.try_command('language renderscript allocation dump 41',
577                         ['(0, 0, 0) = {-inf -1}',
578                          '(1, 0, 0) = {-0.5 -0.333333}',
579                          '(2, 0, 0) = {-0.25 -0.2}',
580                          '(3, 0, 0) = {-0.166667 -0.142857}',
581                          '(4, 0, 0) = {-0.125 -0.111111}',
582                          '(5, 0, 0) = {-0.1 -0.0909091}',
583                          '(6, 0, 0) = {-0.0833333 -0.0769231}',
584                          '(7, 0, 0) = {-0.0714286 -0.0666667}',
585                          '(8, 0, 0) = {-0.0625 -0.0588235}',
586                          '(9, 0, 0) = {-0.0555556 -0.0526316}',
587                          '(10, 0, 0) = {-0.05 -0.047619}',
588                          '(11, 0, 0) = {-0.0454545 -0.0434783}'])
589
590        self.try_command('language renderscript allocation dump 42',
591                         ['(0, 0, 0) = {-inf -1 -0.5}',
592                          '(1, 0, 0) = {-0.25 -0.2 -0.166667}',
593                          '(2, 0, 0) = {-0.125 -0.111111 -0.1}',
594                          '(3, 0, 0) = {-0.0833333 -0.0769231 -0.0714286}',
595                          '(4, 0, 0) = {-0.0625 -0.0588235 -0.0555556}',
596                          '(5, 0, 0) = {-0.05 -0.047619 -0.0454545}'])
597
598        self.try_command('language renderscript allocation dump 43',
599                         ['(0, 0, 0) = {-inf -1 -0.5 -0.333333}',
600                          '(1, 0, 0) = {-0.25 -0.2 -0.166667 -0.142857}',
601                          '(2, 0, 0) = {-0.125 -0.111111 -0.1 -0.0909091}',
602                          '(0, 1, 0) = {-0.0833333 -0.0769231 -0.0714286 -0.0666667}',
603                          '(1, 1, 0) = {-0.0625 -0.0588235 -0.0555556 -0.0526316}',
604                          '(2, 1, 0) = {-0.05 -0.047619 -0.0454545 -0.0434783}'])
605