Commit f76d35d1 authored by Daniel Salzman's avatar Daniel Salzman

zscanner: improve building process

parent 8d8ee4ec
......@@ -13,6 +13,8 @@
/src/Makefile.in
/src/tests/Makefile
/src/tests/Makefile.in
/src/zscanner/Makefile
/src/zscanner/Makefile.in
/samples/Makefile
/samples/Makefile.in
/doc/Makefile
......@@ -41,19 +43,18 @@
/samples/knot.sample.conf
/src/stamp-*
/doc/html/
# Binaries
/src/tests/unittests
/src/zscanner-tool
/src/knotc
/src/knotd
/src/knot-zcompile
/INSTALL
/m4/libtool.m4
/m4/ltoptions.m4
/m4/ltsugar.m4
/m4/ltversion.m4
/m4/lt~obsolete.m4
# Binaries
/src/tests/unittests
/src/tests/unittests_xfr
/INSTALL
/src/zscanner/zscanner-tool
/src/knotc
/src/knotd
/src/kdig
/src/khost
/src/knsupdate
......
......@@ -270,6 +270,9 @@ src/utils/nsupdate/nsupdate_exec.h
src/utils/nsupdate/nsupdate_main.c
src/utils/nsupdate/nsupdate_params.c
src/utils/nsupdate/nsupdate_params.h
src/zscanner/Makefile.am
src/zscanner/error.c
src/zscanner/error.h
src/zscanner/file_loader.c
src/zscanner/file_loader.h
src/zscanner/scanner.c
......
......@@ -288,12 +288,12 @@ gl_VISIBILITY()
CFLAGS="$CFLAGS $CFLAG_VISIBILITY"
AC_CONFIG_FILES([Makefile
samples/Makefile
src/Makefile
src/zscanner/Makefile
src/tests/Makefile
doc/Makefile
man/Makefile
src/Makefile
samples/Makefile
src/tests/Makefile
src/zscanner/Makefile
src/zscanner/test/run_tests.sh
src/zscanner/test/cases/06-3_INCLUDE.in:src/zscanner/test/cases/06-3_INCLUDE.inin
src/zscanner/test/cases/06-4_INCLUDE.in:src/zscanner/test/cases/06-4_INCLUDE.inin
......
......@@ -10,10 +10,6 @@ AM_YFLAGS = -d
libknotd_la_YFLAGS = -pcf_ -d
libknotd_la_LFLAGS = # TODO: reentrant parser, prefix
EXTRA_DIST = \
zscanner/test/run_tests.sh \
zscanner/test/cases
BUILT_SOURCES = \
knot/conf/libknotd_la-cf-lex.c \
knot/conf/libknotd_la-cf-parse.c \
......
......@@ -15,12 +15,12 @@
*/
#include <config.h>
#include "common/descriptor.h"
#include <stdio.h> // snprintf
#include <stdlib.h> // strtoul
#include <strings.h> // strcasecmp
#include <common/descriptor.h>
/*!
* \brief Table with DNS classes.
*/
......
......@@ -49,8 +49,6 @@ unittests_SOURCES = \
knot/server_tests.h \
knot/rrl_tests.h \
knot/rrl_tests.c \
zscanner/zscanner_tests.h \
zscanner/zscanner_tests.c \
libknot/dname_tests.h \
libknot/dname_tests.c \
libknot/ztree_tests.h \
......
......@@ -33,7 +33,6 @@
#include "tests/knot/server_tests.h"
#include "tests/knot/conf_tests.h"
#include "tests/knot/rrl_tests.h"
#include "tests/zscanner/zscanner_tests.h"
#include "tests/libknot/wire_tests.h"
#include "tests/libknot/dname_tests.h"
#include "tests/libknot/ztree_tests.h"
......@@ -69,9 +68,6 @@ int main(int argc, char *argv[])
&server_tests_api, //! Server unit
&rrl_tests_api, //! RRL tests
/* Zone scanner. */
&zscanner_tests_api, //! Wrapper for external unittests
/* Libknot library. */
&wire_tests_api,
&dname_tests_api,
......
/* Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include "tests/zscanner/zscanner_tests.h"
#include <stdlib.h>
static int zscanner_tests_count(int argc, char *argv[]);
static int zscanner_tests_run(int argc, char *argv[]);
unit_api zscanner_tests_api = {
"Zone scanner",
&zscanner_tests_count,
&zscanner_tests_run
};
static int zscanner_tests_count(int argc, char *argv[])
{
return 1;
}
static int zscanner_tests_run(int argc, char *argv[])
{
int ret;
ret = system("/bin/sh ../zscanner/test/run_tests.sh test");
cmp_ok(ret, "==", 0, "zscanner unittests");
return 0;
}
/* Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ZSCANNER_TESTS_H_
#define _ZSCANNER_TESTS_H_
#include "common/libtap/tap_unit.h"
/* Unit API. */
unit_api zscanner_tests_api;
#endif /* _ZSCANNER_TESTS_H_ */
ACLOCAL_AMFLAGS = -I $(top_srcdir)/m4
AM_CPPFLAGS = -I$(top_srcdir)/src/zscanner -I$(top_srcdir)/src -DSYSCONFDIR='"$(sysconfdir)"' -DSBINDIR='"$(sbindir)"'
noinst_PROGRAMS = zscanner-tool
noinst_LTLIBRARIES = libzscanner.la
TESTS = test/run_tests.sh
EXTRA_DIST = \
scanner.rl \
scanner_body.rl \
......@@ -25,8 +29,6 @@ zscanner_tool_SOURCES = \
test/processing.c
libzscanner_la_SOURCES = \
../common/descriptor.h \
../common/descriptor.c \
error.h \
error.c \
file_loader.h \
......@@ -34,7 +36,9 @@ libzscanner_la_SOURCES = \
scanner.h \
scanner.c \
scanner_functions.h \
scanner_functions.c
scanner_functions.c \
../common/descriptor.h \
../common/descriptor.c
libzscanner_la_LIBADD = @LIBOBJS@
zscanner_tool_LDADD = libzscanner.la @LIBOBJS@
......@@ -15,9 +15,10 @@
*/
#include <config.h>
#include "zscanner/error.h"
#include <stdlib.h> // NULL
#include "zscanner/error.h"
typedef struct {
int code;
const char *name;
......
......@@ -15,8 +15,6 @@
*/
#include <config.h>
#include "zscanner/file_loader.h"
#include <inttypes.h> // PRIu64
#include <unistd.h> // sysconf
#include <stdio.h> // sprintf
......@@ -27,6 +25,7 @@
#include <sys/stat.h> // fstat
#include <sys/mman.h> // mmap
#include "zscanner/file_loader.h"
#include "zscanner/error.h" // error codes
/*! \brief Mmap block size in bytes. */
......
......@@ -29,8 +29,8 @@
#include <stdint.h> // uint32_t
#include "common/descriptor.h" // KNOT_CLASS_IN
#include "zscanner/scanner.h" // scanner_t
#include "common/descriptor.h" // KNOT_CLASS_IN
/*! \brief Settings block size in bytes. */
#define SETTINGS_BUFFER_LENGTH 1024
......
......@@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "zscanner/scanner.h"
#include <config.h>
#include <stdint.h> // uint32_t
#include <stdlib.h> // calloc
#include <stdio.h> // sprintf
......@@ -30,10 +29,11 @@
#include <netinet/in.h> // in_addr (BSD)
#include <arpa/inet.h> // inet_pton
#include "zscanner/scanner.h"
#include "zscanner/error.h" // error codes
#include "common/descriptor.h" // KNOT_RRTYPE_A
#include "zscanner/file_loader.h" // file_loader
#include "zscanner/scanner_functions.h" // Base64
#include "common/descriptor.h" // KNOT_RRTYPE_A
/*! \brief Shorthand for setting warning data. */
#define SCANNER_WARNING(code) { s->error_code = code; }
......
......@@ -14,8 +14,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "zscanner/scanner.h"
#include <config.h>
#include <stdint.h> // uint32_t
#include <stdlib.h> // calloc
#include <stdio.h> // sprintf
......@@ -28,10 +27,11 @@
#include <netinet/in.h> // in_addr (BSD)
#include <arpa/inet.h> // inet_pton
#include "zscanner/scanner.h"
#include "zscanner/error.h" // error codes
#include "common/descriptor.h" // KNOT_RRTYPE_A
#include "zscanner/file_loader.h" // file_loader
#include "zscanner/scanner_functions.h" // Base64
#include "common/descriptor.h" // KNOT_RRTYPE_A
/*! \brief Shorthand for setting warning data. */
#define SCANNER_WARNING(code) { s->error_code = code; }
......
......@@ -15,14 +15,13 @@
*/
#include <config.h>
#include "zscanner/scanner_functions.h"
#include <stdint.h>
#include <stdlib.h>
#include "zscanner/error.h"
#include "common/descriptor.h"
#include "zscanner/scanner.h"
#include "zscanner/scanner_functions.h"
#include "zscanner/error.h" // error codes
#include "zscanner/scanner.h" // scanner_t
#include "common/descriptor.h" // KNOT_RDATA_WF_END
const uint8_t digit_to_num[] = {
['0'] = 0, ['1'] = 1, ['2'] = 2, ['3'] = 3, ['4'] = 4,
......
......@@ -15,14 +15,13 @@
*/
#include <config.h>
#include "zscanner/scanner_functions.h"
#include <inttypes.h> // PRIu64
#include <stdio.h> // printf
#include "zscanner/error.h" // knot_strerror
#include "common/descriptor.h" // knot_rrtype_to_string
#include "zscanner/test/processing.h"
#include "zscanner/error.h" // zscanner_strerror
#include "zscanner/scanner.h" // scanner_t
#include "common/descriptor.h" // knot_rrtype_to_string
#define ERROR_CODE_TO_STRING(code) [code - ZSCANNER_UNCOVERED_STATE] = #code
const char *error_names[] = {
......
......@@ -2,13 +2,13 @@
TESTS_DIR="@abs_srcdir@/cases"
OUTS_DIR="@abs_builddir@/.out"
TEST_BIN="@builddir@/../zscanner-tool -m 2"
TEST_BIN="@builddir@/zscanner-tool -m 2"
# Delete temporary output directory at exit.
trap "chmod -R u+rw ${OUTS_DIR} && rm -rf ${OUTS_DIR}" EXIT
# If an argument -> verbose mode (stores result in /tmp).
if [ $# -eq 0 ]; then
if [ $# -ne 0 ]; then
RESULT_DIR=`mktemp -d /tmp/zscanner_test.XXXX`
echo "ZSCANNER TEST ${RESULT_DIR}"
fi
......@@ -31,7 +31,7 @@ for file in $(find "${TESTS_DIR}" -name "*.in" | sort -n); do
# Check for differences.
if [ $RET -ne 0 ]; then
# If verbose print diff.
if [ $# -eq 0 ]; then
if [ $# -ne 0 ]; then
echo "\n=== ${fileout} DIFF ======================"
diff "${OUTS_DIR}/${fileout}" "${TESTS_DIR}/${fileout}"
fi
......@@ -39,7 +39,7 @@ for file in $(find "${TESTS_DIR}" -name "*.in" | sort -n); do
done
# Store test result.
if [ $# -eq 0 ]; then
if [ $# -ne 0 ]; then
cp -a "${OUTS_DIR}/." "${RESULT_DIR}/"
echo "\nFINISHED ${RESULT_DIR}"
fi
......@@ -15,13 +15,13 @@
*/
#include <config.h>
#include "zscanner/test/tests.h"
#include <inttypes.h> // PRIu64
#include <stdlib.h> // putenv
#include <stdio.h> // printf
#include <time.h> // mktime
#include <stdlib.h> // printf
#include "../scanner_functions.h" // date_to_timestamp
#include "zscanner/test/tests.h"
#include "zscanner/scanner_functions.h" // date_to_timestamp
int test__date_to_timestamp()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment