Re: [PATCH] config.sub is not idempotent

2018-08-02 Thread Ben Elliston
I've applied the reindenting patch (so far).

Thanks,
Ben


signature.asc
Description: PGP signature
___
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches


Re: [PATCH] config.sub is not idempotent

2018-07-30 Thread John Ericson

Oh OK. Here is another version of the 3rd patch.

Firstly, I realized my own other mistake:  I had improperly limited the 
*-* patterns in a few case when fixing shellcheck errors. Existing globs 
shouldn't be restricted. [I had been narrowly extending the "special 
case" rules below to just additionally match normalized things and 
nothing more, and then "solved" some shellcheck errors the wrong way.]


The intent with the 3rd patch is: if "food" is accepted then "foo-*" 
should also be. If we allow skipping the vendor we should also allow it 
to be provided, even if this isn't excised by the new canonicalization 
tests.


Secondly, fixed the testsuite to match that. That seems simpler, actually.

John

On 07/30/18 01:57, Ben Elliston wrote:
There are now two separate tests for config.sub. I would like the test 
results tracked separately.


Perhaps it is time to switch to a Dejagnu test harness. 

Ben
From 548e5b3d8e44f7d92bc89ab89c160bd84a94b2bc Mon Sep 17 00:00:00 2001
Message-Id: 
<548e5b3d8e44f7d92bc89ab89c160bd84a94b2bc.1532930564.git.John.Ericson@Obsidian.Systems>
In-Reply-To: 
<9051a145bff67a2a8da7b666a95106c78fb4bc5c.1532930564.git.John.Ericson@Obsidian.Systems>
References: 
<5a1abdc6448184ae853dec84bb22f97237588e21.1532930564.git.John.Ericson@Obsidian.Systems>

<9051a145bff67a2a8da7b666a95106c78fb4bc5c.1532930564.git.John.Ericson@Obsidian.Systems>
From: John Ericson 
Date: Sun, 29 Jul 2018 22:18:29 -0400
Subject: [PATCH 3/3] * config.sub: Make idemopotent *
 testsuite/config-sub.sh: Add ideompotency tests
To: config-patches@gnu.org

---
 ChangeLog   |  5 
 config.sub  | 57 +++--
 testsuite/config-sub.sh | 41 -
 3 files changed, 77 insertions(+), 26 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1db8ff9..c239b50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-30  John Ericson  
+
+   * config.sub: Make idemopotent
+   * testsuite/config-sub.sh: Add ideompotency tests
+
 2018-07-30  John Ericson  
 
* testsuite/config-*.sh: Use `local rc` for better scoping
diff --git a/config.sub b/config.sub
index 52eb02e..893b60b 100755
--- a/config.sub
+++ b/config.sub
@@ -569,12 +569,14 @@ case $basic_machine in
1750a | 580 \
| a29k \
| aarch64 | aarch64_be \
+   | abacus \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | 
alpha64pca5[67] \
| am33_2.0 \
| arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | 
armv[78][arm] \
| avr | avr32 \
+   | asmjs \
| ba \
| be32 | be64 \
| bfin \
@@ -654,6 +656,9 @@ case $basic_machine in
leon|leon[3-9])
basic_machine=sparc-$basic_machine
;;
+   m6811-* | m68hc11-* | m6812-* | m68hc12-* | m68hcs12x-* | nvptx-* | 
picochip-*)
+   os=${os:-none}
+   ;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=${os:-none}
@@ -664,6 +669,10 @@ case $basic_machine in
basic_machine=s12z-unknown
os=${os:-none}
;;
+   m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
+   basic_machine=s12z-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+   os=${os:-none}
+   ;;
ms1)
basic_machine=mt-unknown
;;
@@ -674,6 +683,9 @@ case $basic_machine in
basic_machine=$basic_machine-unknown
os=${os:-none}
;;
+   xgate-*)
+   os=${os:-none}
+   ;;
xscaleeb)
basic_machine=armeb-unknown
;;
@@ -689,22 +701,26 @@ case $basic_machine in
  basic_machine=$basic_machine-pc
  ;;
# Recognize the basic CPU types with company name.
-   580-* \
+   1750a-* | 580-* \
| a29k-* \
| aarch64-* | aarch64_be-* \
+   | abacus-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-   | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
-   | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+   | alphapca5[67]-* | alpha64pca5[67]-* \
+   | am33_2.0-* \
+   | arc-* | arceb-* \
+   | arm-*  | arm[lb]e-* | arme[lb]-* | armv*-* \
| avr-* | avr32-* \
+   | asmjs-* \
| ba-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| c8051-* | clipper-* | craynv-* | csky-* | cydra-* \
-   | d10v-* | d30v-* | dlx-* \
-   | e2k-* | elxsi-* \
-   | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+   | d10v-* | d30v-* | 

