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 TestBreakpointKernelAll.''' 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 TestBreakpointKernelAll(TestBaseRemote): 27 '''Tests setting breakpoints on every RS kernel.''' 28 29 bundle_target = { 30 'java': 'JavaDebugWaitAttach', 31 'jni': 'JNIDebugWaitAttach', 32 'cpp': 'CppDebugWaitAttach' 33 } 34 35 @ordered_test(0) 36 def test_kernel_breakpoint_all_unloaded_kernels(self): 37 # Test command works with no kernels currently loaded 38 self.try_command('language renderscript kernel breakpoint all enable', 39 ['Breakpoints will be set on all kernels']) 40 41 self.try_command('process continue', 42 ['resuming', 43 'stopped', 44 'stop reason = breakpoint']) 45 46 self.try_command('breakpoint list', 47 ["'simple_kernel', locations = 1, resolved = 1", 48 "'other_kernel', locations = 1, resolved = 1"]) 49 50 # Check disable doesn't delete breakpoints 51 self.try_command('language renderscript kernel breakpoint all disable', 52 ['Breakpoints will not be set on any new kernels']) 53 54 # Delete all breakpoints manually 55 self.try_command('breakpoint delete 1', 56 ['1 breakpoints deleted']) 57 58 self.try_command('breakpoint delete 2', 59 ['1 breakpoints deleted']) 60 61 self.try_command('breakpoint list', 62 ["No breakpoints currently set"]) 63 64 # Test command works when kernels are loaded 65 self.try_command('language renderscript kernel breakpoint all enable', 66 ['Breakpoints will be set on all kernels']) 67 68 self.try_command('breakpoint list', 69 ["'simple_kernel', locations = 1, resolved = 1", 70 "'other_kernel', locations = 1, resolved = 1"]) 71 72 self.try_command('process continue', 73 ['resuming', 74 'stopped', 75 'stop reason = breakpoint']) 76 77 self.try_command('breakpoint delete 3', 78 ['1 breakpoints deleted']) 79 80 # Check other_kernel breakpoint gets hit 81 self.try_command('breakpoint list', 82 ["'other_kernel', locations = 1, resolved = 1"]) 83 84 self.try_command('process continue', 85 ['resuming', 86 'stopped', 87 'stop reason = breakpoint']) 88 89 @ordered_test('last') 90 @cpp_only_test() 91 def test_cpp_cleanup(self): 92 self.try_command('breakpoint delete 4', ['1 breakpoints deleted']) 93 94 self.try_command('process continue', ['exited with status = 0']) 95