Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
netblue30 committed Feb 8, 2020
1 parent d3a9680 commit 4fb525f
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 614 deletions.
5 changes: 4 additions & 1 deletion test/fdns/server-anycast.exp
Expand Up @@ -10,13 +10,16 @@ match_max 100000
send -- "pkill fdns\r"
sleep 1

send -- "fdns --server=non-profit\r"
send -- "fdns --server=anycast\r"
expect {
timeout {puts "TESTING ERROR 4\n";exit}
"connecting to adguard server" {puts "1"}
"connecting to adguard2 server" {puts "1"}
"connecting to cleanbrowsing server" {puts "2"}
"connecting to cloudflare server" {puts "3"}
"connecting to cloudflare2 server" {puts "3"}
"connecting to quad9 server" {puts "4"}
"connecting to quad92 server" {puts "4"}
}

after 100
Expand Down
2 changes: 1 addition & 1 deletion test/fdns/test-user.sh
Expand Up @@ -38,7 +38,7 @@ echo "TESTING: test-url (test/fdns/test-url.exp)"
./test-url.exp

echo "TESTING: test-servers=anycast (test/fdns/test-servers-anycast.exp)"
./test-servesrs-anycast.exp
./test-servers-anycast.exp

echo "TESTING: monitor (test/fdns/monitor.exp)"
./monitor.exp
Expand Down
2 changes: 1 addition & 1 deletion test/fdns/test.sh
Expand Up @@ -45,7 +45,7 @@ echo "TESTING: nofilter (test/fdns/nofilter.exp)"
echo "TESTING: server=non-profit (test/fdns/server-non-profit.exp)"
./server-non-profit.exp

echo "TESTING: server=anycast (test/fdns/server-non-profit.exp)"
echo "TESTING: server=anycast (test/fdns/server-anycast.exp)"
./server-anycast.exp

echo "TESTING: restart worker (test/fdns/restart-worker.exp)"
Expand Down
26 changes: 26 additions & 0 deletions test/src/fdnstress/main.c
Expand Up @@ -153,6 +153,31 @@ static DListEntry *rq_send(DListEntry *ptr) {
}
else {
puts(gai_strerror(rv));
printf("retrying\n");
// sleep and try again
sleep(2);

printf("%s: ", reqs[i]->ar_name);
rv = gai_error(reqs[i]);
rv = getaddrinfo_a(GAI_WAIT, reqs + i, 1, NULL);
if (rv)
errExit("getaddrinfo_a");
if (rv == 0) {
res = reqs[i]->ar_result;
rv = getnameinfo(res->ai_addr, res->ai_addrlen,
host, sizeof(host),
NULL, 0, NI_NUMERICHOST);
if (rv != 0) {
fprintf(stderr, "getnameinfo() failed: %s\n",
gai_strerror(rv));
exit(EXIT_FAILURE);
}
puts(host);

}
else
puts(gai_strerror(rv));

}
}

Expand All @@ -164,6 +189,7 @@ static void rq_engine(void) {

DListEntry *ptr = dlist;
while (ptr) {
usleep(250000);
ptr = rq_send(ptr);
}
}
Expand Down
20 changes: 20 additions & 0 deletions test/stress/list20
@@ -0,0 +1,20 @@
wordpress.com
debian.org
gentoo.org
linux.org
linux.com
lxer.com
ubuntu.com
amazon.com
facebook.com
google.com
facebook.com
twitter.com
thepiratebay.org
linuxmint.com
duckduckgo.com
en.wikipedia.org
youtube.com
archlinux.org
distrowatch.com
fedoraproject.org

0 comments on commit 4fb525f

Please sign in to comment.