From c98b57f24868a489a0a39a06345dcdff3ceb45ef Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 23 Dec 2018 18:51:35 -0500 Subject: tests/ob_arch_is_concerned.sh: Convert to TAP --- (limited to 'tests/ob_arch_is_concerned.sh') diff --git a/tests/ob_arch_is_concerned.sh b/tests/ob_arch_is_concerned.sh index 9ed9bf8..77f9912 100644..100755 --- a/tests/ob_arch_is_concerned.sh +++ b/tests/ob_arch_is_concerned.sh @@ -17,39 +17,90 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. ./common.sh - -ret=0 -host_arch= -arches= -result= - -main() -{ - . ./ob_arch_is_concerned.rc - - exit ${ret} -} - -testcase() -{ - if ob_arch_is_concerned "${host_arch}" "${arches}"; then - if ! ${result}; then - printf 'False positive:\n' >&2 - printf ' Host architecture: "%s"\n' \ - "${host_arch}" >&2 - printf ' Package architectures: "%s"\n' "${arches}" >&2 - ret=1 - fi - else - if ${result}; then - printf 'False negative:\n' >&2 - printf ' Host architecture: "%s"\n' \ - "${host_arch}" >&2 - printf ' Package architectures: "%s"\n' "${arches}" >&2 - ret=1 - fi - fi -} - -main "${@}" +srcdir="$(dirname "${0}")" +top_builddir="${PWD}" + +. "${srcdir}/aux/tap-functions.sh" +. "${top_builddir}/lib/libopkbuild.shso.1" + +plan_ 12 + +# Architecture: all + +command_ok_ \ + 'HOST "amd64-linux-glibc" DOES NOT MATCH ARCH "all"' -- \ + not ob_arch_is_concerned \ + 'amd64-linux-glibc' \ + 'all' + +command_ok_ \ + 'HOST "i686-linux-glibc" DOES NOT MATCH ARCH "all"' -- \ + not ob_arch_is_concerned \ + 'i686-linux-glibc' \ + 'all' + +command_ok_ \ + 'HOST "all" DOES MATCH ARCH "all"' -- \ + ob_arch_is_concerned \ + 'all' \ + 'all' + +# Architecture: any + +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 + +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 + +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' -- cgit v0.9.1