Re: [PATCH] config.sub is not idempotent

2018-07-29 Thread Ben Elliston
There are now two separate tests for config.sub. I would like the test results 
tracked separately.

Perhaps it is time to switch to a Dejagnu test harness. 

Ben

On 30 July 2018 3:10:46 pm AEST, John Ericson  
wrote:
>I made it print either "PASS...\nPASS..." for both successful, or 
>nothing otherwise, which was my best guess for what you meant. I also 
>added 2 more cleanups of the testsuite go in 2 prior commits.
>
>Cheers,
>
>John
>
>On 07/29/18 21:03, John Ericson wrote:
>> I'll get to this is a few hours. What do you want it to say if the 
>> checks succeed and idempotency checks fail, or vice versa? (Maybe 
>> there should be a 3rd line for overall success?)
>>
>> John
>>
>>
>> ___
>> config-patches mailing list
>> config-patches@gnu.org
>> https://lists.gnu.org/mailman/listinfo/config-patches

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.___
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches


Re: [PATCH] config.sub is not idempotent

2018-07-29 Thread John Ericson
I made it print either "PASS...\nPASS..." for both successful, or 
nothing otherwise, which was my best guess for what you meant. I also 
added 2 more cleanups of the testsuite go in 2 prior commits.


Cheers,

John

On 07/29/18 21:03, John Ericson wrote:
I'll get to this is a few hours. What do you want it to say if the 
checks succeed and idempotency checks fail, or vice versa? (Maybe 
there should be a 3rd line for overall success?)


John


___
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches


From 5a1abdc6448184ae853dec84bb22f97237588e21 Mon Sep 17 00:00:00 2001
Message-Id: 
<5a1abdc6448184ae853dec84bb22f97237588e21.1532923899.git.John.Ericson@Obsidian.Systems>
From: John Ericson 
Date: Sun, 29 Jul 2018 22:12:56 -0400
Subject: [PATCH 1/3] * testsuite/config-*.sh: Reindent with tabs
To: config-patches@gnu.org

---
 ChangeLog |  4 +++
 testsuite/config-guess.sh | 54 +++
 testsuite/config-sub.sh   | 28 ++--
 3 files changed, 45 insertions(+), 41 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f606e2d..1acd48d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-07-30  John Ericson  
+
+   * testsuite/config-*.sh: Reindent with tabs
+
 2018-07-30  Ben Elliston  
 
