summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/local.mk4
-rw-r--r--tests/ob_arch_is_concerned.rc67
-rwxr-xr-x[-rw-r--r--]tests/ob_arch_is_concerned.sh123
3 files changed, 89 insertions, 105 deletions
diff --git a/tests/local.mk b/tests/local.mk
index dc1dd19..4b0f18f 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -1,6 +1,6 @@
TESTS = \
- %reldir%/ob_match_arch.sh
+ %reldir%/ob_match_arch.sh \
+ %reldir%/ob_arch_is_concerned.sh
# %reldir%/ob_parse_dep.sh \
# %reldir%/ob_reduce_deps.sh \
-# %reldir%/ob_arch_is_concerned.sh \
# %reldir%/ob_plat_is_concerned.sh
diff --git a/tests/ob_arch_is_concerned.rc b/tests/ob_arch_is_concerned.rc
deleted file mode 100644
index 76db80e..0000000
--- a/tests/ob_arch_is_concerned.rc
+++ /dev/null
@@ -1,67 +0,0 @@
-# Architecture: all
-
-host_arch='amd64-linux-glibc'
-arches='all'
-result='false'
-testcase
-
-host_arch='i686-linux-glibc'
-arches='all'
-result='false'
-testcase
-
-host_arch='all'
-arches='all'
-result='true'
-testcase
-
-# Architecture: any
-
-host_arch='amd64-linux-glibc'
-arches='any'
-result='true'
-testcase
-
-host_arch='i686-linux-glibc'
-arches='any'
-result='true'
-testcase
-
-host_arch='all'
-arches='any'
-result='false'
-testcase
-
-# Architecture: amd64-linux-glibc
-
-host_arch='amd64-linux-glibc'
-arches='amd64-linux-glibc'
-result='true'
-testcase
-
-host_arch='i686-linux-glibc'
-arches='amd64-linux-glibc'
-result='false'
-testcase
-
-host_arch='all'
-arches='amd64-linux-glibc'
-result='false'
-testcase
-
-# Architecture: !amd64-linux-glibc
-
-host_arch='amd64-linux-glibc'
-arches='!amd64-linux-glibc'
-result='false'
-testcase
-
-host_arch='i686-linux-glibc'
-arches='!amd64-linux-glibc'
-result='true'
-testcase
-
-host_arch='all'
-arches='!amd64-linux-glibc'
-result='false'
-testcase
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'