diff options
Diffstat (limited to 'lib/libxo/tests')
-rw-r--r-- | lib/libxo/tests/Makefile | 249 | ||||
-rw-r--r-- | lib/libxo/tests/Makefile.depend | 15 | ||||
-rw-r--r-- | lib/libxo/tests/encoder/Makefile | 20 | ||||
-rw-r--r-- | lib/libxo/tests/encoder/Makefile.depend | 16 | ||||
-rwxr-xr-x | lib/libxo/tests/functional_test.sh | 75 |
5 files changed, 375 insertions, 0 deletions
diff --git a/lib/libxo/tests/Makefile b/lib/libxo/tests/Makefile new file mode 100644 index 000000000000..a53dbea685a6 --- /dev/null +++ b/lib/libxo/tests/Makefile @@ -0,0 +1,249 @@ +.include <bsd.own.mk> + +PACKAGE= tests + +WARNS?= 1 + +LIBXOSRC= ${SRCTOP}/contrib/libxo + +# Override the default suffix transformation rules for .c/.o -> .out +.SUFFIXES: +.SUFFIXES: .c .err .o .out .sh + +.PATH: +.PATH.c: ${LIBXOSRC}/libxo ${LIBXOSRC}/tests/core +.PATH.err: ${LIBXOSRC}/tests/core/saved +.PATH.out: ${LIBXOSRC}/tests/core/saved + +.c.out .o.out: + +ATF_TESTS_SH+= functional_test + +BINDIR= ${TESTSDIR} + +${PACKAGE}FILES+= test_01.E.err +${PACKAGE}FILES+= test_01.E.out +${PACKAGE}FILES+= test_01.H.err +${PACKAGE}FILES+= test_01.H.out +${PACKAGE}FILES+= test_01.HIPx.err +${PACKAGE}FILES+= test_01.HIPx.out +${PACKAGE}FILES+= test_01.HP.err +${PACKAGE}FILES+= test_01.HP.out +${PACKAGE}FILES+= test_01.J.err +${PACKAGE}FILES+= test_01.J.out +${PACKAGE}FILES+= test_01.JP.err +${PACKAGE}FILES+= test_01.JP.out +${PACKAGE}FILES+= test_01.T.err +${PACKAGE}FILES+= test_01.T.out +${PACKAGE}FILES+= test_01.X.err +${PACKAGE}FILES+= test_01.X.out +${PACKAGE}FILES+= test_01.XP.err +${PACKAGE}FILES+= test_01.XP.out +${PACKAGE}FILES+= test_01.err +${PACKAGE}FILES+= test_01.out +${PACKAGE}FILES+= test_02.E.err +${PACKAGE}FILES+= test_02.E.out +${PACKAGE}FILES+= test_02.H.err +${PACKAGE}FILES+= test_02.H.out +${PACKAGE}FILES+= test_02.HIPx.err +${PACKAGE}FILES+= test_02.HIPx.out +${PACKAGE}FILES+= test_02.HP.err +${PACKAGE}FILES+= test_02.HP.out +${PACKAGE}FILES+= test_02.J.err +${PACKAGE}FILES+= test_02.J.out +${PACKAGE}FILES+= test_02.JP.err +${PACKAGE}FILES+= test_02.JP.out +${PACKAGE}FILES+= test_02.T.err +${PACKAGE}FILES+= test_02.T.out +${PACKAGE}FILES+= test_02.X.err +${PACKAGE}FILES+= test_02.X.out +${PACKAGE}FILES+= test_02.XP.err +${PACKAGE}FILES+= test_02.XP.out +${PACKAGE}FILES+= test_02.err +${PACKAGE}FILES+= test_02.out +${PACKAGE}FILES+= test_03.E.err +${PACKAGE}FILES+= test_03.E.out +${PACKAGE}FILES+= test_03.H.err +${PACKAGE}FILES+= test_03.H.out +${PACKAGE}FILES+= test_03.HIPx.err +${PACKAGE}FILES+= test_03.HIPx.out +${PACKAGE}FILES+= test_03.HP.err +${PACKAGE}FILES+= test_03.HP.out +${PACKAGE}FILES+= test_03.J.err +${PACKAGE}FILES+= test_03.J.out +${PACKAGE}FILES+= test_03.JP.err +${PACKAGE}FILES+= test_03.JP.out +${PACKAGE}FILES+= test_03.T.err +${PACKAGE}FILES+= test_03.T.out +${PACKAGE}FILES+= test_03.X.err +${PACKAGE}FILES+= test_03.X.out +${PACKAGE}FILES+= test_03.XP.err +${PACKAGE}FILES+= test_03.XP.out +${PACKAGE}FILES+= test_03.err +${PACKAGE}FILES+= test_03.out +${PACKAGE}FILES+= test_04.E.err +${PACKAGE}FILES+= test_04.E.out +${PACKAGE}FILES+= test_04.H.err +${PACKAGE}FILES+= test_04.H.out +${PACKAGE}FILES+= test_04.HIPx.err +${PACKAGE}FILES+= test_04.HIPx.out +${PACKAGE}FILES+= test_04.HP.err +${PACKAGE}FILES+= test_04.HP.out +${PACKAGE}FILES+= test_04.J.err +${PACKAGE}FILES+= test_04.J.out +${PACKAGE}FILES+= test_04.JP.err +${PACKAGE}FILES+= test_04.JP.out +${PACKAGE}FILES+= test_04.T.err +${PACKAGE}FILES+= test_04.T.out +${PACKAGE}FILES+= test_04.X.err +${PACKAGE}FILES+= test_04.X.out +${PACKAGE}FILES+= test_04.XP.err +${PACKAGE}FILES+= test_04.XP.out +${PACKAGE}FILES+= test_05.E.err +${PACKAGE}FILES+= test_05.E.out +${PACKAGE}FILES+= test_05.H.err +${PACKAGE}FILES+= test_05.H.out +${PACKAGE}FILES+= test_05.HIPx.err +${PACKAGE}FILES+= test_05.HIPx.out +${PACKAGE}FILES+= test_05.HP.err +${PACKAGE}FILES+= test_05.HP.out +${PACKAGE}FILES+= test_05.J.err +${PACKAGE}FILES+= test_05.J.out +${PACKAGE}FILES+= test_05.JP.err +${PACKAGE}FILES+= test_05.JP.out +${PACKAGE}FILES+= test_05.T.err +${PACKAGE}FILES+= test_05.T.out +${PACKAGE}FILES+= test_05.X.err +${PACKAGE}FILES+= test_05.X.out +${PACKAGE}FILES+= test_05.XP.err +${PACKAGE}FILES+= test_05.XP.out +${PACKAGE}FILES+= test_06.E.err +${PACKAGE}FILES+= test_06.E.out +${PACKAGE}FILES+= test_06.H.err +${PACKAGE}FILES+= test_06.H.out +${PACKAGE}FILES+= test_06.HIPx.err +${PACKAGE}FILES+= test_06.HIPx.out +${PACKAGE}FILES+= test_06.HP.err +${PACKAGE}FILES+= test_06.HP.out +${PACKAGE}FILES+= test_06.J.err +${PACKAGE}FILES+= test_06.J.out +${PACKAGE}FILES+= test_06.JP.err +${PACKAGE}FILES+= test_06.JP.out +${PACKAGE}FILES+= test_06.T.err +${PACKAGE}FILES+= test_06.T.out +${PACKAGE}FILES+= test_06.X.err +${PACKAGE}FILES+= test_06.X.out +${PACKAGE}FILES+= test_06.XP.err +${PACKAGE}FILES+= test_06.XP.out +${PACKAGE}FILES+= test_07.E.err +${PACKAGE}FILES+= test_07.E.out +${PACKAGE}FILES+= test_07.H.err +${PACKAGE}FILES+= test_07.H.out +${PACKAGE}FILES+= test_07.HIPx.err +${PACKAGE}FILES+= test_07.HIPx.out +${PACKAGE}FILES+= test_07.HP.err +${PACKAGE}FILES+= test_07.HP.out +${PACKAGE}FILES+= test_07.J.err +${PACKAGE}FILES+= test_07.J.out +${PACKAGE}FILES+= test_07.JP.err +${PACKAGE}FILES+= test_07.JP.out +${PACKAGE}FILES+= test_07.T.err +${PACKAGE}FILES+= test_07.T.out +${PACKAGE}FILES+= test_07.X.err +${PACKAGE}FILES+= test_07.X.out +${PACKAGE}FILES+= test_07.XP.err +${PACKAGE}FILES+= test_07.XP.out +${PACKAGE}FILES+= test_08.E.err +${PACKAGE}FILES+= test_08.E.out +${PACKAGE}FILES+= test_08.H.err +${PACKAGE}FILES+= test_08.H.out +${PACKAGE}FILES+= test_08.HIPx.err +${PACKAGE}FILES+= test_08.HIPx.out +${PACKAGE}FILES+= test_08.HP.err +${PACKAGE}FILES+= test_08.HP.out +${PACKAGE}FILES+= test_08.J.err +${PACKAGE}FILES+= test_08.J.out +${PACKAGE}FILES+= test_08.JP.err +${PACKAGE}FILES+= test_08.JP.out +${PACKAGE}FILES+= test_08.T.err +${PACKAGE}FILES+= test_08.T.out +${PACKAGE}FILES+= test_08.X.err +${PACKAGE}FILES+= test_08.X.out +${PACKAGE}FILES+= test_08.XP.err +${PACKAGE}FILES+= test_08.XP.out +${PACKAGE}FILES+= test_09.E.err +${PACKAGE}FILES+= test_09.E.out +${PACKAGE}FILES+= test_09.H.err +${PACKAGE}FILES+= test_09.H.out +${PACKAGE}FILES+= test_09.HIPx.err +${PACKAGE}FILES+= test_09.HIPx.out +${PACKAGE}FILES+= test_09.HP.err +${PACKAGE}FILES+= test_09.HP.out +${PACKAGE}FILES+= test_09.J.err +${PACKAGE}FILES+= test_09.J.out +${PACKAGE}FILES+= test_09.JP.err +${PACKAGE}FILES+= test_09.JP.out +${PACKAGE}FILES+= test_09.T.err +${PACKAGE}FILES+= test_09.T.out +${PACKAGE}FILES+= test_09.X.err +${PACKAGE}FILES+= test_09.X.out +${PACKAGE}FILES+= test_09.XP.err +${PACKAGE}FILES+= test_09.XP.out +${PACKAGE}FILES+= test_10.E.err +${PACKAGE}FILES+= test_10.E.out +${PACKAGE}FILES+= test_10.H.err +${PACKAGE}FILES+= test_10.H.out +${PACKAGE}FILES+= test_10.HIPx.err +${PACKAGE}FILES+= test_10.HIPx.out +${PACKAGE}FILES+= test_10.HP.err +${PACKAGE}FILES+= test_10.HP.out +${PACKAGE}FILES+= test_10.J.err +${PACKAGE}FILES+= test_10.J.out +${PACKAGE}FILES+= test_10.JP.err +${PACKAGE}FILES+= test_10.JP.out +${PACKAGE}FILES+= test_10.T.err +${PACKAGE}FILES+= test_10.T.out +${PACKAGE}FILES+= test_10.X.err +${PACKAGE}FILES+= test_10.X.out +${PACKAGE}FILES+= test_10.XP.err +${PACKAGE}FILES+= test_10.XP.out +${PACKAGE}FILES+= test_10.err +${PACKAGE}FILES+= test_10.out +${PACKAGE}FILES+= test_11.E.err +${PACKAGE}FILES+= test_11.E.out +${PACKAGE}FILES+= test_11.H.err +${PACKAGE}FILES+= test_11.H.out +${PACKAGE}FILES+= test_11.HIPx.err +${PACKAGE}FILES+= test_11.HIPx.out +${PACKAGE}FILES+= test_11.HP.err +${PACKAGE}FILES+= test_11.HP.out +${PACKAGE}FILES+= test_11.J.err +${PACKAGE}FILES+= test_11.J.out +${PACKAGE}FILES+= test_11.JP.err +${PACKAGE}FILES+= test_11.JP.out +${PACKAGE}FILES+= test_11.T.err +${PACKAGE}FILES+= test_11.T.out +${PACKAGE}FILES+= test_11.X.err +${PACKAGE}FILES+= test_11.X.out +${PACKAGE}FILES+= test_11.XP.err +${PACKAGE}FILES+= test_11.XP.out + +PROGS+= test_01 +PROGS+= test_02 +PROGS+= test_03 +PROGS+= test_04 +PROGS+= test_05 +PROGS+= test_06 +PROGS+= test_07 +PROGS+= test_08 +PROGS+= test_09 +PROGS+= test_10 +PROGS+= test_11 + +CFLAGS+= -I${LIBXOSRC}/libxo -I${.CURDIR:H}/libxo + +LIBADD= xo util + +SUBDIR+= encoder + +.include <bsd.test.mk> diff --git a/lib/libxo/tests/Makefile.depend b/lib/libxo/tests/Makefile.depend new file mode 100644 index 000000000000..5d2f1f63e4fc --- /dev/null +++ b/lib/libxo/tests/Makefile.depend @@ -0,0 +1,15 @@ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libutil \ + lib/libxo/libxo \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/lib/libxo/tests/encoder/Makefile b/lib/libxo/tests/encoder/Makefile new file mode 100644 index 000000000000..02634b971ace --- /dev/null +++ b/lib/libxo/tests/encoder/Makefile @@ -0,0 +1,20 @@ +PACKAGE= tests +NO_DEV_PACKAGE= + +LIBXOSRC= ${SRCTOP}/contrib/libxo + +.PATH: ${LIBXOSRC}/encoder/test + +SHLIB_NAME= libenc_test.so + +LIBDIR= ${TESTSBASE}/lib/libxo + +SYMLINKS+= ${LIBDIR}/${SHLIB_NAME} /usr/lib/libxo/encoder/test.enc + +SRCS= enc_test.c + +CFLAGS+= -I${LIBXOSRC}/libxo -I${.CURDIR:H:H}/libxo + +LIBADD= xo + +.include <bsd.lib.mk> diff --git a/lib/libxo/tests/encoder/Makefile.depend b/lib/libxo/tests/encoder/Makefile.depend new file mode 100644 index 000000000000..b95024e29443 --- /dev/null +++ b/lib/libxo/tests/encoder/Makefile.depend @@ -0,0 +1,16 @@ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libxo/libxo \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/lib/libxo/tests/functional_test.sh b/lib/libxo/tests/functional_test.sh new file mode 100755 index 000000000000..cf1ea1af34f0 --- /dev/null +++ b/lib/libxo/tests/functional_test.sh @@ -0,0 +1,75 @@ +# +# Copyright 2015 EMC Corp. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +SRCDIR=$(atf_get_srcdir) + +check() +{ + local tc=${1}; shift + local xo_fmt=${1}; shift + + local err_file="${SRCDIR}/${tc}${xo_fmt:+.${xo_fmt}}.err" + [ -s "${err_file}" ] && err_flag="-e file:${err_file}" + local out_file="${SRCDIR}/${tc}${xo_fmt:+.${xo_fmt}}.out" + [ -s "${out_file}" ] && out_flag="-o file:${out_file}" + + if [ "$xo_fmt" = "E" ]; then + libxo_options=" warn,encoder=test" + else + libxo_options=":W${xo_fmt}" + fi + + atf_check -s exit:0 -e file:${err_file} -o file:${out_file} \ + env LC_ALL=en_US.UTF-8 \ + TZ="EST" "${SRCDIR}/${tc}" --libxo${libxo_options}\ + +} + +add_testcase() +{ + local tc=${1} + local tc_escaped + + oldIFS=$IFS + IFS='.' + set -- $tc + tc_script=${1} + [ $# -eq 3 ] && xo_fmt=${2} # Don't set xo_fmt to `out' + IFS=$oldIFS + tc_escaped="${tc_script}${xo_fmt:+__${xo_fmt}}" + + atf_test_case ${tc_escaped} + eval "${tc_escaped}_body() { check ${tc_script} ${xo_fmt}; }" + atf_add_test_case ${tc_escaped} +} + +atf_init_test_cases() +{ + for path in $(find -Es "${SRCDIR}" -name '*.out'); do + add_testcase ${path##*/} + done +} |