Merge branch 'master' into merge-job
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.rocm / bit_extract_asm.exp
1 # Copyright 2019-2020 Free Software Foundation, Inc.
2 # Copyright (C) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 load_lib rocm.exp
17
18 set testfile "bit_extract_asm"
19 set srcfile ${srcdir}/${subdir}/${testfile}.S
20 set objfile [standard_output_file ${testfile}.o]
21 set binfile [standard_output_file ${testfile}]
22
23 # Set device info
24 set ISA "vega10"
25
26 # Check if skip hip tests
27 if [skip_hipcc_tests] {
28 verbose "Skipping hip test: ${testfile}."
29 return 0
30 }
31
32 # Assemble the hip program
33 set asm-flags ""
34 set debug-flags ""
35 if {[target_assemble $srcfile $objfile "${asm-flags} ${debug-flags}"] != ""} then {
36 untested "failed to assemble"
37 return -1
38 }
39
40 # Link the hip program
41 # TODO: The link flags may need some pruning
42 set link-flags "-z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/8/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/8 -L/usr/lib/x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib -L/opt/rocm/llvm/lib -L/lib -L/usr/lib -lhip_hcc -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/8/crtend.o /usr/lib/x86_64-linux-gnu/crtn.o -L/opt/rocm/lib -lstdc++"
43 if {[target_link $objfile $binfile "${link-flags}"] != "" } then {
44 untested "failed to link"
45 return -1
46 }
47
48 gdb_exit
49 gdb_start
50
51 # Load the hip program
52 if {[gdb_load ${binfile}] == -1} {
53 verbose "failed to load program ${testfile}."
54 return -1
55 }
56
57 # Run to main and break
58 if ![runto_main] {
59 fail "can't run to main and break in program ${testfile}."
60 return -1
61 }
62
63 # Set breakpoing in device code
64 gdb_breakpoint "bit_extract_kernel" "allow-pending"
65 gdb_continue_to_breakpoint "bit_extract_kernel"
66
67 # Check info agents
68 # vega10 56 sample output "1 43:00.0 vega10 4 56 4 10"
69 gdb_test_sequence "info agents" "info agents" {
70 {Id\s+PCI Slot\s+Device Name\s+Shader Engines\s+Compute Units\s+SIMD/CU\s+Wavefronts/SIMD}
71 {\d\s+\d+:\d+\.\d\s+\w+\d+\s+\d+\s+\d+\s+\d+\s+\d}
72 }
73
74 # Check continue at device breakpoint in all-stop mode
75 gdb_test "c" ".+hit\\s+Breakpoint.+bit_extract_kernel\\(.*"
76
77 # Check info threads
78 gdb_test_sequence "info threads" "info threads" {
79 "\\d+\\s+Thread"
80 }
81
82 gdb_exit
This page took 0.057453 seconds and 4 git commands to generate.