diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-21 18:09:23 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-21 18:09:23 (EDT) |
commit | ca5344ff4205e572f7acad6abf0af7f4b80d9b73 (patch) | |
tree | 29228fd1ce30b2e18c7c4da5a1348708d1afe487 /tests | |
parent | 81d8c2712745d53d01b7f701837275aeb793c6f9 (diff) |
tests/reduce_deps.sh: Convert to TAP
Diffstat (limited to 'tests')
-rw-r--r-- | tests/local.mk | 2 | ||||
-rwxr-xr-x | tests/reduce_deps.sh | 148 |
2 files changed, 112 insertions, 38 deletions
diff --git a/tests/local.mk b/tests/local.mk index b63b962..ecb5847 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -39,7 +39,7 @@ CLEANFILES += $(tests_plat_is_concerned_LDADD) tests_reduce_deps_SOURCES = \ tests/reduce_deps.sh \ - tests/common.sh \ + tests/aux/tap-functions.sh \ src/deps.sh \ src/archplat.sh tests_reduce_deps_LDADD = $(tests_reduce_deps_SOURCES:.sh=.sho) diff --git a/tests/reduce_deps.sh b/tests/reduce_deps.sh index 386b609..41a4b58 100755 --- a/tests/reduce_deps.sh +++ b/tests/reduce_deps.sh @@ -1,6 +1,6 @@ # reduce_deps() tests # -# Copyright (C) 2014 Patrick "P. J." McDermott +# Copyright (C) 2014, 2018, 2019 Patrick McDermott # # This file is part of the ProteanOS Development Kit. # @@ -18,51 +18,125 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -do_test() -{ - local deps="${1}" - local union="${2}" - local host_arch="${3}" - local host_plat="${4}" - local result="${5}" - - deps="$(reduce_deps "${deps}" "${union}" "${host_arch}" "${host_plat}")" - - if [ "x${deps}" != "x${result}" ]; then - ${union} && printf 'Union' || printf 'Normal' - printf ' dependency list for ' - printf 'host arch "%s" and host plat "%s":\n' \ - "${host_arch}" "${host_plat}" - printf ' "%s" != "%s"\n' \ - "${deps}" "${result}" - tests_es=1 - fi -} - main() { + plan_ 13 + # Normal and union AND-lists. - do_test 'foo, bar' false 'amd64-linux-glibc' 'dev' 'foo, bar' - do_test 'foo,bar' false 'amd64-linux-glibc' 'dev' 'foo, bar' - do_test 'foo, bar' false 'amd64-linux-glibc' 'dev' 'foo, bar' - do_test 'foo, bar' true 'amd64-linux-glibc' 'dev' 'foo, bar' - do_test 'foo,bar' true 'amd64-linux-glibc' 'dev' 'foo, bar' - do_test 'foo, bar' true 'amd64-linux-glibc' 'dev' 'foo, bar' + command_ok_ \ + 'NORMAL LIST "foo, bar"' -- \ + [ x"$(reduce_deps \ + 'foo, bar' false \ + 'amd64-linux-glibc' 'dev' \ + )" = \ + x'foo, bar' \ + ] + command_ok_ \ + 'NORMAL LIST "foo,bar"' -- \ + [ x"$(reduce_deps \ + 'foo,bar' false \ + 'amd64-linux-glibc' 'dev' \ + )" = \ + x'foo, bar' \ + ] + command_ok_ \ + 'NORMAL LIST "foo, bar"' -- \ + [ x"$(reduce_deps \ + 'foo, bar' false \ + 'amd64-linux-glibc' 'dev' \ + )" = \ + x'foo, bar' \ + ] + command_ok_ \ + 'UNION LIST "foo, bar"' -- \ + [ x"$(reduce_deps \ + 'foo, bar' true \ + 'amd64-linux-glibc' 'dev' \ + )" = \ + x'foo, bar' \ + ] + command_ok_ \ + 'UNION LIST "foo,bar"' -- \ + [ x"$(reduce_deps \ + 'foo,bar' true \ + 'amd64-linux-glibc' 'dev' \ + )" = \ + x'foo, bar' \ + ] + command_ok_ \ + 'UNION LIST "foo, bar"' -- \ + [ x"$(reduce_deps \ + 'foo, bar' true \ + 'amd64-linux-glibc' 'dev' \ + )" = \ + x'foo, bar' \ + ] # Normal and union OR-lists. - do_test 'foo | bar' false 'amd64-linux-glibc' 'dev' 'foo | bar' - do_test 'foo|bar' false 'amd64-linux-glibc' 'dev' 'foo | bar' - do_test 'foo | bar' false 'amd64-linux-glibc' 'dev' 'foo | bar' + command_ok_ \ + 'NORMAL LIST "foo | bar"' -- \ + [ x"$(reduce_deps \ + 'foo | bar' false \ + 'amd64-linux-glibc' 'dev' \ + )" = \ + x'foo | bar' \ + ] + command_ok_ \ + 'NORMAL LIST "foo|bar"' -- \ + [ x"$(reduce_deps \ + 'foo|bar' false \ + 'amd64-linux-glibc' 'dev' \ + )" = \ + x'foo | bar' \ + ] + command_ok_ \ + 'NORMAL LIST "foo | bar"' -- \ + [ x"$(reduce_deps \ + 'foo | bar' false \ + 'amd64-linux-glibc' 'dev' \ + )" = \ + x'foo | bar' \ + ] # Normal and union AND-lists with arch specs. - do_test 'foo [amd64-linux-glibc], bar [!amd64-linux-glibc]' false \ - 'amd64-linux-glibc' 'dev' 'foo' - do_test 'foo [amd64-linux-glibc], bar [!amd64-linux-glibc]' true \ - 'amd64-linux-glibc' 'dev' 'foo' + command_ok_ \ + 'NORMAL LIST "foo [amd64-linux-glibc], '$(: \ + )'bar [!amd64-linux-glibc]"' -- \ + [ x"$(reduce_deps \ + 'foo [amd64-linux-glibc], bar [!amd64-linux-glibc]' \ + false \ + 'amd64-linux-glibc' 'dev' \ + )" = \ + x'foo' \ + ] + command_ok_ \ + 'UNION LIST "foo [amd64-linux-glibc], '$(: \ + )'bar [!amd64-linux-glibc]"' -- \ + [ x"$(reduce_deps \ + 'foo [amd64-linux-glibc], bar [!amd64-linux-glibc]' \ + true \ + 'amd64-linux-glibc' 'dev' \ + )" = \ + x'foo' \ + ] # Normal and union AND-lists with plat specs. - do_test 'foo <dev>, bar <!dev>' false 'amd64-linux-glibc' 'dev' 'foo' - do_test 'foo <dev>, bar <!dev>' true 'amd64-linux-glibc' 'dev' 'foo' + command_ok_ \ + 'NORMAL LIST "foo <dev>, bar <!dev>"' -- \ + [ x"$(reduce_deps \ + 'foo <dev>, bar <!dev>' false \ + 'amd64-linux-glibc' 'dev' \ + )" = \ + x'foo' \ + ] + command_ok_ \ + 'UNION LIST "foo <dev>, bar <!dev>"' -- \ + [ x"$(reduce_deps \ + 'foo <dev>, bar <!dev>' true \ + 'amd64-linux-glibc' 'dev' \ + )" = \ + x'foo' \ + ] return 0 } |