From 0b5016dc60e6ff1eff591d5de5b045463df8093e Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 23 Dec 2018 18:59:33 -0500 Subject: tests/ob_plat_is_concerned.sh: Convert to TAP --- (limited to 'tests') diff --git a/tests/local.mk b/tests/local.mk index 4b0f18f..91c2a63 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -1,6 +1,6 @@ TESTS = \ %reldir%/ob_match_arch.sh \ - %reldir%/ob_arch_is_concerned.sh + %reldir%/ob_arch_is_concerned.sh \ + %reldir%/ob_plat_is_concerned.sh # %reldir%/ob_parse_dep.sh \ -# %reldir%/ob_reduce_deps.sh \ -# %reldir%/ob_plat_is_concerned.sh +# %reldir%/ob_reduce_deps.sh diff --git a/tests/ob_plat_is_concerned.rc b/tests/ob_plat_is_concerned.rc deleted file mode 100644 index d4373df..0000000 --- a/tests/ob_plat_is_concerned.rc +++ /dev/null @@ -1,67 +0,0 @@ -# Platform: all - -host_plat='dev' -plats='all' -result='false' -testcase - -host_plat='ao751h' -plats='all' -result='false' -testcase - -host_plat='all' -plats='all' -result='true' -testcase - -# Platform: any - -host_plat='dev' -plats='any' -result='true' -testcase - -host_plat='ao751h' -plats='any' -result='true' -testcase - -host_plat='all' -plats='any' -result='false' -testcase - -# Platform: dev - -host_plat='dev' -plats='dev' -result='true' -testcase - -host_plat='ao751h' -plats='dev' -result='false' -testcase - -host_plat='all' -plats='dev' -result='false' -testcase - -# Platform: !dev - -host_plat='dev' -plats='!dev' -result='false' -testcase - -host_plat='ao751h' -plats='!dev' -result='true' -testcase - -host_plat='all' -plats='!dev' -result='false' -testcase diff --git a/tests/ob_plat_is_concerned.sh b/tests/ob_plat_is_concerned.sh index bbde8d6..df8310b 100644..100755 --- a/tests/ob_plat_is_concerned.sh +++ b/tests/ob_plat_is_concerned.sh @@ -17,37 +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_plat= -plats= -result= - -main() -{ - . ./ob_plat_is_concerned.rc - - exit ${ret} -} - -testcase() -{ - if ob_plat_is_concerned "${host_plat}" "${plats}"; then - if ! ${result}; then - printf 'False positive:\n' >&2 - printf ' Host platform: "%s"\n' "${host_plat}" >&2 - printf ' Package platforms: "%s"\n' "${plats}" >&2 - ret=1 - fi - else - if ${result}; then - printf 'False negative:\n' >&2 - printf ' Host platform: "%s"\n' "${host_plat}" >&2 - printf ' Package platforms: "%s"\n' "${plats}" >&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 + +# Platform: all + +command_ok_ \ + 'HOST "dev" DOES NOT MATCH PLAT "all"' -- \ + not ob_plat_is_concerned \ + 'dev' \ + 'all' + +command_ok_ \ + 'HOST "ao751h" DOES NOT MATCH PLAT "all"' -- \ + not ob_plat_is_concerned \ + 'ao751h' \ + 'all' + +command_ok_ \ + 'HOST "all" DOES MATCH PLAT "all"' -- \ + ob_plat_is_concerned \ + 'all' \ + 'all' + +# Platform: any + +command_ok_ \ + 'HOST "dev" DOES MATCH PLAT "any"' -- \ + ob_plat_is_concerned \ + 'dev' \ + 'any' + +command_ok_ \ + 'HOST "ao751h" DOES MATCH PLAT "any"' -- \ + ob_plat_is_concerned \ + 'ao751h' \ + 'any' + +command_ok_ \ + 'HOST "all" DOES NOT MATCH PLAT "any"' -- \ + not ob_plat_is_concerned \ + 'all' \ + 'any' + +# Platform: dev + +command_ok_ \ + 'HOST "dev" DOES MATCH PLAT "dev"' -- \ + ob_plat_is_concerned \ + 'dev' \ + 'dev' + +command_ok_ \ + 'HOST "ao751h" DOES NOT MATCH PLAT "dev"' -- \ + not ob_plat_is_concerned \ + 'ao751h' \ + 'dev' + +command_ok_ \ + 'HOST "all" DOES NOT MATCH PLAT "dev"' -- \ + not ob_plat_is_concerned \ + 'all' \ + 'dev' + +# Platform: !dev + +command_ok_ \ + 'HOST "dev" DOES NOT MATCH PLAT "!dev"' -- \ + not ob_plat_is_concerned \ + 'dev' \ + '!dev' + +command_ok_ \ + 'HOST "ao751h" DOES MATCH PLAT "!dev"' -- \ + ob_plat_is_concerned \ + 'ao751h' \ + '!dev' + +command_ok_ \ + 'HOST "all" DOES NOT MATCH PLAT "!dev"' -- \ + not ob_plat_is_concerned \ + 'all' \ + '!dev' -- cgit v0.9.1