* Makefile (check-guess, check-sub): Run tests under bash.
diff --git a/testsuite/config-guess.sh b/testsuite/config-guess.sh
index d59d28e..0648c81 100644
--- a/testsuite/config-guess.sh
+++ b/testsuite/config-guess.sh
@@ -13,14 +13,14 @@ PATH=$(pwd):$PATH
 
 run_config_guess()
 {
-rc=0
-while IFS='|' read -r machine release system version processor triplet ; do
-   sed \
-   -e "s,@MACHINE@,$machine," \
-   -e "s,@RELEASE@,$release," \
-   -e "s,@SYSTEM@,$system," \
-   -e "s,@VERSION@,$version," \
-   -e "s,@PROCESSOR@,$processor," > uname << EOF
+   rc=0
+   while IFS='|' read -r machine release system version processor triplet 
; do
+   sed \
+   -e "s,@MACHINE@,$machine," \
+   -e "s,@RELEASE@,$release," \
+   -e "s,@SYSTEM@,$system," \
+   -e "s,@VERSION@,$version," \
+   -e "s,@PROCESSOR@,$processor," > uname << EOF
 #!/bin/sh
 [ \$# -ne 1 ] && exec sh \$0 -s
 [ \$1 = -m ] && echo "@MACHINE@" && exit 0
@@ -29,29 +29,29 @@ run_config_guess()
 [ \$1 = -v ] && echo "@VERSION@" && exit 0
 [ \$1 = -p ] && echo "@PROCESSOR@" && exit 0
 EOF
-   chmod +x uname
-   output=$(sh -eu ../config.guess 2>/dev/null)
-   if test $? != 0 ; then
-   echo "FAIL: unable to guess $machine:$release:$system:$version"
-   rc=1
-   continue
-   fi
-   if test "$output" != "$triplet" ; then
-   echo "FAIL: $output (expected $triplet)"
-   rc=1
-   continue
-   fi
-   $verbose && echo "PASS: $triplet"
-done
-return $rc
+   chmod +x uname
+   output=$(sh -eu ../config.guess 2>/dev/null)
+   if test $? != 0 ; then
+   echo "FAIL: unable to guess 
$machine:$release:$system:$version"
+   rc=1
+   continue
+   fi
+   if test "$output" != "$triplet" ; then
+   echo "FAIL: $output (expected $triplet)"
+   rc=1
+   continue
+   fi
+   $verbose && echo "PASS: $triplet"
+   done
+   return $rc
 }
 
 if sed 's, | ,|,g' < config-guess.data | run_config_guess ; then
-  numtests=$(wc -l config-guess.data | cut -d' ' -f1)
-  $verbose || echo "PASS: config.guess checks ($numtests tests)"
+   numtests=$(wc -l config-guess.data | cut -d' ' -f1)
+   $verbose || echo "PASS: config.guess checks ($numtests tests)"
 else
-  echo "Unexpected failures."
-  exit 1
+   echo "Unexpected failures."
+   exit 1
 fi
 
 exit 0
diff --git a/testsuite/config-sub.sh b/testsuite/config-sub.sh
index c5b09f6..0b1d232 100644
--- a/testsuite/config-sub.sh
+++ b/testsuite/config-sub.sh
@@ -13,24 +13,24 @@ verbose=false
 
 run_config_sub()
 {
-rc=0
-while read -r alias canonical ; do
-   output=$(sh -eu ../config.sub "$alias")
-   if test "$output" != "$canonical" ; then
-   echo "FAIL: $alias -> $output, but expected $canonical"
-   rc=1
-   else
-   $verbose && echo "PASS: $alias"
-   fi
-done < config-sub.data
-return $rc
+   rc=0
+   while read -r alias canonical ; do
+   output=$(sh -eu ../config.sub "$alias")
+   if test "$output" != "$canonical" ; then
+   echo "FAIL: $alias -> $output, but expected $canonical"
+   rc=1
+   else
+   $verbose && echo "PASS: $alias"
+   

Re: [PATCH] config.sub is not idempotent

2018-07-29 Thread John Ericson
I'll get to this is a few hours. What do you want it to say if the checks succeed and idempotency checks fail, or vice versa? (Maybe there should be a 3rd line for overall success?)John___
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches


Re: [PATCH] config.sub is not idempotent

2018-07-29 Thread Ben Elliston
Hi John

With your patch, the testsuite output looks like this:

   cd testsuite && bash config-guess.sh && rm uname
   PASS: config.guess checks (101 tests)
   cd testsuite && bash config-sub.sh
   Checking mappings...
   Checking idempotency...
   PASS: config.sub checks (597 tests)

Can you please change your patch so that it looks like this?

   cd testsuite && bash config-guess.sh && rm uname
   PASS: config.guess checks (101 tests)
   cd testsuite && bash config-sub.sh
   PASS: config.sub checks (597 tests)
   PASS: config.sub idempotency checks (597 tests)

Note: it's a bit trickier than it seems. :-)

Thanks,
Ben


signature.asc
Description: PGP signature
___
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches


Re: [PATCH] config.sub is not idempotent

2018-07-27 Thread John Ericson
Glad you like it! Just let me know if there's any way I can assist with 
the improvements.


Cheers,

John


On 07/26/18 19:49, Ben Elliston wrote:

On Tue, Jul 24, 2018 at 11:57:27PM -0400, John Ericson wrote:


A canonical form is defined as one that maps to itself. I decided to
check whether the config.sub test suite's canonical configurations
actually did, and many of them did not, or weren't even accepted at
all!

This is a good patch, thanks. I have a few things that I would like to
improve in the test case, but nothing major.

Cheers,
Ben



___
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches


Re: [PATCH] config.sub is not idempotent

2018-07-26 Thread Ben Elliston
On Tue, Jul 24, 2018 at 11:57:27PM -0400, John Ericson wrote:

> A canonical form is defined as one that maps to itself. I decided to
> check whether the config.sub test suite's canonical configurations
> actually did, and many of them did not, or weren't even accepted at
> all!

This is a good patch, thanks. I have a few things that I would like to
improve in the test case, but nothing major.

Cheers,
Ben


signature.asc
Description: PGP signature
___
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches