From 41d0efca578f03db2787246a4e0c7bf9b085007c Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Thu, 3 Dec 2015 17:12:41 +0000 Subject: Run gdb.base/sizeof.exp with board having gdb,noinferiorio In my remote cross testing (x86_64 host and aarch64 target), the test gdb.base/sizeof.exp is skipped because gdb,noinferiorio is defined in my gdbserver board file. Tests are skipped because the test checks the expected value from the program's output, but I don't see why must do it this way. With my patch applied, we can save the result in variable in the program, and check the variable then. Then, the test doesn't rely on inferiorio. gdb/testsuite: 2015-12-03 Yao Qi * gdb.base/sizeof.c: Don't include stdio.h and ../lib/unbuffer_output.c. (main): New variable 'size' and 'value'. Remove printf and gdb_unbuffer_output. Assign return value to size and value. * gdb.base/sizeof.exp: Remove the checking to gdb,noinferiorio at the beginning. (check_sizeof): Check the result by printing variable 'size'. (check_valueof): Check the result by printing variable 'value'. --- gdb/testsuite/gdb.base/sizeof.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'gdb/testsuite/gdb.base/sizeof.c') diff --git a/gdb/testsuite/gdb.base/sizeof.c b/gdb/testsuite/gdb.base/sizeof.c index eb21f22..fde5213 100644 --- a/gdb/testsuite/gdb.base/sizeof.c +++ b/gdb/testsuite/gdb.base/sizeof.c @@ -1,7 +1,3 @@ -#include - -#include "../lib/unbuffer_output.c" - typedef char padding[16]; struct { @@ -100,28 +96,26 @@ fill_structs (void) int main () { - gdb_unbuffer_output (); + int size, value; fill_structs (); - printf ("sizeof (char) == %d\n", (int) sizeof (char)); - printf ("sizeof (short) == %d\n", (int) sizeof (short)); - printf ("sizeof (int) == %d\n", (int) sizeof (int)); - printf ("sizeof (long) == %d\n", (int) sizeof (long)); - printf ("sizeof (long long) == %d\n", (int) sizeof (long long)); - - printf ("sizeof (void *) == %d\n", (int) sizeof (void*)); - printf ("sizeof (void (*)(void)) == %d\n", (int) sizeof (void (*)(void))); - - printf ("sizeof (float) == %d\n", (int) sizeof (float)); - printf ("sizeof (double) == %d\n", (int) sizeof (double)); - printf ("sizeof (long double) == %d\n", (int) sizeof (long double)); + size = (int) sizeof (char); + size = (int) sizeof (short); + size = (int) sizeof (int); + size = (int) sizeof (long); + size = (int) sizeof (long long); + size = (int) sizeof (void*); + size = (int) sizeof (void (*)(void)); + size = (int) sizeof (float); + size = (int) sizeof (double); + size = (int) sizeof (long double); /* Signed char? */ - printf ("valueof ('\\377') == %d\n", '\377'); - printf ("valueof ((int) (char) -1) == %d\n", (int) (char) -1); - printf ("valueof ((int) (signed char) -1) == %d\n", (int) (signed char) -1); - printf ("valueof ((int) (unsigned char) -1) == %d\n", (int) (unsigned char) -1); + value = '\377'; + value = (int) (char) -1; + value = (int) (signed char) -1; + value = (int) (unsigned char) -1; return 0; } -- cgit v1.1