#!/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