aboutsummaryrefslogtreecommitdiff
path: root/lib/libxo
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libxo')
-rw-r--r--lib/libxo/Makefile9
-rw-r--r--lib/libxo/Makefile.depend11
-rw-r--r--lib/libxo/add.man29
-rw-r--r--lib/libxo/encoder/Makefile11
-rw-r--r--lib/libxo/encoder/csv/Makefile22
-rw-r--r--lib/libxo/encoder/csv/Makefile.depend17
-rw-r--r--lib/libxo/libxo/Makefile113
-rw-r--r--lib/libxo/libxo/Makefile.depend16
-rw-r--r--lib/libxo/libxo/xo_config.h259
-rw-r--r--lib/libxo/tests/Makefile249
-rw-r--r--lib/libxo/tests/Makefile.depend15
-rw-r--r--lib/libxo/tests/encoder/Makefile20
-rw-r--r--lib/libxo/tests/encoder/Makefile.depend16
-rwxr-xr-xlib/libxo/tests/functional_test.sh75
14 files changed, 862 insertions, 0 deletions
diff --git a/lib/libxo/Makefile b/lib/libxo/Makefile
new file mode 100644
index 000000000000..97172d0e8637
--- /dev/null
+++ b/lib/libxo/Makefile
@@ -0,0 +1,9 @@
+.include <src.opts.mk>
+
+HAS_TESTS=
+
+SUBDIR.${MK_TESTS}+= tests
+
+SUBDIR = libxo .WAIT encoder
+
+.include <bsd.subdir.mk>
diff --git a/lib/libxo/Makefile.depend b/lib/libxo/Makefile.depend
new file mode 100644
index 000000000000..7584a270678f
--- /dev/null
+++ b/lib/libxo/Makefile.depend
@@ -0,0 +1,11 @@
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ ${DEP_RELDIR}/libxo \
+ ${DEP_RELDIR}/encoder \
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/lib/libxo/add.man b/lib/libxo/add.man
new file mode 100644
index 000000000000..f64d1b16ac43
--- /dev/null
+++ b/lib/libxo/add.man
@@ -0,0 +1,29 @@
+.Sh ADDITIONAL DOCUMENTATION
+.Fx
+uses
+.Nm libxo
+version 1.6.0.
+Complete documentation can be found on github:
+.Bd -literal -offset indent
+https://juniper.github.io/libxo/1.6.0/html/index.html
+.Ed
+.Pp
+.Nm libxo
+lives on github as:
+.Bd -literal -offset indent
+https://github.com/Juniper/libxo
+.Ed
+.Pp
+The latest release of
+.Nm libxo
+is available at:
+.Bd -literal -offset indent
+https://github.com/Juniper/libxo/releases
+.Ed
+.Sh HISTORY
+The
+.Nm libxo
+library was added in
+.Fx 11.0 .
+.Sh AUTHOR
+Phil Shafer
diff --git a/lib/libxo/encoder/Makefile b/lib/libxo/encoder/Makefile
new file mode 100644
index 000000000000..1b479d065d90
--- /dev/null
+++ b/lib/libxo/encoder/Makefile
@@ -0,0 +1,11 @@
+SHLIBDIR?= /lib
+
+.include <src.opts.mk>
+
+PACKAGE= runtime
+
+LIBXOSRC= ${SRCTOP}/contrib/libxo
+
+SUBDIR = csv
+
+.include <bsd.subdir.mk>
diff --git a/lib/libxo/encoder/csv/Makefile b/lib/libxo/encoder/csv/Makefile
new file mode 100644
index 000000000000..442883a61998
--- /dev/null
+++ b/lib/libxo/encoder/csv/Makefile
@@ -0,0 +1,22 @@
+.include <src.opts.mk>
+
+PACKAGE= runtime
+
+LIBXOSRC= ${SRCTOP}/contrib/libxo
+
+.PATH: ${LIBXOSRC}/encoder/csv
+
+SHLIBDIR= ${LIBDIR}/libxo/encoder
+SHLIB_NAME= csv.enc
+
+SRCS= enc_csv.c
+
+CFLAGS+=-I${LIBXOSRC}/libxo -I${.CURDIR}
+CFLAGS+=-DXO_ENCODERDIR=\"${LIBDIR}/libxo/encoder\"
+
+LIBADD= util xo
+LDFLAGS += -L${.OBJDIR:H:H}/libxo
+
+WARNS?= 5
+
+.include <bsd.lib.mk>
diff --git a/lib/libxo/encoder/csv/Makefile.depend b/lib/libxo/encoder/csv/Makefile.depend
new file mode 100644
index 000000000000..b915f0b12d3b
--- /dev/null
+++ b/lib/libxo/encoder/csv/Makefile.depend
@@ -0,0 +1,17 @@
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+ 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/libxo/Makefile b/lib/libxo/libxo/Makefile
new file mode 100644
index 000000000000..38e6ff031c7f
--- /dev/null
+++ b/lib/libxo/libxo/Makefile
@@ -0,0 +1,113 @@
+SHLIBDIR?= /lib
+
+.include <src.opts.mk>
+
+PACKAGE= runtime
+
+LIBXOSRC= ${SRCTOP}/contrib/libxo
+
+.PATH: ${LIBXOSRC}/libxo
+
+LIB= xo
+SHLIB_MAJOR=0
+
+SRCS= libxo.c xo_encoder.c xo_syslog.c
+
+CFLAGS+=-I${LIBXOSRC}/libxo -I${.CURDIR}
+CFLAGS+=-DXO_ENCODERDIR=\"${LIBDIR}/libxo/encoder\"
+
+INCS= xo.h xo_encoder.h
+INCSDIR=${INCLUDEDIR}/libxo
+
+LIBADD= util
+
+WARNS?= 5
+
+MAN+= libxo.3
+MAN+= xo_attr.3 \
+ xo_create.3 \
+ xo_emit.3 \
+ xo_emit_err.3 \
+ xo_emit_f.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
+
+MAN+= xo_options.7
+
+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
+
+.include <bsd.lib.mk>
diff --git a/lib/libxo/libxo/Makefile.depend b/lib/libxo/libxo/Makefile.depend
new file mode 100644
index 000000000000..678747db6f2c
--- /dev/null
+++ b/lib/libxo/libxo/Makefile.depend
@@ -0,0 +1,16 @@
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/lib/libxo/libxo/xo_config.h b/lib/libxo/libxo/xo_config.h
new file mode 100644
index 000000000000..fac47ae77df4
--- /dev/null
+++ b/lib/libxo/libxo/xo_config.h
@@ -0,0 +1,259 @@
+/* libxo/xo_config.h. Generated from xo_config.h.in by configure. */
+/* libxo/xo_config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+ */
+/* #undef HAVE_ALLOCA_H */
+
+/* Define to 1 if you have the `asprintf' function. */
+#define HAVE_ASPRINTF 1
+
+/* Define to 1 if you have the `bzero' function. */
+#define HAVE_BZERO 1
+
+/* Define to 1 if you have the `ctime' function. */
+#define HAVE_CTIME 1
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#define HAVE_CTYPE_H 1
+
+/* Define to 1 if you have the declaration of `__isthreaded', and to 0 if you
+ don't. */
+#define HAVE_DECL___ISTHREADED 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the `dlfunc' function. */
+#define HAVE_DLFUNC 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the `fdopen' function. */
+#define HAVE_FDOPEN 1
+
+/* Define to 1 if you have the `flock' function. */
+#define HAVE_FLOCK 1
+
+/* Using real gcc */
+/* #undef HAVE_GCC */
+
+/* Define to 1 if you have the `getpass' function. */
+#define HAVE_GETPASS 1
+
+/* Define to 1 if you have the `getprogname' function. */
+#define HAVE_GETPROGNAME 1
+
+/* Define to 1 if you have the `getrusage' function. */
+#define HAVE_GETRUSAGE 1
+
+/* gettext(3) */
+/* #undef HAVE_GETTEXT */
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* humanize_number(3) */
+#define HAVE_HUMANIZE_NUMBER 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `crypto' library (-lcrypto). */
+#define HAVE_LIBCRYPTO 1
+
+/* Define to 1 if you have the `m' library (-lm). */
+#define HAVE_LIBM 1
+
+/* Define to 1 if you have the <libutil.h> header file. */
+#define HAVE_LIBUTIL_H 1
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+ to 0 otherwise. */
+#define HAVE_MALLOC 1
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <monitor.h> header file. */
+/* #undef HAVE_MONITOR_H */
+
+/* Support printflike */
+/* #undef HAVE_PRINTFLIKE */
+
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+ and to 0 otherwise. */
+#define HAVE_REALLOC 1
+
+/* Define to 1 if you have the `srand' function. */
+#define HAVE_SRAND 1
+
+/* Define to 1 if you have the `sranddev' function. */
+/* #undef HAVE_SRANDDEV */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdio_ext.h> header file. */
+/* #undef HAVE_STDIO_EXT_H */
+
+/* Define to 1 if you have the <stdio.h> header file. */
+#define HAVE_STDIO_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <stdtime/tzfile.h> header file. */
+/* #undef HAVE_STDTIME_TZFILE_H */
+
+/* Define to 1 if you have the `strchr' function. */
+#define HAVE_STRCHR 1
+
+/* Define to 1 if you have the `strcspn' function. */
+#define HAVE_STRCSPN 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+#define HAVE_STRLCPY 1
+
+/* Define to 1 if you have the `strspn' function. */
+#define HAVE_STRSPN 1
+
+/* Have struct sockaddr_un.sun_len */
+#define HAVE_SUN_LEN 1
+
+/* Define to 1 if you have the `sysctlbyname' function. */
+#define HAVE_SYSCTLBYNAME 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/sysctl.h> header file. */
+#define HAVE_SYS_SYSCTL_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <threads.h> header file. */
+#define HAVE_THREADS_H 1
+
+/* thread-local setting */
+#define HAVE_THREAD_LOCAL THREAD_LOCAL_before
+
+/* Define to 1 if you have the <tzfile.h> header file. */
+/* #undef HAVE_TZFILE_H */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `__flbf' function. */
+/* #undef HAVE___FLBF */
+
+/* Enable debugging */
+/* #undef LIBXO_DEBUG */
+
+/* Enable text-only rendering */
+/* #undef LIBXO_TEXT_ONLY */
+
+/* Version number as dotted value */
+#define LIBXO_VERSION "1.6.0"
+
+/* Version number extra information */
+#define LIBXO_VERSION_EXTRA ""
+
+/* Version number as a number */
+#define LIBXO_VERSION_NUMBER 1006000
+
+/* Version number as string */
+#define LIBXO_VERSION_STRING "1006000"
+
+/* Enable local wcwidth implementation */
+#define LIBXO_WCWIDTH 1
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "libxo"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "phil@juniper.net"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "libxo"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "libxo 1.6.0"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libxo"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.6.0"
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at runtime.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Use int return codes */
+/* #undef USE_INT_RETURN_CODES */
+
+/* Version number of package */
+#define VERSION "1.6.0"
+
+/* Retain hash bucket size */
+/* #undef XO_RETAIN_SIZE */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to rpl_malloc if the replacement function should be used. */
+/* #undef malloc */
+
+/* Define to rpl_realloc if the replacement function should be used. */
+/* #undef realloc */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
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
+}