summaryrefslogtreecommitdiffstats
path: root/tests/ob_arch_is_concerned.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ob_arch_is_concerned.sh')
-rwxr-xr-x[-rw-r--r--]tests/ob_arch_is_concerned.sh123
1 files changed, 87 insertions, 36 deletions
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 <http://www.gnu.org/licenses/>.
-. ./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'