From 23920f78bbd293ffbba079950c1b1b7635788eb5 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 21 Apr 2019 17:13:55 -0400 Subject: tests/arch_is_concerned.sh: Convert to TAP --- (limited to 'tests') diff --git a/tests/arch_is_concerned.sh b/tests/arch_is_concerned.sh index 837d3be..29bdedb 100755 --- a/tests/arch_is_concerned.sh +++ b/tests/arch_is_concerned.sh @@ -18,68 +18,120 @@ # along with the ProteanOS Development Kit. If not, see # . -do_test() -{ - local host_arch="${1}" - local arches="${2}" - local result="${3}" - - if arch_is_concerned "${host_arch}" "${arches}"; then - if ! ${result}; then - printf 'False positive:\n' - printf ' Host architecture: "%s"\n' "${host_arch}" - printf ' Package architectures: "%s"\n' "${arches}" - tests_es=1 - fi - else - if ${result}; then - printf 'False negative:\n' - printf ' Host architecture: "%s"\n' "${host_arch}" - printf ' Package architectures: "%s"\n' "${arches}" - tests_es=1 - fi - fi -} - main() { - local arches= + . "${srcdir}/tests/aux/tap-functions.sh" # Architecture: all - arches='all' - do_test 'amd64-linux-glibc' "${arches}" false - do_test 'i686-linux-glibc' "${arches}" false - do_test 'all' "${arches}" true + command_ok_ \ + 'HOST "amd64-linux-glibc" DOES NOT MATCH ARCH "all"' -- \ + not arch_is_concerned \ + 'amd64-linux-glibc' \ + 'all' + command_ok_ \ + 'HOST "i686-linux-glibc" DOES NOT MATCH ARCH "all"' -- \ + not arch_is_concerned \ + 'i686-linux-glibc' \ + 'all' + command_ok_ \ + 'HOST "all" DOES MATCH ARCH "all"' -- \ + arch_is_concerned \ + 'all' \ + 'all' # Architecture: any - arches='any' - do_test 'amd64-linux-glibc' "${arches}" true - do_test 'i686-linux-glibc' "${arches}" true - do_test 'all' "${arches}" false + command_ok_ \ + 'HOST "amd64-linux-glibc" DOES MATCH ARCH "any"' -- \ + ob_arch_is_concerned \ + 'amd64-linux-glibc' \ + 'any' + command_ok_ \ + 'HOST "i686-linux-glibc" DOES MATCH ARCH "any"' -- \ + ob_arch_is_concerned \ + 'i686-linux-glibc' \ + 'any' + command_ok_ \ + 'HOST "all" DOES NOT MATCH ARCH "any"' -- \ + not ob_arch_is_concerned \ + 'all' \ + 'any' # Architecture: amd64-linux-glibc - arches='amd64-linux-glibc' - do_test 'amd64-linux-glibc' "${arches}" true - do_test 'i686-linux-glibc' "${arches}" false - do_test 'all' "${arches}" false + command_ok_ \ + 'HOST "amd64-linux-glibc" DOES MATCH ARCH '$(: \ + )'"amd64-linux-glibc"' -- \ + ob_arch_is_concerned \ + 'amd64-linux-glibc' \ + 'amd64-linux-glibc' + command_ok_ \ + 'HOST "i686-linux-glibc" DOES NOT MATCH ARCH '$(: \ + )'"amd64-linux-glibc"' -- \ + not ob_arch_is_concerned \ + 'i686-linux-glibc' \ + 'amd64-linux-glibc' + command_ok_ \ + 'HOST "all" DOES NOT MATCH ARCH "amd64-linux-glibc"' -- \ + not ob_arch_is_concerned \ + 'all' \ + 'amd64-linux-glibc' # Architecture: !amd64-linux-glibc - arches='!amd64-linux-glibc' - do_test 'amd64-linux-glibc' "${arches}" false - do_test 'i686-linux-glibc' "${arches}" true - do_test 'all' "${arches}" false + command_ok_ \ + 'HOST "amd64-linux-glibc" DOES NOT MATCH ARCH '$(: \ + )'"!amd64-linux-glibc"' -- \ + not ob_arch_is_concerned \ + 'amd64-linux-glibc' \ + '!amd64-linux-glibc' + command_ok_ \ + 'HOST "i686-linux-glibc" DOES MATCH ARCH '$(: \ + )'"!amd64-linux-glibc"' -- \ + ob_arch_is_concerned \ + 'i686-linux-glibc' \ + '!amd64-linux-glibc' + command_ok_ \ + 'HOST "all" DOES NOT MATCH ARCH "!amd64-linux-glibc"' -- \ + not ob_arch_is_concerned \ + 'all' \ + '!amd64-linux-glibc' # Architecture: amd64-linux-glibc cortexa8-linux-glibc - arches='amd64-linux-glibc cortexa8-linux-glibc' - do_test 'amd64-linux-glibc' "${arches}" true - do_test 'i686-linux-glibc' "${arches}" false - do_test 'all' "${arches}" false + command_ok_ \ + 'HOST "amd64-linux-glibc" DOES MATCH ARCH '$(: \ + )'"amd64-linux-glibc cortexa8-linux-glibc"' -- \ + ob_arch_is_concerned \ + 'amd64-linux-glibc' \ + 'amd64-linux-glibc cortexa8-linux-glibc' + command_ok_ \ + 'HOST "i686-linux-glibc" DOES MATCH ARCH '$(: \ + )'"amd64-linux-glibc cortexa8-linux-glibc"' -- \ + not ob_arch_is_concerned \ + 'i686-linux-glibc' \ + 'amd64-linux-glibc cortexa8-linux-glibc' + command_ok_ \ + 'HOST "all" DOES MATCH ARCH '$(: \ + )'"amd64-linux-glibc cortexa8-linux-glibc"' -- \ + not ob_arch_is_concerned \ + 'all' \ + 'amd64-linux-glibc cortexa8-linux-glibc' # Architecture: amd64-linux-glibc all - arches='amd64-linux-glibc all' - do_test 'amd64-linux-glibc' "${arches}" true - do_test 'i686-linux-glibc' "${arches}" false - do_test 'all' "${arches}" true + command_ok_ \ + 'HOST "amd64-linux-glibc" DOES MATCH ARCH '$(: \ + )'"amd64-linux-glibc all"' -- \ + ob_arch_is_concerned \ + 'amd64-linux-glibc' \ + 'amd64-linux-glibc all' + command_ok_ \ + 'HOST "i686-linux-glibc" DOES NOT MATCH ARCH '$(: \ + )'"amd64-linux-glibc all"' --\ + not ob_arch_is_concerned \ + 'i686-linux-glibc' \ + 'amd64-linux-glibc all' + command_ok_ \ + 'HOST "all" DOES MATCH ARCH "amd64-linux-glibc all"' -- \ + ob_arch_is_concerned \ + 'all' \ + 'amd64-linux-glibc all' return 0 } -- cgit v0.9.1