Index: head/etc/mtree/BSD.tests.dist =================================================================== --- head/etc/mtree/BSD.tests.dist (revision 288928) +++ head/etc/mtree/BSD.tests.dist (revision 288929) @@ -1,592 +1,596 @@ # $FreeBSD$ # # Please see the file src/etc/mtree/README before making changes to this file. # /set type=dir uname=root gname=wheel mode=0755 . bin cat .. chown .. date .. expr .. ls .. mv .. pax .. pkill .. sh builtins .. errors .. execution .. expansion .. parameters .. parser .. set-e .. .. sleep .. test .. .. cddl lib .. sbin .. usr.bin .. usr.sbin dtrace common aggs .. arithmetic .. arrays .. assocs .. begin .. bitfields .. buffering .. builtinvar .. cg .. clauses .. cpc .. decls .. drops .. dtraceUtil .. end .. enum .. error .. exit .. fbtprovider .. funcs .. grammar .. include .. inline .. io .. ip .. java_api .. json .. lexer .. llquantize .. mdb .. mib .. misc .. multiaggs .. offsetof .. operators .. pid .. plockstat .. pointers .. pragma .. predicates .. preprocessor .. print .. printa .. printf .. privs .. probes .. proc .. profile-n .. providers .. raise .. rates .. safety .. scalars .. sched .. scripting .. sdt .. sizeof .. speculation .. stability .. stack .. stackdepth .. stop .. strlen .. strtoll .. struct .. syscall .. sysevent .. tick-n .. trace .. tracemem .. translators .. typedef .. types .. uctf .. union .. usdt .. ustack .. vars .. version .. .. .. .. .. etc rc.d .. .. games .. gnu lib .. usr.bin diff .. .. .. lib atf libatf-c detail .. .. libatf-c++ detail .. .. test-programs .. .. libc c063 .. db .. gen execve .. posix_spawn .. .. hash data .. .. inet .. locale .. net getaddrinfo data .. .. .. regex data .. .. ssp .. stdio .. stdlib .. string .. sys .. time .. tls dso .. .. termios .. ttyio .. .. libcrypt .. libmp .. libnv .. libpam .. libproc .. librt .. libthr dlopen .. .. libutil .. + libxo + .. msun .. .. libexec atf atf-check .. atf-sh .. .. rtld-elf .. .. sbin dhclient .. devd .. growfs .. ifconfig .. mdconfig .. .. secure lib .. libexec .. usr.bin .. usr.sbin .. .. share examples tests atf .. plain .. .. .. .. sys aio .. fifo .. file .. kern execve .. .. kqueue .. mqueue .. netinet .. opencrypto .. pjdfstest chflags .. chmod .. chown .. ftruncate .. granular .. link .. mkdir .. mkfifo .. mknod .. open .. rename .. rmdir .. symlink .. truncate .. unlink .. .. vm .. .. usr.bin apply .. basename .. bmake archives fmt_44bsd .. fmt_44bsd_mod .. fmt_oldbsd .. .. basic t0 .. t1 .. t2 .. t3 .. .. execution ellipsis .. empty .. joberr .. plus .. .. shell builtin .. meta .. path .. path_select .. replace .. select .. .. suffixes basic .. src_wild1 .. src_wild2 .. .. syntax directive-t0 .. enl .. funny-targets .. semi .. .. sysmk t0 2 1 .. .. mk .. .. t1 2 1 .. .. mk .. .. t2 2 1 .. .. mk .. .. .. variables modifier_M .. modifier_t .. opt_V .. t0 .. .. .. calendar .. cmp .. col .. comm .. cut .. dirname .. file2c .. grep .. gzip .. ident .. join .. jot .. lastcomm .. m4 .. mkimg .. ncal .. opensm .. printf .. sed regress.multitest.out .. .. soelim .. timeout .. tr .. truncate .. units .. uudecode .. uuencode .. xargs + .. + xo .. yacc yacc .. .. .. usr.sbin etcupdate .. fstyp .. newsyslog .. nmtree .. pw .. sa .. .. .. # vim: set expandtab ts=4 sw=4: Index: head/lib/libxo/Makefile =================================================================== --- head/lib/libxo/Makefile (revision 288928) +++ head/lib/libxo/Makefile (revision 288929) @@ -1,105 +1,111 @@ # $FreeBSD$ +.include + LIBXOSRC= ${SRCTOP}/contrib/libxo .PATH: ${LIBXOSRC}/libxo LIB= xo SHLIB_MAJOR=0 SHLIBDIR?= /lib SRCS= libxo.c xo_encoder.c xo_syslog.c CFLAGS+=-I${LIBXOSRC}/libxo CFLAGS+=-DXO_ENCODERDIR=\"/usr/lib/libxo/encoder\" INCS= xo.h xo_encoder.h INCSDIR=${INCLUDEDIR}/libxo WARNS?= 5 MAN+= libxo.3 MAN+= xo_attr.3 \ xo_create.3 \ xo_emit.3 \ xo_emit_err.3 \ xo_err.3 \ xo_error.3 \ xo_finish.3 \ xo_flush.3 \ xo_message.3 \ xo_no_setlocale.3 \ xo_open_container.3 \ xo_open_list.3 \ xo_open_marker.3 \ xo_parse_args.3 \ xo_set_allocator.3 \ xo_set_flags.3 \ xo_set_info.3 \ xo_set_options.3 \ xo_set_style.3 \ xo_set_syslog_enterprise_id.3 \ xo_set_version.3 \ xo_set_writer.3 \ xo_syslog.3 MAN+= xo_format.5 MLINKS= xo_attr.3 xo_attr_h.3 \ xo_attr.3 xo_attr_hv.3 \ xo_create.3 xo_create_to_file.3 \ xo_create.3 xo_destroy.3 \ xo_emit.3 xo_emit_h.3 \ xo_emit.3 xo_emit_hv.3 \ xo_emit_err.3 xo_emit_errc.3 \ xo_emit_err.3 xo_emit_errx.3 \ xo_emit_err.3 xo_emit_warn.3 \ xo_emit_err.3 xo_emit_warnx.3 \ xo_emit_err.3 xo_emit_warn_c.3 \ xo_emit_err.3 xo_emit_warn_hc.3 \ xo_err.3 xo_errc.3 \ xo_err.3 xo_errx.3 \ xo_err.3 xo_warn.3 \ xo_err.3 xo_warnx.3 \ xo_err.3 xo_warn_c.3 \ xo_err.3 xo_warn_hc.3 \ xo_finish.3 xo_finish_h.3 \ xo_flush.3 xo_flush_h.3 \ xo_message.3 xo_message_c.3 \ xo_message.3 xo_message_hc.3 \ xo_message.3 xo_message_hcv.3 \ xo_open_container.3 xo_open_container_h.3 \ xo_open_container.3 xo_open_container_hd.3 \ xo_open_container.3 xo_open_container_d.3 \ xo_open_container.3 xo_close_container.3 \ xo_open_container.3 xo_close_container_h.3 \ xo_open_container.3 xo_close_container_hd.3 \ xo_open_container.3 xo_close_container_d.3 \ xo_open_list.3 xo_open_list_h.3 \ xo_open_list.3 xo_open_list_hd.3 \ xo_open_list.3 xo_open_list_d.3 \ xo_open_list.3 xo_open_instance.3 \ xo_open_list.3 xo_open_instance_h.3 \ xo_open_list.3 xo_open_instance_hd.3 \ xo_open_list.3 xo_open_instance_d.3 \ xo_open_list.3 xo_close_instance.3 \ xo_open_list.3 xo_close_instance_h.3 \ xo_open_list.3 xo_close_instance_hd.3 \ xo_open_list.3 xo_close_instance_d.3 \ xo_open_list.3 xo_close_list.3 \ xo_open_list.3 xo_close_list_h.3 \ xo_open_list.3 xo_close_list_hd.3 \ xo_open_list.3 xo_close_list_d.3 \ xo_open_marker.3 xo_open_marker_h.3 \ xo_open_marker.3 xo_close_marker.3 \ xo_open_marker.3 xo_close_marker_h.3 \ xo_parse_args.3 xo_set_program.3 \ xo_set_flags.3 xo_clear_flags.3 \ xo_set_style.3 xo_set_style_name.3 \ xo_set_version.3 xo_set_version_h.3 \ xo_syslog.3 xo_close_log.3 \ xo_syslog.3 xo_open_log.3 \ xo_syslog.3 xo_set_logmask.3 \ xo_syslog.3 xo_vsyslog.3 + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .include Index: head/lib/libxo/tests/Makefile =================================================================== --- head/lib/libxo/tests/Makefile (nonexistent) +++ head/lib/libxo/tests/Makefile (revision 288929) @@ -0,0 +1,253 @@ +# $FreeBSD$ + +.include + +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: + +TESTSDIR= ${TESTSBASE}/lib/libxo + +ATF_TESTS_SH+= functional_test + +BINDIR= ${TESTSDIR} + +FILES+= test_01.E.err +FILES+= test_01.E.out +FILES+= test_01.H.err +FILES+= test_01.H.out +FILES+= test_01.HIPx.err +FILES+= test_01.HIPx.out +FILES+= test_01.HP.err +FILES+= test_01.HP.out +FILES+= test_01.J.err +FILES+= test_01.J.out +FILES+= test_01.JP.err +FILES+= test_01.JP.out +FILES+= test_01.T.err +FILES+= test_01.T.out +FILES+= test_01.X.err +FILES+= test_01.X.out +FILES+= test_01.XP.err +FILES+= test_01.XP.out +FILES+= test_01.err +FILES+= test_01.out +FILES+= test_02.E.err +FILES+= test_02.E.out +FILES+= test_02.H.err +FILES+= test_02.H.out +FILES+= test_02.HIPx.err +FILES+= test_02.HIPx.out +FILES+= test_02.HP.err +FILES+= test_02.HP.out +FILES+= test_02.J.err +FILES+= test_02.J.out +FILES+= test_02.JP.err +FILES+= test_02.JP.out +FILES+= test_02.T.err +FILES+= test_02.T.out +FILES+= test_02.X.err +FILES+= test_02.X.out +FILES+= test_02.XP.err +FILES+= test_02.XP.out +FILES+= test_02.err +FILES+= test_02.out +FILES+= test_03.E.err +FILES+= test_03.E.out +FILES+= test_03.H.err +FILES+= test_03.H.out +FILES+= test_03.HIPx.err +FILES+= test_03.HIPx.out +FILES+= test_03.HP.err +FILES+= test_03.HP.out +FILES+= test_03.J.err +FILES+= test_03.J.out +FILES+= test_03.JP.err +FILES+= test_03.JP.out +FILES+= test_03.T.err +FILES+= test_03.T.out +FILES+= test_03.X.err +FILES+= test_03.X.out +FILES+= test_03.XP.err +FILES+= test_03.XP.out +FILES+= test_03.err +FILES+= test_03.out +FILES+= test_04.E.err +FILES+= test_04.E.out +FILES+= test_04.H.err +FILES+= test_04.H.out +FILES+= test_04.HIPx.err +FILES+= test_04.HIPx.out +FILES+= test_04.HP.err +FILES+= test_04.HP.out +FILES+= test_04.J.err +FILES+= test_04.J.out +FILES+= test_04.JP.err +FILES+= test_04.JP.out +FILES+= test_04.T.err +FILES+= test_04.T.out +FILES+= test_04.X.err +FILES+= test_04.X.out +FILES+= test_04.XP.err +FILES+= test_04.XP.out +FILES+= test_05.E.err +FILES+= test_05.E.out +FILES+= test_05.H.err +FILES+= test_05.H.out +FILES+= test_05.HIPx.err +FILES+= test_05.HIPx.out +FILES+= test_05.HP.err +FILES+= test_05.HP.out +FILES+= test_05.J.err +FILES+= test_05.J.out +FILES+= test_05.JP.err +FILES+= test_05.JP.out +FILES+= test_05.T.err +FILES+= test_05.T.out +FILES+= test_05.X.err +FILES+= test_05.X.out +FILES+= test_05.XP.err +FILES+= test_05.XP.out +FILES+= test_06.E.err +FILES+= test_06.E.out +FILES+= test_06.H.err +FILES+= test_06.H.out +FILES+= test_06.HIPx.err +FILES+= test_06.HIPx.out +FILES+= test_06.HP.err +FILES+= test_06.HP.out +FILES+= test_06.J.err +FILES+= test_06.J.out +FILES+= test_06.JP.err +FILES+= test_06.JP.out +FILES+= test_06.T.err +FILES+= test_06.T.out +FILES+= test_06.X.err +FILES+= test_06.X.out +FILES+= test_06.XP.err +FILES+= test_06.XP.out +FILES+= test_07.E.err +FILES+= test_07.E.out +FILES+= test_07.H.err +FILES+= test_07.H.out +FILES+= test_07.HIPx.err +FILES+= test_07.HIPx.out +FILES+= test_07.HP.err +FILES+= test_07.HP.out +FILES+= test_07.J.err +FILES+= test_07.J.out +FILES+= test_07.JP.err +FILES+= test_07.JP.out +FILES+= test_07.T.err +FILES+= test_07.T.out +FILES+= test_07.X.err +FILES+= test_07.X.out +FILES+= test_07.XP.err +FILES+= test_07.XP.out +FILES+= test_08.E.err +FILES+= test_08.E.out +FILES+= test_08.H.err +FILES+= test_08.H.out +FILES+= test_08.HIPx.err +FILES+= test_08.HIPx.out +FILES+= test_08.HP.err +FILES+= test_08.HP.out +FILES+= test_08.J.err +FILES+= test_08.J.out +FILES+= test_08.JP.err +FILES+= test_08.JP.out +FILES+= test_08.T.err +FILES+= test_08.T.out +FILES+= test_08.X.err +FILES+= test_08.X.out +FILES+= test_08.XP.err +FILES+= test_08.XP.out +FILES+= test_09.E.err +FILES+= test_09.E.out +FILES+= test_09.H.err +FILES+= test_09.H.out +FILES+= test_09.HIPx.err +FILES+= test_09.HIPx.out +FILES+= test_09.HP.err +FILES+= test_09.HP.out +FILES+= test_09.J.err +FILES+= test_09.J.out +FILES+= test_09.JP.err +FILES+= test_09.JP.out +FILES+= test_09.T.err +FILES+= test_09.T.out +FILES+= test_09.X.err +FILES+= test_09.X.out +FILES+= test_09.XP.err +FILES+= test_09.XP.out +FILES+= test_10.E.err +FILES+= test_10.E.out +FILES+= test_10.H.err +FILES+= test_10.H.out +FILES+= test_10.HIPx.err +FILES+= test_10.HIPx.out +FILES+= test_10.HP.err +FILES+= test_10.HP.out +FILES+= test_10.J.err +FILES+= test_10.J.out +FILES+= test_10.JP.err +FILES+= test_10.JP.out +FILES+= test_10.T.err +FILES+= test_10.T.out +FILES+= test_10.X.err +FILES+= test_10.X.out +FILES+= test_10.XP.err +FILES+= test_10.XP.out +FILES+= test_10.err +FILES+= test_10.out +FILES+= test_11.E.err +FILES+= test_11.E.out +FILES+= test_11.H.err +FILES+= test_11.H.out +FILES+= test_11.HIPx.err +FILES+= test_11.HIPx.out +FILES+= test_11.HP.err +FILES+= test_11.HP.out +FILES+= test_11.J.err +FILES+= test_11.J.out +FILES+= test_11.JP.err +FILES+= test_11.JP.out +FILES+= test_11.T.err +FILES+= test_11.T.out +FILES+= test_11.X.err +FILES+= test_11.X.out +FILES+= test_11.XP.err +FILES+= test_11.XP.out + +# XXX: the `E` format testcases don't appear to match the expected format. +#FILES:= ${FILES:N*.E.*} + +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 + +DPADD= ${LIBXO} ${LIBUTIL} +LDADD= -lxo -lutil + +SUBDIR+= encoder + +.include Property changes on: head/lib/libxo/tests/Makefile ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/lib/libxo/tests/functional_test.sh =================================================================== --- head/lib/libxo/tests/functional_test.sh (nonexistent) +++ head/lib/libxo/tests/functional_test.sh (revision 288929) @@ -0,0 +1,76 @@ +# +# 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. +# +# $FreeBSD$ + +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 \ + LIBXO_OPTIONS="${LIBXO_OPTIONS}" TZ="EST" "${SRCDIR}/${tc}" \ + +} + +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 +} Property changes on: head/lib/libxo/tests/functional_test.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/usr.bin/xo/Makefile =================================================================== --- head/usr.bin/xo/Makefile (revision 288928) +++ head/usr.bin/xo/Makefile (revision 288929) @@ -1,15 +1,21 @@ # $FreeBSD$ +.include + LIBXOSRC= ${SRCTOP}/contrib/libxo .PATH: ${LIBXOSRC}/xo PROG= xo MAN= xo.1 # XXX For xoversion.h CFLAGS+=-I${LIBXOSRC}/libxo LIBADD= xo util + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .include Index: head/usr.bin/xo/tests/Makefile =================================================================== --- head/usr.bin/xo/tests/Makefile (nonexistent) +++ head/usr.bin/xo/tests/Makefile (revision 288929) @@ -0,0 +1,40 @@ +# $FreeBSD$ + +.include + +LIBXOSRC= ${SRCTOP}/contrib/libxo + +.PATH: ${LIBXOSRC}/tests/xo ${LIBXOSRC}/tests/xo/saved + +.c.out .o.out: + +TESTSDIR= ${TESTSBASE}/usr.bin/xo + +BINDIR= ${TESTSDIR} + +ATF_TESTS_SH+= functional_test + +FILES+= xo_01.H.err +FILES+= xo_01.H.out +FILES+= xo_01.HIPx.err +FILES+= xo_01.HIPx.out +FILES+= xo_01.HP.err +FILES+= xo_01.HP.out +FILES+= xo_01.J.err +FILES+= xo_01.J.out +FILES+= xo_01.JP.err +FILES+= xo_01.JP.out +FILES+= xo_01.T.err +FILES+= xo_01.T.out +FILES+= xo_01.X.err +FILES+= xo_01.X.out +FILES+= xo_01.XP.err +FILES+= xo_01.XP.out + +SCRIPTS+= xo_01 + +LIBADD+= xo + +.include + +.SUFFIXES: .sh Property changes on: head/usr.bin/xo/tests/Makefile ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/usr.bin/xo/tests/functional_test.sh =================================================================== --- head/usr.bin/xo/tests/functional_test.sh (nonexistent) +++ head/usr.bin/xo/tests/functional_test.sh (revision 288929) @@ -0,0 +1,72 @@ +# +# 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. +# +# $FreeBSD$ + +SRCDIR=$(atf_get_srcdir) + +check() +{ + local tc=${1}; shift + local xo_fmt=${1}; shift + + XO=$(atf_config_get usr.bin.xo.test_xo /usr/bin/xo) + + 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}" + + atf_check -s exit:0 -e file:${err_file} -o file:${out_file} \ + env LC_ALL=en_US.UTF-8 \ + LIBXO_OPTIONS=":W${xo_fmt}" TZ="EST" "${SRCDIR}/${tc}" \ + ${XO} +} + +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 +} Property changes on: head/usr.bin/xo/tests/functional_test.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property