From 4bc1b1ddf9ce444c2906bf777856cc209556a7e0 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 30 Aug 2014 01:36:05 -0400 Subject: tests/plat_is_concerned.sh: New test --- (limited to 'tests') diff --git a/tests/local.mk b/tests/local.mk index ee57f01..41c3759 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -3,4 +3,5 @@ TESTS = \ tests/resolve_deps.basic.sh \ tests/match_arch.sh \ tests/match_plat.sh \ - tests/arch_is_concerned.sh + tests/arch_is_concerned.sh \ + tests/plat_is_concerned.sh diff --git a/tests/plat_is_concerned.sh b/tests/plat_is_concerned.sh new file mode 100755 index 0000000..2bc808b --- /dev/null +++ b/tests/plat_is_concerned.sh @@ -0,0 +1,96 @@ +#!/bin/sh +# +# plat_is_concerned() tests +# +# Copyright (C) 2014 Patrick "P. J." McDermott +# +# This file is part of the ProteanOS Development Kit. +# +# The ProteanOS Development Kit is free software: you can redistribute +# it and/or modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# The ProteanOS Development Kit is distributed in the hope that it +# will be useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the ProteanOS Development Kit. If not, see +# . + +. "${srcdir}/tests/common.sh" + +use archplat + +do_test() +{ + local host_plat="${1}" + local plats="${2}" + local result="${3}" + + if plat_is_concerned "${host_plat}" "${plats}"; then + if ! ${result}; then + printf 'False positive:\n' + printf ' Host platform: "%s"\n' "${host_plat}" + printf ' Package platforms: "%s"\n' "${plats}" + tests_es=1 + fi + else + if ${result}; then + printf 'False negative:\n' + printf ' Host platform: "%s"\n' "${host_plat}" + printf ' Package platforms: "%s"\n' "${plats}" + tests_es=1 + fi + fi +} + +# Platform: all + +do_test dev 'all' false + +do_test ao751h 'all' false + +do_test all 'all' true + +# Platform: any + +do_test dev 'any' true + +do_test ao751h 'any' true + +do_test all 'any' false + +# Platform: dev + +do_test dev 'dev' true + +do_test ao751h 'dev' false + +do_test all 'dev' false + +# Platform: !dev + +do_test dev '!dev' false + +do_test ao751h '!dev' true + +do_test all '!dev' false + +# Platform: dev dimension2400 + +do_test 'dev' 'dev dimension2400' true + +do_test 'ao751h' 'dev dimension2400' false + +do_test 'all' 'dev dimension2400' false + +# Platform: dev all + +do_test 'dev' 'dev all' true + +do_test 'ao751h' 'dev all' false + +do_test 'all' 'dev all' true -- cgit v0.9.1