[testsuite] subtest name canonicalization for libctf

Message ID 20240920202521.GF9443@redhat.com
State New
Headers
Series [testsuite] subtest name canonicalization for libctf |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Frank Ch. Eigler Sept. 20, 2024, 8:25 p.m. UTC
  Hi -

This is the other one.

commit 1b588084400f84f5698594a58c758718d208c2c5 (HEAD -> master)
Author: Frank Ch. Eigler <fche@redhat.com>
Date:   Fri Sep 20 16:23:48 2024 -0400

    binutils testsuite: canonicalize subtest names in libctf
    
    Previous code included the full $srcdir pathnames in the individual
    subtest PASS/FAIL names, which makes it difficult to compute
    comparisons or regressions between test runs on different machines.
    This version switches to the basename only, which are common.
    
    Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
  

Comments

Alan Modra Sept. 24, 2024, 10:30 p.m. UTC | #1
On Fri, Sep 20, 2024 at 04:25:21PM -0400, Frank Ch. Eigler wrote:
> Hi -
> 
> This is the other one.

OK.

> commit 1b588084400f84f5698594a58c758718d208c2c5 (HEAD -> master)
> Author: Frank Ch. Eigler <fche@redhat.com>
> Date:   Fri Sep 20 16:23:48 2024 -0400
> 
>     binutils testsuite: canonicalize subtest names in libctf
>     
>     Previous code included the full $srcdir pathnames in the individual
>     subtest PASS/FAIL names, which makes it difficult to compute
>     comparisons or regressions between test runs on different machines.
>     This version switches to the basename only, which are common.
>     
>     Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
> 
> diff --git a/libctf/testsuite/lib/ctf-lib.exp b/libctf/testsuite/lib/ctf-lib.exp
> index cfd36bee3399..966c5a950a63 100644
> --- a/libctf/testsuite/lib/ctf-lib.exp
> +++ b/libctf/testsuite/lib/ctf-lib.exp
> @@ -136,11 +136,13 @@ proc run_lookup_test { name } {
>      } else {
>  	set file "$srcdir/$subdir/$name"
>      }
> +    # strip off the srcdir, which contains build host specific pathnames
> +    set file4log [string map [list $srcdir/ ""] $file]
>  
>      set opt_array [slurp_options "${file}.lk"]
>      if { $opt_array == -1 } {
>  	perror "error reading options from $file.lk"
> -	unresolved $subdir/$name
> +	unresolved $file4log
>  	return
>      }
>      set run_ld 0
> @@ -166,7 +168,7 @@ proc run_lookup_test { name } {
>  	}
>  	if ![info exists opts($opt_name)] {
>  	    perror "unknown option $opt_name in file $file.lk"
> -	    unresolved $subdir/$name
> +	    unresolved $file4log
>  	    return
>  	}
>  
> @@ -175,12 +177,12 @@ proc run_lookup_test { name } {
>  
>      if { [llength $opts(no_cross)] != 0
>  	 && "$TEST_CROSS" eq "yes" } {
> -	untested "$subdir/$name not tested when cross-compiling"
> +	untested "$file4log not tested when cross-compiling"
>  	return
>      }
>  
>      if { [llength $opts(host)] != 0 && ![ishost $opts(host)] } {
> -	untested "$subdir/$name only runs on $opts(host)"
> +	untested "$file4log only runs on $opts(host)"
>  	return
>      }
>  
> @@ -203,10 +205,7 @@ proc run_lookup_test { name } {
>  	set shared ""
>      }
>  
> -    set testname $opts(name)
> -    if { $opts(name) == "" } {
> -	set testname "$subdir/$name"
> -    }
> +    set testname $file4log
>  
>      # Compile and link the lookup program.
>      set comp_output [prune_warnings [compile_link_one_host_cc $opts(lookup) "tmpdir/lookup" "libctf.la $opts(lookup_link)"]]
  

Patch

diff --git a/libctf/testsuite/lib/ctf-lib.exp b/libctf/testsuite/lib/ctf-lib.exp
index cfd36bee3399..966c5a950a63 100644
--- a/libctf/testsuite/lib/ctf-lib.exp
+++ b/libctf/testsuite/lib/ctf-lib.exp
@@ -136,11 +136,13 @@  proc run_lookup_test { name } {
     } else {
 	set file "$srcdir/$subdir/$name"
     }
+    # strip off the srcdir, which contains build host specific pathnames
+    set file4log [string map [list $srcdir/ ""] $file]
 
     set opt_array [slurp_options "${file}.lk"]
     if { $opt_array == -1 } {
 	perror "error reading options from $file.lk"
-	unresolved $subdir/$name
+	unresolved $file4log
 	return
     }
     set run_ld 0
@@ -166,7 +168,7 @@  proc run_lookup_test { name } {
 	}
 	if ![info exists opts($opt_name)] {
 	    perror "unknown option $opt_name in file $file.lk"
-	    unresolved $subdir/$name
+	    unresolved $file4log
 	    return
 	}
 
@@ -175,12 +177,12 @@  proc run_lookup_test { name } {
 
     if { [llength $opts(no_cross)] != 0
 	 && "$TEST_CROSS" eq "yes" } {
-	untested "$subdir/$name not tested when cross-compiling"
+	untested "$file4log not tested when cross-compiling"
 	return
     }
 
     if { [llength $opts(host)] != 0 && ![ishost $opts(host)] } {
-	untested "$subdir/$name only runs on $opts(host)"
+	untested "$file4log only runs on $opts(host)"
 	return
     }
 
@@ -203,10 +205,7 @@  proc run_lookup_test { name } {
 	set shared ""
     }
 
-    set testname $opts(name)
-    if { $opts(name) == "" } {
-	set testname "$subdir/$name"
-    }
+    set testname $file4log
 
     # Compile and link the lookup program.
     set comp_output [prune_warnings [compile_link_one_host_cc $opts(lookup) "tmpdir/lookup" "libctf.la $opts(lookup_link)"]]