This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 2/2] Test GDB connection to GDBserver with no symbol files
- From: Pedro Alves <palves at redhat dot com>
- To: Luis Machado <lgustavo at codesourcery dot com>, gdb-patches at sourceware dot org
- Date: Wed, 13 Apr 2016 16:16:07 +0100
- Subject: Re: [PATCH v2 2/2] Test GDB connection to GDBserver with no symbol files
- Authentication-results: sourceware.org; auth=none
- References: <1460489060-17307-1-git-send-email-lgustavo at codesourcery dot com> <1460489060-17307-3-git-send-email-lgustavo at codesourcery dot com>
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