From 7f71e60363820c72ed693f22bdd589a4a51b69cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cbhkumarn=E2=80=9D?= Date: Fri, 16 Apr 2021 12:18:54 +0530 Subject: [PATCH] [gdb.fortran] test case modified to suit the clang behavior. As mentioned in the test case itself, depending on the fortran compiler used, class member names used in the print commands and also output of these print commands varies. Existing print commands and its output are suited for gfortran, hence they were failing with clang compiler and test case was modified accordingly for clang compiler. gdb/testsuite/ChangeLog: * gdb.base/class-allocatable-array.exp: Modified test for clang. --- gdb/testsuite/ChangeLog | 6 +++++- .../gdb.fortran/class-allocatable-array.exp | 13 ++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 216d985995..0aecac7a62 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2021-04-16 Bhuvanendra Kumar + + * gdb.base/class-allocatable-array.exp: Modified test for clang. + 2021-04-16 Bhuvanendra Kumar * gdb.fortran/ptype-on-functions.exp: Add type info of formal parameter for clang. Also removed the kind parameter for clang. @@ -5,7 +9,7 @@ diff --git a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp index d2e3064942..e58bb164b9 100644 --- a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp +++ b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp @@ -38,6 +38,13 @@ gdb_continue_to_breakpoint "Break Here" # different names, or maybe a completely different approach, for # representing class like structures. The following tests are # cetainly going to fail. -gdb_test "print this" " = \\( _data = \[^\r\n\]+, _vptr = \[^\r\n\]+\\)" -gdb_test "print this%_data" " = \\(PTR TO -> \\( Type test_type \\)\\) \[^\r\n\]+" -gdb_test "print this%_data%b" " = \\(\\(1, 2, 3\\) \\(4, 5, 6\\)\\)" +# Hence the test case is modified for clang +if {[test_compiler_info {clang-*}]} { + gdb_test "print this" " = \\( a = 0, b = \\(\\(1, 2, 3\\) \\(4, 5, 6\\)\\) \\)" + gdb_test "print this%a" " = 0" + gdb_test "print this%b" " = \\(\\(1, 2, 3\\) \\(4, 5, 6\\)\\)" +} else { + gdb_test "print this" " = \\( _data = \[^\r\n\]+, _vptr = \[^\r\n\]+\\)" + gdb_test "print this%_data" " = \\(PTR TO -> \\( Type test_type \\)\\) \[^\r\n\]+" + gdb_test "print this%_data%b" " = \\(\\(1, 2, 3\\) \\(4, 5, 6\\)\\)" +} -- 2.17.1