mirror of https://github.com/getdnsapi/getdns.git
Merge branch 'bugfix/localhost-on-freebsd-jails' into release/1.4.0
This commit is contained in:
commit
5f2add4c09
|
@ -83,7 +83,7 @@ void handler(getdns_context *context, getdns_callback_type_t callback_type,
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int main()
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
getdns_context *context = NULL;
|
||||
getdns_list *listeners = NULL;
|
||||
|
@ -92,9 +92,20 @@ int main()
|
|||
uint32_t port1 = 18000;
|
||||
uint32_t port2 = 18000;
|
||||
getdns_return_t r;
|
||||
char listenliststr[1024];
|
||||
char listendictstr[1024];
|
||||
|
||||
if ((r = getdns_str2list("[ 127.0.0.1:18000 ]", &listeners)) ||
|
||||
(r = getdns_str2dict("127.0.0.1:18000", &address2)) ||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "usage: %s <localhost ipv4>\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
(void) snprintf(listenliststr, sizeof(listenliststr),
|
||||
"[ %s:18000 ]", argv[1]);
|
||||
(void) snprintf(listendictstr, sizeof(listendictstr),
|
||||
"%s:18000", argv[1]);
|
||||
|
||||
if ((r = getdns_str2list(listenliststr, &listeners)) ||
|
||||
(r = getdns_str2dict(listendictstr, &address2)) ||
|
||||
(r = getdns_list_get_dict(listeners, 0, &address)) ||
|
||||
(r = getdns_context_create(&context, 0)))
|
||||
fprintf(stderr, "Error initializing: ");
|
||||
|
|
|
@ -4,18 +4,22 @@
|
|||
# use .tpkg.var.test for in test variable passing
|
||||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||
|
||||
LOCALHOST=`${GETDNS_STUB_QUERY} '{namespaces:[GETDNS_NAMESPACE_LOCALNAMES]}' -A localhost. -J \
|
||||
| awk -F: '/\"address_data\".*\"127/{print $2}' \
|
||||
| sed -e 's/^[^"]*"//g' -e 's/"[^"]*$//g'`
|
||||
echo "localhost: $LOCALHOST"
|
||||
|
||||
make && "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "./${TPKG_NAME}" | (
|
||||
make && "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "./${TPKG_NAME}" ${LOCALHOST} | (
|
||||
read PORT
|
||||
read PORT2
|
||||
|
||||
${GETDNS_STUB_QUERY} -s -t 1000 @127.0.0.1:$PORT TXT cancel. +return_call_reporting 2>&1 > time_out
|
||||
${GETDNS_STUB_QUERY} -s -t 1000 @${LOCALHOST}:$PORT TXT cancel. +return_call_reporting 2>&1 > time_out
|
||||
|
||||
${GETDNS_STUB_QUERY} -s @127.0.0.1:$PORT TXT test +return_call_reporting 2>&1 > tcp_out
|
||||
${GETDNS_STUB_QUERY} -s @${LOCALHOST}:$PORT TXT test +return_call_reporting 2>&1 > tcp_out
|
||||
|
||||
${GETDNS_STUB_QUERY} -s -U @127.0.0.1:$PORT2 TXT test +return_call_reporting 2>&1 > udp_out
|
||||
${GETDNS_STUB_QUERY} -s -U @${LOCALHOST}:$PORT2 TXT test +return_call_reporting 2>&1 > udp_out
|
||||
|
||||
${GETDNS_STUB_QUERY} -s -q @127.0.0.1:$PORT TXT quit.
|
||||
${GETDNS_STUB_QUERY} -s -q @${LOCALHOST}:$PORT TXT quit.
|
||||
)
|
||||
if grep -q 'definitely lost: [^0]' valgrind.log
|
||||
then
|
||||
|
|
|
@ -107,15 +107,23 @@ void handler(getdns_context *context, getdns_callback_type_t callback_type,
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int main()
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
getdns_context *context = NULL;
|
||||
getdns_list *listeners = NULL;
|
||||
getdns_dict *address = NULL;
|
||||
uint32_t port = 18000;
|
||||
getdns_return_t r;
|
||||
char listenliststr[1024];
|
||||
|
||||
if ((r = getdns_str2list("[ 127.0.0.1:18000 ]", &listeners)) ||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "usage: %s <localhost ipv4>\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
(void) snprintf(listenliststr, sizeof(listenliststr),
|
||||
"[ %s:18000 ]", argv[1]);
|
||||
|
||||
if ((r = getdns_str2list(listenliststr, &listeners)) ||
|
||||
(r = getdns_list_get_dict(listeners, 0, &address)) ||
|
||||
(r = getdns_context_create(&context, 0)))
|
||||
fprintf(stderr, "Error initializing: ");
|
||||
|
|
|
@ -5,21 +5,27 @@
|
|||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||
|
||||
|
||||
LOCALHOST=`${GETDNS_STUB_QUERY} '{namespaces:[GETDNS_NAMESPACE_LOCALNAMES]}' -A localhost. -J \
|
||||
| awk -F: '/\"address_data\".*\"127/{print $2}' \
|
||||
| sed -e 's/^[^"]*"//g' -e 's/"[^"]*$//g'`
|
||||
echo "localhost: $LOCALHOST"
|
||||
|
||||
QLIMIT=64
|
||||
NQUERIES=`wc "./${TPKG_NAME}.queries"|sed 's/ .*$//g'`
|
||||
NQUERIES=`wc "./${TPKG_NAME}.queries"|sed -e 's/^ *//g' -e 's/ .*$//g'`
|
||||
echo "# queries: $NQUERIES"
|
||||
|
||||
# Test will take NQUERIES / QLIMIT * answer delay
|
||||
# For current parameters this is 1000 / 64 * 0.3 = 4.6875
|
||||
# which is smaller than 5 seconds default query timeout value,
|
||||
# so the test should succeed.
|
||||
|
||||
make && "./${TPKG_NAME}" | (
|
||||
make && "./${TPKG_NAME}" ${LOCALHOST} | (
|
||||
read PORT
|
||||
${GETDNS_STUB_QUERY} @127.0.0.1:$PORT TXT \
|
||||
${GETDNS_STUB_QUERY} @${LOCALHOST}:$PORT TXT \
|
||||
-a -F "./${TPKG_NAME}.queries" \
|
||||
"{limit_outstanding_queries:$QLIMIT}" 2>&1 > out
|
||||
|
||||
${GETDNS_STUB_QUERY} -q @127.0.0.1:$PORT TXT quit.
|
||||
${GETDNS_STUB_QUERY} -q @${LOCALHOST}:$PORT TXT quit.
|
||||
) && grep '"n_requests: [0-9][0-9]*"' out | sed -e 's/^.*n_requests: //g' -e 's/".*$//g' \
|
||||
| awk -vQLIMIT=$QLIMIT -vNQUERIES=$NQUERIES '
|
||||
|
||||
|
|
|
@ -112,15 +112,23 @@ void handler(getdns_context *context, getdns_callback_type_t callback_type,
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int main()
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
getdns_context *context = NULL;
|
||||
getdns_list *listeners = NULL;
|
||||
getdns_dict *address = NULL;
|
||||
uint32_t port = 18000;
|
||||
getdns_return_t r;
|
||||
char listenliststr[1024];
|
||||
|
||||
if ((r = getdns_str2list("[ 127.0.0.1:18000 ]", &listeners)) ||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "usage: %s <localhost ipv4>\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
(void) snprintf(listenliststr, sizeof(listenliststr),
|
||||
"[ %s:18000 ]", argv[1]);
|
||||
|
||||
if ((r = getdns_str2list(listenliststr, &listeners)) ||
|
||||
(r = getdns_list_get_dict(listeners, 0, &address)) ||
|
||||
(r = getdns_context_create(&context, 0)))
|
||||
fprintf(stderr, "Error initializing: ");
|
||||
|
|
|
@ -5,8 +5,14 @@
|
|||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||
|
||||
|
||||
LOCALHOST=`${GETDNS_STUB_QUERY} '{namespaces:[GETDNS_NAMESPACE_LOCALNAMES]}' -A localhost. -J \
|
||||
| awk -F: '/\"address_data\".*\"127/{print $2}' \
|
||||
| sed -e 's/^[^"]*"//g' -e 's/"[^"]*$//g'`
|
||||
echo "localhost: $LOCALHOST"
|
||||
|
||||
QLIMIT=79
|
||||
NQUERIES=`wc "./${TPKG_NAME}.queries"|sed 's/ .*$//g'`
|
||||
NQUERIES=`wc "./${TPKG_NAME}.queries"|sed -e 's/^ *//g' -e 's/ .*$//g'`
|
||||
echo "# queries: $NQUERIES"
|
||||
|
||||
# This time the query limit is set by setting the maximum open
|
||||
# filedescriptors. We seem to be needing a higher QLIMIT, than
|
||||
|
@ -21,13 +27,13 @@ NQUERIES=`wc "./${TPKG_NAME}.queries"|sed 's/ .*$//g'`
|
|||
# which is smaller than 5 seconds default query timeout value,
|
||||
# so the test should succeed.
|
||||
|
||||
make && "./${TPKG_NAME}" | (
|
||||
make && "./${TPKG_NAME}" ${LOCALHOST}| (
|
||||
read PORT
|
||||
ulimit -n $QLIMIT
|
||||
${GETDNS_STUB_QUERY} @127.0.0.1:$PORT TXT \
|
||||
${GETDNS_STUB_QUERY} @${LOCALHOST}:$PORT TXT \
|
||||
-a -F "./${TPKG_NAME}.queries" 2>&1 > out
|
||||
|
||||
${GETDNS_STUB_QUERY} -q @127.0.0.1:$PORT TXT quit.
|
||||
${GETDNS_STUB_QUERY} -q @${LOCALHOST}:$PORT TXT quit.
|
||||
) && grep '"n_requests: [0-9][0-9]*"' out | sed -e 's/^.*n_requests: //g' -e 's/".*$//g' \
|
||||
| awk -vQLIMIT=$QLIMIT -vNQUERIES=$NQUERIES '
|
||||
|
||||
|
|
Loading…
Reference in New Issue