public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed 1/4] [gdb/testsuite] Fix false negative in have_host_locale
@ 2023-08-29 15:27 Tom de Vries
  2023-08-29 15:27 ` [pushed 2/4] [gdb/testsuite] Handle some test-cases with older compiler Tom de Vries
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tom de Vries @ 2023-08-29 15:27 UTC (permalink / raw)
  To: gdb-patches

In test-case gdb.tui/pr30056.exp we check for:
...
require {have_host_locale C.UTF-8}
...

The "C.UTF-8" is normalized by have_host_locale to "c.utf8", before trying to
find it in the list returned by host_locales.

On my development platform, "locale -a" lists C.utf8, which is normalized to
"c.utf8" by host_locales, so there's a match and have_host_locale returns true.

On another platform however, "locale -a" lists C.UTF-8, which is normalized to
"c.utf-8" by host_locales, so there's no match and have_host_locale returns false.

Fix this by also dropping the dash in host_locales.

Tested on x86_64-linux.
---
 gdb/testsuite/lib/gdb.exp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index bcf536e0cc5..1b9179401c4 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -9936,6 +9936,8 @@ gdb_caching_proc host_locales { } {
 
     # Normalize items to lower-case.
     set l [lmap v $l { string tolower $v }]
+    # Normalize items to without dash.
+    set l [lmap v $l { string map { "-" "" } $v }]
 
     return $l
 }

base-commit: 130e33d8617e7663b397f35d34f3c2b2f48d9cfc
-- 
2.35.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed 2/4] [gdb/testsuite] Handle some test-cases with older compiler
  2023-08-29 15:27 [pushed 1/4] [gdb/testsuite] Fix false negative in have_host_locale Tom de Vries
@ 2023-08-29 15:27 ` Tom de Vries
  2023-08-29 15:27 ` [pushed 3/4] [gdb/testsuite] Require gcc >= 5 in gdb.linespec/cpls-abi-tag.exp Tom de Vries
  2023-08-29 15:27 ` [pushed 4/4] [gdb/testsuite] Require have_compile_flag -mavx512f in gdb.arch/i386-avx512.exp Tom de Vries
  2 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2023-08-29 15:27 UTC (permalink / raw)
  To: gdb-patches

When running test-case gdb.mi/print-simple-values.exp with gcc 4.8.4, I run
into a compilation failure due to the test-case requiring c++11 and the
compiler defaulting to less than that.

Fix this by compiling with -std=c++11.

Likewise in a few other test-cases.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp     | 6 +++++-
 gdb/testsuite/gdb.dwarf2/nullptr_t.exp         | 7 ++++++-
 gdb/testsuite/gdb.fortran/mixed-lang-stack.exp | 2 +-
 gdb/testsuite/gdb.linespec/cpcompletion.exp    | 6 +++++-
 gdb/testsuite/gdb.mi/print-simple-values.exp   | 7 ++++++-
 5 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp
index 6fffc982722..f2b0b7204c3 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp
@@ -17,8 +17,12 @@ load_lib dwarf.exp
 
 standard_testfile index.cc
 
