diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-22 01:48:57 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-22 01:48:57 (EDT) |
commit | d841dc0bfb1d18a2f85f76096d4aebc4d772b88e (patch) | |
tree | d3c59eed4e2af1a88b7a6cc7c06f1eee6c4e6110 /tests/arch_is_concerned.sh | |
parent | 44e452fb3c8cc7a093d72fbc280be3973e627a62 (diff) | |
parent | 76885ce7f12b98f0700a3a0535e06425bc1a9aa5 (diff) |
Merge branch 'feature/tap-tests'
Diffstat (limited to 'tests/arch_is_concerned.sh')
-rwxr-xr-x | tests/arch_is_concerned.sh | 187 |
1 files changed, 138 insertions, 49 deletions
diff --git a/tests/arch_is_concerned.sh b/tests/arch_is_concerned.sh index 837d3be..7614dad 100755 --- a/tests/arch_is_concerned.sh +++ b/tests/arch_is_concerned.sh @@ -1,6 +1,6 @@ # arch_is_concerned() tests # -# Copyright (C) 2014 Patrick "P. J." McDermott +# Copyright (C) 2014, 2018, 2019 Patrick McDermott # # This file is part of the ProteanOS Development Kit. # @@ -18,68 +18,157 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -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= + plan_ 24 # 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"' -- \ + arch_is_concerned \ + 'amd64-linux-glibc' \ + 'any' + command_ok_ \ + 'HOST "i686-linux-glibc" DOES MATCH ARCH "any"' -- \ + arch_is_concerned \ + 'i686-linux-glibc' \ + 'any' + command_ok_ \ + 'HOST "all" DOES NOT MATCH ARCH "any"' -- \ + not 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"' -- \ + arch_is_concerned \ + 'amd64-linux-glibc' \ + 'amd64-linux-glibc' + command_ok_ \ + 'HOST "i686-linux-glibc" DOES NOT MATCH ARCH '$(: \ + )'"amd64-linux-glibc"' -- \ + not arch_is_concerned \ + 'i686-linux-glibc' \ + 'amd64-linux-glibc' + command_ok_ \ + 'HOST "all" DOES NOT MATCH ARCH "amd64-linux-glibc"' -- \ + not 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 arch_is_concerned \ + 'amd64-linux-glibc' \ + '!amd64-linux-glibc' + command_ok_ \ + 'HOST "i686-linux-glibc" DOES MATCH ARCH '$(: \ + )'"!amd64-linux-glibc"' -- \ + arch_is_concerned \ + 'i686-linux-glibc' \ + '!amd64-linux-glibc' + command_ok_ \ + 'HOST "all" DOES NOT MATCH ARCH "!amd64-linux-glibc"' -- \ + not 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"' -- \ + 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 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 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"' -- \ + 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 arch_is_concerned \ + 'i686-linux-glibc' \ + 'amd64-linux-glibc all' + command_ok_ \ + 'HOST "all" DOES MATCH ARCH "amd64-linux-glibc all"' -- \ + arch_is_concerned \ + 'all' \ + 'amd64-linux-glibc all' + + # Architecture: amd64-any-any + command_ok_ \ + 'HOST "amd64-linux-glibc" DOES NOT MATCH ARCH "amd64-any-any"' -- \ + arch_is_concerned \ + 'amd64-linux-glibc' \ + 'amd64-any-any' + command_ok_ \ + 'HOST "i686-linux-glibc" DOES MATCH ARCH "amd64-any-any"' -- \ + not arch_is_concerned \ + 'i686-linux-glibc' \ + 'amd64-any-any' + command_ok_ \ + 'HOST "all" DOES NOT MATCH ARCH "amd64-any-any"' -- \ + not arch_is_concerned \ + 'all' \ + 'amd64-any-any' + + # Architecture: cortexa8-any-any i686-any-any + command_ok_ \ + 'HOST "amd64-linux-glibc" DOES NOT MATCH ARCH '$(: \ + )'"cortexa8-any-any i686-any-any"' -- \ + not arch_is_concerned \ + 'amd64-linux-glibc' \ + 'cortexa8-any-any i686-any-any' + command_ok_ \ + 'HOST "i686-linux-glibc" DOES MATCH ARCH '$(: \ + )'"cortexa8-any-any i686-any-any"' -- \ + arch_is_concerned \ + 'i686-linux-glibc' \ + 'cortexa8-any-any i686-any-any' + command_ok_ \ + 'HOST "all" DOES NOT MATCH ARCH '$(: \ + )'"cortexa8-any-any i686-any-any"' -- \ + not arch_is_concerned \ + 'all' \ + 'cortexa8-any-any i686-any-any' return 0 } |