public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Enze Li <enze.li@hotmail.com>
To: Tom Tromey <tom@tromey.com>
Cc: Enze Li via Gdb-patches <gdb-patches@sourceware.org>,  enze.li@gmx.com
Subject: Re: [PATCH] gdb/testsuite: add untested message to skip_debuginfod_tests
Date: Wed, 14 Dec 2022 15:43:24 +0800	[thread overview]
Message-ID: <OS3P286MB215237C8F85BDA1F8B652296F0E09@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <87zgbre0w8.fsf@tromey.com> (Tom Tromey's message of "Tue, 13 Dec 2022 09:14:47 -0700")

On Tue, Dec 13 2022 at 09:14:47 AM -0700, Tom Tromey wrote:

>>>>>> "Enze" == Enze Li via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Enze>  proc skip_debuginfod_tests {} {
> Enze> -    if [is_remote host] {
> Enze> +    if { [is_remote host] } {
> Enze> +	untested "does not work on remote host"
> Enze>  	return true
> Enze>      }

Thanks for your swift replay.  :)

>
> Do any of the other skip_ procs call untested?

Hmmm...Not many.  Actually, from the skip_debuginfod_tests, I see an
untested message "cannot find curl".  It provides detailed information
when running the testcase.  Then I thought other spots in the same
procedure may benifit from it.

lib/debuginfod-support.exp:proc skip_debuginfod_tests {} {
lib/debuginfod-support.exp-    if [is_remote host] {
lib/debuginfod-support.exp-	return true
lib/debuginfod-support.exp-    }
lib/debuginfod-support.exp-
lib/debuginfod-support.exp-    if { [which debuginfod] == 0 } {
lib/debuginfod-support.exp-	return true
lib/debuginfod-support.exp-    }
lib/debuginfod-support.exp-
lib/debuginfod-support.exp-    if { [which curl] == 0 } {
lib/debuginfod-support.exp-	untested "cannot find curl"
lib/debuginfod-support.exp-	return true
lib/debuginfod-support.exp-    }

Except this, three unsupported messages were found in skip_* procedure. 

> I suspect this should be done somewhere else, and/or it's a pervasive
> problem when a prerequisite is not met.
>
> Tom

If the way of my previous patch is unconventional, how about this?

=================================================================
--- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
+++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
@@ -20,7 +20,24 @@ standard_testfile main.c
 load_lib dwarf.exp
 load_lib debuginfod-support.exp
 
-if { [skip_debuginfod_tests] } { return -1 }
+set skip_ret [skip_debuginfod_tests]
+if { $skip_ret < 0 } {
+    switch $skip_ret {
+	-1 {
+	    untested "does not work on remote host"
+	}
+	-2 {
+	    untested "cannot find debuginfo"
+	}
+	-3 {
+	    untested "cannot find curl"
+	}
+	-4 {
+	    untested "GDB was not configured with debuginfod"
+	}
+    }
+    return -1
+}
 
 set sourcetmp [standard_output_file tmp-${srcfile}]
 set outputdir [standard_output_file {}]

--- a/gdb/testsuite/lib/debuginfod-support.exp
+++ b/gdb/testsuite/lib/debuginfod-support.exp
@@ -18,17 +18,16 @@
 # Return true if the debuginfod tests should be skipped, otherwise, return
 # false.
 proc skip_debuginfod_tests {} {
-    if [is_remote host] {
-	return true
+    if { [is_remote host] } {
+	return -1
     }
 
     if { [which debuginfod] == 0 } {
-	return true
+	return -2
     }
 
     if { [which curl] == 0 } {
-	untested "cannot find curl"
-	return true
+	return -3
     }
 
     # Skip testing if gdb was not configured with debuginfod.
@@ -39,10 +38,10 @@ proc skip_debuginfod_tests {} {
     if { [string first "with-debuginfod" \
 	      [eval exec $::GDB --quiet $::INTERNAL_GDBFLAGS \
 		   --configuration]] == -1 } {
-	return true
+	return -4
     }
 
-    return false
+    return 0
 }
 
 # Create two directories within the current output directory.  One directory
=================================================================

Best Regards,
Enze


  reply	other threads:[~2022-12-14  7:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 11:56 Enze Li
2022-12-12 12:44 ` Bruno Larsen
2022-12-13 16:14 ` Tom Tromey
2022-12-14  7:43   ` Enze Li [this message]
2022-12-14 17:19     ` Tom Tromey

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=OS3P286MB215237C8F85BDA1F8B652296F0E09@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM \
    --to=enze.li@hotmail.com \
    --cc=enze.li@gmx.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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: link
Be 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).