This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 2/2] Test GDB connection to GDBserver with no symbol files


On 04/12/2016 08:24 PM, Luis Machado wrote:

> - Addressed comments and moved the test to a proc that can be called multiple
> times.
> - The testcase now exercises these permutations:
> 
> * Unreadable file + empty sysroot
> * Unreadable file + target: sysroot
> * Removed file + empty sysroot
> * Removed file + target: sysroot
> 
> With an unpatched GDB we should see this:
> 
> FAIL: gdb.server/connect-with-no-symbol-file.exp: test sysroot = "" action = permission: connection to GDBserver succeeded (the program is no longer running)
> FAIL: gdb.server/connect-with-no-symbol-file.exp: test sysroot = "" action = delete: connection to GDBserver succeeded (the program is no longer running)
> FAIL: gdb.server/connect-with-no-symbol-file.exp: test sysroot = "target:" action = permission: connection to GDBserver succeeded (the program is no longer running)
> FAIL: gdb.server/connect-with-no-symbol-file.exp: test sysroot = "target:" action = delete: connection to GDBserver succeeded (the program is no longer running)
> 
> A patched GDB should have full passes.

Excellent.  LGTM.  A couple minor comments below.

> +
> +#include <stdio.h>
> +
> +int
> +main (int argc, char **argv)
> +{
> +  printf ("Hello world!\n");
> +  return 0;
> +}

No need for stdio.h / printf, right?  As a general principle,
if the test doesn't need those, best just not to compile
them in either.

> +# Make sure we have the original symbol file in a safe place to copy from.
> +gdb_remote_download host $binfile $binfile.bak
> +
> +# Run the test with different permutations.
> +foreach sysroot $sysroots {
> +    foreach action $file_actions {
> +	with_test_prefix "test sysroot = \"$sysroot\" action = $action" {
> +	    connect_no_symbol_file $sysroot $action
> +	}
> +    }
> +}
> 

Note you can simplify using foreach_with_prefix.  No need
for the separate variables then:

foreach_with_prefix sysroot {"" "target:"} {
    foreach_with_prefix action {"permission" "delete"} {
       connect_no_symbol_file $sysroot $action
    }
}

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]