• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 TestBreakpointKernelMultipleRSFiles.'''
16
17from __future__ import absolute_import
18
19from harness.test_base_remote import TestBaseRemote
20from harness.decorators import (
21    ordered_test,
22    cpp_only_test
23)
24
25
26class TestBreakpointKernelMultipleRSFiles(TestBaseRemote):
27    '''Tests the setting of a breakpoint on RS kernels in multiple files.'''
28
29    bundle_target = {
30        'java': 'MultipleRSFiles',
31        'jni': 'JNIMultipleRSFiles',
32        'cpp': 'CppMultipleRSFiles'
33    }
34
35    def _binary_name(self):
36        return {
37             'java': 'multiplersfiles',
38             'jni': 'multiplersfiles',
39             'cpp': 'CppMultipleRSFi'
40         }[self.app_type]
41
42    def test_kernel_breakpoint_multiple_rs_files(self):
43        # pylint: disable=line-too-long
44        self.try_command('language renderscript kernel breakpoint set first_kernel',
45                         ['Breakpoint(s) created',
46                          '(pending)'])
47
48        self.try_command('breakpoint list',
49                         ["'first_kernel', locations = 0 (pending)"])
50
51        self.try_command('process continue',
52                         ['stopped',
53                          'librs.first.so`first_kernel',
54                          "name = '%s'" % self._binary_name(),
55                          'stop reason = breakpoint 1'],
56                          [r'at first\.rs:2[678]'])
57
58        self.try_command('breakpoint list',
59                         ["'first_kernel', locations = 1, resolved = 1"])
60
61        self.try_command('language renderscript kernel breakpoint set second_kernel',
62                         ['Breakpoint(s) created',
63                          'Breakpoint 2',
64                          'Breakpoint(s) created'],
65                          [r"librs\.second\.so`second_kernel at second\.rs:2[012]",])
66
67        self.try_command('breakpoint list',
68                         ["'first_kernel', locations = 1, resolved = 1",
69                          "'second_kernel', locations = 1, resolved = 1"])
70
71        self.try_command('breakpoint delete 1',
72                         ['1 breakpoints deleted'])
73
74        self.try_command('breakpoint list',
75                         ["'second_kernel', locations = 1, resolved = 1"])
76
77        self.try_command('process continue',
78                         ['resuming',
79                          'stopped',
80                          'stop reason = breakpoint',
81                          "librs.second.so`second_kernel"],
82                          [r'second\.rs:2[012]'])
83
84        self.try_command('breakpoint delete 2',
85                         ['1 breakpoints deleted'])
86
87        self.try_command('breakpoint list',
88                         ['No breakpoints currently set'])
89
90    @ordered_test('last')
91    @cpp_only_test()
92    def test_cpp_cleanup(self):
93        self.try_command('process continue', ['exited with status = 0'])
94