From d3bfe62ac88536dcf53203efb0d96d6590eb16e4 Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Sun, 30 Jun 2019 16:32:41 +1000 Subject: [PATCH] This change introduces a new test to config-sub.sh which runs every config.guess expected triplet through config.sub so that we can check that it is properly recognised. Sometimes, new triplets have been added to config.guess without updating config.sub accordingly (eg, Harris NightHawk machines running PowerUnix from the mid-1990s!) * config.sub (case $os): Match nsk* and powerunix. Don't later match nsk* and set os=nsk which removes the OS version number. * testsuite/config-guess.data: Tweak Unleashed test case. * testsuite/config-sub.sh (run_config_sub_with_guess_triplets): New test. --- ChangeLog | 8 ++++++++ config.sub | 6 ++---- testsuite/config-guess.data | 2 +- testsuite/config-sub.sh | 20 +++++++++++++++++++- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23b02e0..8dc80fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2019-06-30 Ben Elliston + + * config.sub (case $os): Match nsk* and powerunix. Don't later + match nsk* and set os=nsk which removes the OS version number. + * testsuite/config-guess.data: Tweak Unleashed test case. + * testsuite/config-sub.sh (run_config_sub_with_guess_triplets): + New test. + 2019-06-30 Ben Elliston * config.sub: Recognise os108*. diff --git a/config.sub b/config.sub index 010c1ec..a318a46 100755 --- a/config.sub +++ b/config.sub @@ -1365,7 +1365,8 @@ case $os in | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ | skyos* | haiku* | rdos* | toppers* | drops* | es* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ - | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi*) + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix) # Remember, each alternative MUST END IN *, to match a version number. ;; qnx*) @@ -1449,9 +1450,6 @@ case $os in ns2) os=nextstep2 ;; - nsk*) - os=nsk - ;; # Preserve the version number of sinix5. sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` diff --git a/testsuite/config-guess.data b/testsuite/config-guess.data index a452b81..8d5796a 100644 --- a/testsuite/config-guess.data +++ b/testsuite/config-guess.data @@ -2,7 +2,6 @@ 3 | 2.3.3 | XENIX | SysV | ignored | i386-pc-xenix aarch64_be | ignored | Linux | ignored | ignored | aarch64_be-unknown-linux-gnu aarch64 | ignored | Linux | ignored | ignored | aarch64-unknown-linux-gnu -amd64 | 1.1 | Unleashed | ignored | ignored | amd64-unknown-unleashed1.1 amd64 | 1.5.12(0.116/4/2) | CYGWIN_NT-5.2 | ignored | ignored | x86_64-pc-cygwin amd64 | 6.1.4 | NetBSD | ignored | x86_64 | x86_64-unknown-netbsd6.1 amd64 | 6.1.5_PATCH | NetBSD | ignored | x86_64 | x86_64-unknown-netbsd6.1 @@ -118,4 +117,5 @@ x86_64 | 2.0.0(0.271/5/3) | MSYS_NT-6.1 | ignored | ignored | x86_64-pc-msys x86_64 | 2.6.32 | Linux | ignored | ignored | x86_64-pc-linux-gnu x86_64 | 2.6.32 | VMkernel | ignored | ignored | x86_64-unknown-esx x86_64 | 8.0 | OS108 | ignored | ignored | x86_64-unknown-os108_8.0 +x86_64 | 1.1 | Unleashed | ignored | ignored | x86_64-unknown-unleashed1.1 xtensa | 2.6.15 | Linux | ignored | ignored | xtensa-unknown-linux-gnu diff --git a/testsuite/config-sub.sh b/testsuite/config-sub.sh index 32e3b09..7fb6fcc 100644 --- a/testsuite/config-sub.sh +++ b/testsuite/config-sub.sh @@ -88,10 +88,28 @@ run_config_sub_idempotent() return $rc } +run_config_sub_with_guess_triplets() +{ + local -i rc=0 + numtests=0 + name="canonicalise each config.guess testcase" + + awk -F '|' '{ print $6 }' < config-guess.data | while read -r triplet ; do + output=$(sh -eu ../config.sub "$triplet") + if test "$triplet" != "$output" ; then + echo "FAIL: $triplet -> $output, but $triplet should map to itself" + rc=1 + fi + numtests+=1 + done + return $rc +} + + declare -i rc=0 numtests declare name -for testsuite in run_config_sub run_config_sub_idempotent ; do +for testsuite in run_config_sub run_config_sub_idempotent run_config_sub_with_guess_triplets ; do if $testsuite; then $verbose || echo "PASS: config.sub $name ($numtests tests)" else