15bbcc3861c44435f89481f80946ef5c9c49968f2Luke Drummond# Copyright (C) 2016 The Android Open Source Project
25bbcc3861c44435f89481f80946ef5c9c49968f2Luke Drummond#
35bbcc3861c44435f89481f80946ef5c9c49968f2Luke Drummond# Licensed under the Apache License, Version 2.0 (the "License");
45bbcc3861c44435f89481f80946ef5c9c49968f2Luke Drummond# you may not use this file except in compliance with the License.
55bbcc3861c44435f89481f80946ef5c9c49968f2Luke Drummond# You may obtain a copy of the License at
65bbcc3861c44435f89481f80946ef5c9c49968f2Luke Drummond#
75bbcc3861c44435f89481f80946ef5c9c49968f2Luke Drummond#      http://www.apache.org/licenses/LICENSE-2.0
85bbcc3861c44435f89481f80946ef5c9c49968f2Luke Drummond#
95bbcc3861c44435f89481f80946ef5c9c49968f2Luke Drummond# Unless required by applicable law or agreed to in writing, software
105bbcc3861c44435f89481f80946ef5c9c49968f2Luke Drummond# distributed under the License is distributed on an "AS IS" BASIS,
115bbcc3861c44435f89481f80946ef5c9c49968f2Luke Drummond# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
125bbcc3861c44435f89481f80946ef5c9c49968f2Luke Drummond# See the License for the specific language governing permissions and
135bbcc3861c44435f89481f80946ef5c9c49968f2Luke Drummond# limitations under the License.
145bbcc3861c44435f89481f80946ef5c9c49968f2Luke Drummond
15a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond'''Module that contains the test TestBreakpointFileLine.'''
16dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo
17a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummondfrom __future__ import absolute_import
18dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo
19a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummondfrom harness.test_base_remote import TestBaseRemote
20a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummondfrom harness.decorators import (
21a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond    cpp_only_test,
22a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond    ordered_test
23a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond)
24dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo
25dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo
26a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummondclass TestBreakpointFileLine(TestBaseRemote):
27a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond    '''Tests the setting of a breakpoint on a specific line of a RS file.'''
28dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo
29a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond    bundle_target = {
30a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond        'java': 'JavaDebugWaitAttach',
31a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond        'jni': 'JNIDebugWaitAttach',
32a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond        'cpp': 'CppDebugWaitAttach'
33a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond    }
34dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo
35a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond    @ordered_test(0)
36a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond    def test_breakpoint_fileline(self):
37dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo        self.try_command('language renderscript status',
38dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo                         ['Runtime Library discovered',
39dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo                          'Runtime Driver discovered'])
40dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo
41a8b6960a8815bb1fff74c1d9dcf4c572a7a831d9Luke Drummond        self.try_command('breakpoint set --file simple.rs --line 28',
42dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo                         ['(pending)'])
43dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo
44dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo        self.try_command('process continue',
45dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo                         [])
46dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo
47dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo        self.try_command('bt',
48dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo                         ['librs.simple.so',
49dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo                          'simple_kernel',
50dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo                          'stop reason = breakpoint'])
51dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo
52dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo        self.try_command('breakpoint list',
53dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo                         ['simple.rs',
54dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo                          'resolved = 1'])
55dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo
56dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo        self.try_command('process status',
57dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo                         ['stopped',
58dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo                          'stop reason = breakpoint'])
59dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo
60dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo        self.try_command('breakpoint delete 1',
61dcecc0c8d22e894525e25a122ce25129b51338f2Dean De Leo                         ['1 breakpoints deleted'])
62a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond
63a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond    @ordered_test('last')
64a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond    @cpp_only_test()
65a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond    def test_cpp_cleanup(self):
66a3c6f62775506c95afd556e617f14d7a28839f01Luke Drummond        self.try_command('process continue', ['exited with status = 0'])
67