+set opts {}
+lappend opts debug
+lappend opts additional_flags=-std=c++11
+
 if {[prepare_for_testing "failed to prepare" "${testfile}" \
-	 [list ${srcfile}]]} {
+	 [list ${srcfile}] $opts]} {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/nullptr_t.exp b/gdb/testsuite/gdb.dwarf2/nullptr_t.exp
index c40c7677f7f..df2f163af38 100644
--- a/gdb/testsuite/gdb.dwarf2/nullptr_t.exp
+++ b/gdb/testsuite/gdb.dwarf2/nullptr_t.exp
@@ -17,7 +17,12 @@ require allow_cplus_tests
 
 standard_testfile .cc
 
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}] {
+set opts {}
+lappend opts debug
+lappend opts c++
+lappend opts additional_flags=-std=c++11
+
+if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
index 5fc36f7b95b..3973f68c666 100644
--- a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
+++ b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
@@ -30,7 +30,7 @@ standard_testfile mixed-lang-stack.c mixed-lang-stack.cpp mixed-lang-stack.f90
 if {[prepare_for_testing_full "failed to prepare" \
 	 [list ${binfile} {debug f90 additional_flags=-lstdc++} \
 	      $srcfile {debug} \
-	      $srcfile2 {debug c++} \
+	      $srcfile2 {debug c++ additional_flags=-std=c++11} \
 	      $srcfile3 {debug f90}]]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.linespec/cpcompletion.exp b/gdb/testsuite/gdb.linespec/cpcompletion.exp
index f005707b9da..23bec063941 100644
--- a/gdb/testsuite/gdb.linespec/cpcompletion.exp
+++ b/gdb/testsuite/gdb.linespec/cpcompletion.exp
@@ -20,8 +20,12 @@ load_lib data-structures.exp
 
 standard_testfile cpls.cc cpls2.cc cpls-hyphen.cc
 
+set opts {}
+lappend opts debug
+lappend opts additional_flags=-std=c++11
+
 if {[prepare_for_testing "failed to prepare" $testfile \
-	 [list $srcfile $srcfile2 $srcfile3] {debug}]} {
+	 [list $srcfile $srcfile2 $srcfile3] $opts]} {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.mi/print-simple-values.exp b/gdb/testsuite/gdb.mi/print-simple-values.exp
index 9436645df84..267cf369567 100644
--- a/gdb/testsuite/gdb.mi/print-simple-values.exp
+++ b/gdb/testsuite/gdb.mi/print-simple-values.exp
@@ -25,7 +25,12 @@ set MIFLAGS "-i=mi"
 
 standard_testfile .cc
 
-if [build_executable "failed to prepare" $testfile $srcfile {debug c++}] {
+set opts {}
+lappend opts debug
+lappend opts c++
+lappend opts additional_flags=-std=c++11
+
+if [build_executable "failed to prepare" $testfile $srcfile $opts] {
     return -1
 }
 
-- 
2.35.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed 3/4] [gdb/testsuite] Require gcc >= 5 in gdb.linespec/cpls-abi-tag.exp
  2023-08-29 15:27 [pushed 1/4] [gdb/testsuite] Fix false negative in have_host_locale Tom de Vries
  2023-08-29 15:27 ` [pushed 2/4] [gdb/testsuite] Handle some test-cases with older compiler Tom de Vries
@ 2023-08-29 15:27 ` Tom de Vries
  2023-08-29 15:27 ` [pushed 4/4] [gdb/testsuite] Require have_compile_flag -mavx512f in gdb.arch/i386-avx512.exp Tom de Vries
  2 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2023-08-29 15:27 UTC (permalink / raw)
  To: gdb-patches

When running test-case gdb.linespec/cpls-abi-tag.exp with gcc 4.8.4, we run
into:
...
cpls-abi-tag.cc:71:26: error: ‘abi_tag’ attribute applied to non-function ‘s’
 ABI3 test_abi_tag_struct s;
                          ^
...

The test-case is supported starting gcc 5.

Fix this by requiring gcc >= 5, if a gcc compiler is used.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.linespec/cpls-abi-tag.exp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp b/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
index 63b4ccf4b4c..e24a5bf18e7 100644
--- a/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
+++ b/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
@@ -21,6 +21,14 @@ load_lib completion-support.exp
 
 standard_testfile cpls-abi-tag.cc
 
+if { [test_compiler_info gcc-*] } {
+    # With earlier gcc versions we run into:
+    #   cpls-abi-tag.cc:71:26: error:
+    #     ‘abi_tag’ attribute applied to non-function ‘s’
+    # See gcc PR65046.
+    require {expr [gcc_major_version] >= 5}
+}
+
 if {[prepare_for_testing "failed to prepare" $testfile \
 	 [list $srcfile] {c++ debug}]} {
     return -1
-- 
2.35.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed 4/4] [gdb/testsuite] Require have_compile_flag -mavx512f in gdb.arch/i386-avx512.exp
  2023-08-29 15:27 [pushed 1/4] [gdb/testsuite] Fix false negative in have_host_locale Tom de Vries
  2023-08-29 15:27 ` [pushed 2/4] [gdb/testsuite] Handle some test-cases with older compiler Tom de Vries
  2023-08-29 15:27 ` [pushed 3/4] [gdb/testsuite] Require gcc >= 5 in gdb.linespec/cpls-abi-tag.exp Tom de Vries
@ 2023-08-29 15:27 ` Tom de Vries
  2 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2023-08-29 15:27 UTC (permalink / raw)
  To: gdb-patches

When running test-case gdb.arch/i386-avx512.exp with gcc 4.8.4, I run into:
...
Running gdb.arch/i386-avx512.exp ...
gdb compile failed, gcc: error: unrecognized command line option '-mavx512f'
...

Fix this by requiring have_compile_flag -mavx512f.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.arch/i386-avx512.exp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdb/testsuite/gdb.arch/i386-avx512.exp b/gdb/testsuite/gdb.arch/i386-avx512.exp
index 0c50591dcbe..758bdacc3a5 100644
--- a/gdb/testsuite/gdb.arch/i386-avx512.exp
+++ b/gdb/testsuite/gdb.arch/i386-avx512.exp
@@ -20,6 +20,7 @@
 
 
 require {is_any_target i?86-*-* x86_64-*-*}
+require {have_compile_flag -mavx512f}
 
 standard_testfile
 
-- 
2.35.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-29 15:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-29 15:27 [pushed 1/4] [gdb/testsuite] Fix false negative in have_host_locale Tom de Vries
2023-08-29 15:27 ` [pushed 2/4] [gdb/testsuite] Handle some test-cases with older compiler Tom de Vries
2023-08-29 15:27 ` [pushed 3/4] [gdb/testsuite] Require gcc >= 5 in gdb.linespec/cpls-abi-tag.exp Tom de Vries
2023-08-29 15:27 ` [pushed 4/4] [gdb/testsuite] Require have_compile_flag -mavx512f in gdb.arch/i386-avx512.exp Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).