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 TestBreakpointKernelAllMultipleRSFiles.''' 16 17from __future__ import absolute_import 18 19from harness.test_base_remote import TestBaseRemote 20from harness.decorators import ( 21 wimpy, 22 ordered_test, 23 cpp_only_test, 24) 25 26 27class TestBreakpointKernelAllMultipleRSFiles(TestBaseRemote): 28 '''Tests setting breakpoints on every RS kernel in multiple kernel files.''' 29 30 bundle_target = { 31 'java': 'MultipleRSFiles', 32 'jni': 'JNIMultipleRSFiles', 33 'cpp': 'CppMultipleRSFiles' 34 } 35 36 @ordered_test(0) 37 def test_deferred_breakpoint_resolution(self): 38 # Test command works with no kernels currently loaded 39 self.try_command('language renderscript kernel breakpoint all enable', 40 ['Breakpoints will be set on all kernels']) 41 42 self.try_command('process continue', 43 ['resuming', 44 'stopped', 45 'stop reason = breakpoint']) 46 47 self.try_command('breakpoint list', 48 ["'first_kernel', locations = 1, resolved = 1", 49 "'second_kernel', locations = 1, resolved = 1"]) 50 51 @ordered_test(1) 52 def test_disable_all_kernel_breakpoint_doesnt_delete_breakpoints(self): 53 # Check disable doesn't delete breakpoints 54 self.try_command('language renderscript kernel breakpoint all disable', 55 ['Breakpoints will not be set on any new kernels']) 56 57 # Delete all breakpoints manually 58 self.try_command('breakpoint delete 1', 59 ['1 breakpoints deleted']) 60 61 self.try_command('breakpoint delete 2', 62 ['1 breakpoints deleted']) 63 64 self.try_command('breakpoint list', 65 ["No breakpoints currently set"]) 66 67 @ordered_test(2) 68 def test_enable_breakpoint_on_loaded_kernels(self): 69 # Test command works when kernels are loaded 70 self.try_command('language renderscript kernel breakpoint all enable', 71 ['Breakpoints will be set on all kernels']) 72 73 self.try_command('breakpoint list', 74 ["'first_kernel', locations = 1, resolved = 1", 75 "'second_kernel', locations = 1, resolved = 1"]) 76 77 self.try_command('process continue', 78 ['resuming', 79 'stopped', 80 'stop reason = breakpoint']) 81 82 self.try_command('breakpoint delete 3', 83 ['1 breakpoints deleted']) 84 85 # Check other_kernel breakpoint gets hit 86 self.try_command('breakpoint list', 87 ["'second_kernel', locations = 1, resolved = 1"]) 88 89 self.try_command('process continue', 90 ['resuming', 91 'stopped', 92 'stop reason = breakpoint']) 93 94 @ordered_test('last') 95 @cpp_only_test() 96 def test_cpp_cleanup(self): 97 self.try_command('breakpoint delete 4', ['1 breakpoints deleted']) 98 99 self.try_command('process continue', ['exited with status = 0']) 100 101