public inbox for gdb-testers@sourceware.org help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net To: gdb-testers@sourceware.org Subject: [binutils-gdb] gdb/testsuite: Fix py-format-string.exp on big-endian platforms Date: Fri, 04 Oct 2019 17:32:00 -0000 [thread overview] Message-ID: <9ef62df072d85d9cd0fadc90a3bd7f05e32ba9fd@gdb-build> (raw) *** TEST RESULTS FOR COMMIT 9ef62df072d85d9cd0fadc90a3bd7f05e32ba9fd *** commit 9ef62df072d85d9cd0fadc90a3bd7f05e32ba9fd Author: Andreas Arnez <arnez@linux.ibm.com> AuthorDate: Wed Oct 2 20:01:44 2019 +0200 Commit: Andreas Arnez <arnez@linux.ibm.com> CommitDate: Wed Oct 2 20:01:44 2019 +0200 gdb/testsuite: Fix py-format-string.exp on big-endian platforms GDB's py-format-string test case depends on endianness. In particular it relies on the first byte of the machine representation of 42 (as an int) to be 42 as well. While this is indeed the case for little-endian machines, big-endian machines store a zero in the first byte instead. The wrong assumption leads to lots of FAILs on such architectures. Fix this by filling the affected union with bytes of the same value, such that endianness does not matter. Use the value 42, to keep the character in the first byte unchanged. gdb/testsuite/ChangeLog: * gdb.python/py-format-string.c (string.h): New include. (main): Fill a_struct_with_union.the_union.an_int with bytes of the same value, for endianness-independence. * gdb.python/py-format-string.exp (default_regexp_dict) (test_pretty_structs, test_format): Adjust expected output to the changed initialization. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index b6667f0df7..8f01b878f8 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-10-02 Andreas Arnez <arnez@linux.ibm.com> + + * gdb.python/py-format-string.c (string.h): New include. + (main): Fill a_struct_with_union.the_union.an_int with bytes of + the same value, for endianness-independence. + * gdb.python/py-format-string.exp (default_regexp_dict) + (test_pretty_structs, test_format): Adjust expected output to the + changed initialization. + 2019-10-02 Tom Tromey <tromey@adacore.com> * gdb.ada/catch_ex_std.exp: Add $_ada_exception test. diff --git a/gdb/testsuite/gdb.python/py-format-string.c b/gdb/testsuite/gdb.python/py-format-string.c index 120ecce989..017f92080b 100644 --- a/gdb/testsuite/gdb.python/py-format-string.c +++ b/gdb/testsuite/gdb.python/py-format-string.c @@ -15,6 +15,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <string.h> + typedef struct point { int x; @@ -84,7 +86,9 @@ main () struct point another_point = { 123, 456 }; struct_union_t a_struct_with_union; - a_struct_with_union.the_union.an_int = 42; + /* Fill the union in an endianness-independent way. */ + memset (&a_struct_with_union.the_union, 42, + sizeof (a_struct_with_union.the_union)); enum_t an_enum = ENUM_BAR; diff --git a/gdb/testsuite/gdb.python/py-format-string.exp b/gdb/testsuite/gdb.python/py-format-string.exp index ebb2074ce8..ad71fe0e51 100644 --- a/gdb/testsuite/gdb.python/py-format-string.exp +++ b/gdb/testsuite/gdb.python/py-format-string.exp @@ -124,7 +124,7 @@ set default_regexp_dict [dict create \ "a_point_t_pointer" $default_pointer_regexp \ "a_point_t_ref" "Pretty Point \\(42, 12\\)" \ "another_point" "Pretty Point \\(123, 456\\)" \ - "a_struct_with_union" "\\{the_union = \\{an_int = 42, a_char = 42 '\\*'\\}\\}" \ + "a_struct_with_union" "\\{the_union = \\{an_int = 707406378, a_char = 42 '\\*'\\}\\}" \ "an_enum" "ENUM_BAR" \ "a_string" "${default_pointer_regexp} \"hello world\"" \ "a_binary_string" "${default_pointer_regexp} \"hello\"" \ @@ -333,7 +333,7 @@ proc test_pretty_structs {} { global current_lang set a_struct_with_union_pretty \ - "\\{\[\r\n\]+ the_union = \\{\[\r\n\]+ an_int = 42,\[\r\n\]+ a_char = 42 '\\*'\[\r\n\]+ \\}\[\r\n\]+\\}" + "\\{\[\r\n\]+ the_union = \\{\[\r\n\]+ an_int = 707406378,\[\r\n\]+ a_char = 42 '\\*'\[\r\n\]+ \\}\[\r\n\]+\\}" check_var_with_bool_opt "pretty_structs" "a_point_t" check_var_with_bool_opt "pretty_structs" "a_point_t_pointer" @@ -814,7 +814,7 @@ proc test_format {} { check_format_string "a_point_t_pointer" $opts check_format_string "another_point" $opts check_format_string "a_struct_with_union" $opts \ - "\\{the_union = \\{an_int = 0x2a, a_char = 0x2a\\}\\}" + "\\{the_union = \\{an_int = 0x2a2a2a2a, a_char = 0x2a\\}\\}" check_format_string "an_enum" $opts \ "0x1" check_format_string "a_string" $opts \ @@ -851,7 +851,7 @@ proc test_format {} { $decimal_pointer_regexp check_format_string "another_point" $opts check_format_string "a_struct_with_union" $opts \ - "\\{the_union = \\{an_int = 42, a_char = 42\\}\\}" + "\\{the_union = \\{an_int = 707406378, a_char = 42\\}\\}" check_format_string "an_enum" $opts \ "1" check_format_string "a_string" $opts \
next reply other threads:[~2019-10-04 17:32 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-10-04 17:32 gdb-buildbot [this message] 2019-10-04 17:32 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot 2019-10-04 19:09 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot 2019-10-04 20:03 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot 2019-10-07 14:33 ` Failures on Fedora-i686, " gdb-buildbot 2019-10-07 14:43 ` Failures on Fedora-x86_64-m32, " gdb-buildbot 2019-10-07 15:19 ` Failures on Fedora-x86_64-m64, " gdb-buildbot 2019-10-07 16:14 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot 2019-10-07 16:59 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot 2019-10-07 17:15 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=9ef62df072d85d9cd0fadc90a3bd7f05e32ba9fd@gdb-build \ --to=gdb-buildbot@sergiodj.net \ --cc=gdb-testers@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).