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 TestBreakpointKernel1.''' 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 TestBreakpointKernel1(TestBaseRemote): 27 '''Tests the setting of a breakpoint on a RS kernel.''' 28 29 bundle_target = { 30 'java': 'JavaDebugWaitAttach', 31 'jni': 'JNIDebugWaitAttach', 32 'cpp': 'CppDebugWaitAttach' 33 } 34 35 @ordered_test(0) 36 def test_breakpoint_set_nonexistent_kernel(self): 37 # pylint: disable=line-too-long 38 self.try_command('language renderscript status', 39 ['Runtime Library discovered', 40 'Runtime Driver discovered']) 41 42 self.try_command('language renderscript kernel breakpoint set simple_kernel', 43 ['Breakpoint(s) created', 44 '(pending)']) 45 46 # Try set a breakpoint on a kernel which doesn't exist 47 self.try_command('language renderscript kernel breakpoint set imaginary_kernel', 48 ['Breakpoint(s) created', 49 '(pending)']) 50 51 self.try_command('breakpoint list', 52 ["'simple_kernel', locations = 0 (pending)", 53 "'imaginary_kernel', locations = 0 (pending)"]) 54 55 self.try_command('process continue', 56 ['resuming', 57 'stopped', 58 'stop reason = breakpoint']) 59 60 self.try_command('bt', 61 ['stop reason = breakpoint', 62 'frame #0:', 63 'librs.simple.so', 64 'simple_kernel']) 65 66 self.try_command('breakpoint list', 67 ["'imaginary_kernel', locations = 0 (pending)", 68 "'simple_kernel', locations = 1, resolved = 1"]) 69 70 @ordered_test(1) 71 def test_breakpoint_delete_nonexistent_kernel(self): 72 # Delete breakpoint on kernel which doesn't exist 73 self.try_command('breakpoint delete 2', 74 ['1 breakpoints deleted']) 75 76 self.try_command('breakpoint list', 77 ["'simple_kernel', locations = 1, resolved = 1"]) 78 79 self.try_command('process continue', 80 ['resuming', 81 'stopped', 82 'stop reason = breakpoint']) 83 84 self.try_command('breakpoint list', 85 ["'simple_kernel', locations = 1, resolved = 1"]) 86 87 self.try_command('breakpoint delete 1', 88 ['1 breakpoints deleted']) 89 90 self.try_command('breakpoint list', 91 ['No breakpoints currently set']) 92 93 @ordered_test('last') 94 @cpp_only_test() 95 def test_cpp_cleanup(self): 96 self.try_command('process continue', ['exited with status = 0']) 97