]> git.ipfire.org Git - thirdparty/pdns.git/blame - pdns/speedtest.cc
dnsdist: Add HTTPStatusAction to return a specific HTTP response
[thirdparty/pdns.git] / pdns / speedtest.cc
CommitLineData
870a0fe4 1#include "config.h"
8c0139b0 2#include <boost/format.hpp>
3#include <boost/container/string.hpp>
34383528
BH
4#include "dnsparser.hh"
5#include "sstuff.hh"
6#include "misc.hh"
7#include "dnswriter.hh"
8#include "dnsrecords.hh"
5a6caecd 9#include "iputils.hh"
6b0ea82d 10#include <fstream>
8c0139b0 11
34383528
BH
12#ifndef RECURSOR
13#include "statbag.hh"
88227be0 14#include "base64.hh"
34383528
BH
15StatBag S;
16#endif
8c0139b0 17
b00cab1d 18volatile bool g_ret; // make sure the optimizer does not get too smart
34383528 19uint64_t g_totalRuns;
34383528
BH
20volatile bool g_stop;
21
22void alarmHandler(int)
23{
24 g_stop=true;
25}
26
27template<typename C> void doRun(const C& cmd, int mseconds=100)
28{
29 struct itimerval it;
30 it.it_value.tv_sec=mseconds/1000;
31 it.it_value.tv_usec = 1000* (mseconds%1000);
32 it.it_interval.tv_sec=0;
33 it.it_interval.tv_usec=0;
34
ecefa116 35 signal(SIGVTALRM, alarmHandler);
34383528 36 setitimer(ITIMER_VIRTUAL, &it, 0);
ecefa116 37
34383528
BH
38 unsigned int runs=0;
39 g_stop=false;
ab570fc5 40 CPUTime dt;
41 dt.start();
34383528
BH
42 while(runs++, !g_stop) {
43 cmd();
44 }
ab570fc5 45 double delta=dt.ndiff()/1000000000.0;
34383528
BH
46 boost::format fmt("'%s' %.02f seconds: %.1f runs/s, %.02f usec/run");
47
48 cerr<< (fmt % cmd.getName() % delta % (runs/delta) % (delta* 1000000.0/runs)) << endl;
49 g_totalRuns += runs;
50}
51
52struct ARecordTest
53{
54 explicit ARecordTest(int records) : d_records(records) {}
55
56 string getName() const
57 {
58 return (boost::format("%d a records") % d_records).str();
59 }
60
61 void operator()() const
62 {
63 vector<uint8_t> packet;
e325f20c 64 DNSPacketWriter pw(packet, DNSName("outpost.ds9a.nl"), QType::A);
34383528 65 for(int records = 0; records < d_records; records++) {
e325f20c 66 pw.startRecord(DNSName("outpost.ds9a.nl"), QType::A);
34383528
BH
67 ARecordContent arc("1.2.3.4");
68 arc.toPacket(pw);
69 }
70 pw.commit();
71 }
72 int d_records;
73};
74
75
76struct MakeStringFromCharStarTest
77{
78 MakeStringFromCharStarTest() : d_size(0){}
79 string getName() const
80 {
81 return (boost::format("make a std::string")).str();
82 }
83
84 void operator()() const
85 {
86 string name("outpost.ds9a.nl");
87 d_size += name.length();
88
89 }
90 mutable int d_size;
91};
92
7519bae5
BH
93
94struct GetTimeTest
95{
96 string getName() const
97 {
98 return "gettimeofday-test";
99 }
100
101 void operator()() const
102 {
103 struct timeval tv;
104 gettimeofday(&tv, 0);
105 }
106};
107
1f9faf8b
BH
108pthread_mutex_t s_testlock=PTHREAD_MUTEX_INITIALIZER;
109
110struct GetLockUncontendedTest
111{
112 string getName() const
113 {
114 return "getlock-uncontended-test";
115 }
116
117 void operator()() const
118 {
119 pthread_mutex_lock(&s_testlock);
120 pthread_mutex_unlock(&s_testlock);
121 }
122};
123
124
125struct StaticMemberTest
126{
127 string getName() const
128 {
129 return "static-member-test";
130 }
131
132 void operator()() const
133 {
134 static string* s_ptr;
135 if(!s_ptr)
136 s_ptr = new string();
137 }
138};
139
ab570fc5 140struct StringtokTest
141{
142 string getName() const
143 {
144 return "stringtok";
145 }
146
147 void operator()() const
148 {
149 string str("the quick brown fox jumped");
150 vector<string> parts;
151 stringtok(parts, str);
152 }
153};
154
155struct VStringtokTest
156{
157 string getName() const
158 {
159 return "vstringtok";
160 }
161
162 void operator()() const
163 {
164 string str("the quick brown fox jumped");
165 vector<pair<unsigned int, unsigned> > parts;
166 vstringtok(parts, str);
167 }
168};
169
179dad39 170struct StringAppendTest
171{
172 string getName() const
173 {
174 return "stringappend";
175 }
176
177 void operator()() const
178 {
179 string str;
180 static char i;
181 for(int n=0; n < 1000; ++n)
182 str.append(1, i);
183 i++;
184 }
185};
186
7519bae5 187
6b0ea82d 188struct BoostStringAppendTest
189{
190 string getName() const
191 {
192 return "booststringappend";
193 }
194
195 void operator()() const
196 {
197 boost::container::string str;
198 static char i;
199 for(int n=0; n < 1000; ++n)
200 str.append(1, i);
201 i++;
202 }
203};
204
205
206
34383528
BH
207struct MakeARecordTest
208{
209 string getName() const
210 {
211 return (boost::format("make a-record")).str();
212 }
213
214 void operator()() const
215 {
216 static string src("1.2.3.4");
217 ARecordContent arc(src);
218 //ARecordContent arc(0x01020304);
219
220 }
221};
222
6b0ea82d 223vector<uint8_t> makeBigReferral()
224{
225
226 vector<uint8_t> packet;
227 DNSPacketWriter pw(packet, DNSName("www.google.com"), QType::A);
228
229 string gtld="x.gtld-servers.net";
230 for(char c='a'; c<= 'm';++c) {
231 pw.startRecord(DNSName("com"), QType::NS, 3600, 1, DNSResourceRecord::AUTHORITY);
232 gtld[0]=c;
32122aab 233 auto drc = DNSRecordContent::mastermake(QType::NS, 1, gtld);
6b0ea82d 234 drc->toPacket(pw);
6b0ea82d 235 }
236
237 for(char c='a'; c<= 'k';++c) {
238 gtld[0]=c;
239 pw.startRecord(DNSName(gtld), QType::A, 3600, 1, DNSResourceRecord::ADDITIONAL);
32122aab 240 auto drc = DNSRecordContent::mastermake(QType::A, 1, "1.2.3.4");
6b0ea82d 241 drc->toPacket(pw);
6b0ea82d 242 }
243
244
245 pw.startRecord(DNSName("a.gtld-servers.net"), QType::AAAA, 3600, 1, DNSResourceRecord::ADDITIONAL);
32122aab 246 auto aaaarc = DNSRecordContent::mastermake(QType::AAAA, 1, "2001:503:a83e::2:30");
6b0ea82d 247 aaaarc->toPacket(pw);
6b0ea82d 248
249 pw.startRecord(DNSName("b.gtld-servers.net"), QType::AAAA, 3600, 1, DNSResourceRecord::ADDITIONAL);
32122aab 250 aaaarc = DNSRecordContent::mastermake(QType::AAAA, 1, "2001:503:231d::2:30");
6b0ea82d 251 aaaarc->toPacket(pw);
6b0ea82d 252
253
254 pw.commit();
255 return packet;
256}
257
258vector<uint8_t> makeBigDNSPacketReferral()
259{
260 vector<DNSResourceRecord> records;
261 DNSResourceRecord rr;
262 rr.qtype = QType::NS;
263 rr.ttl=3600;
264 rr.qname=DNSName("com");
6b0ea82d 265
266 string gtld="x.gtld-servers.net";
267 for(char c='a'; c<= 'm';++c) {
268 gtld[0]=c;
269 rr.content = gtld;
270 records.push_back(rr);
271 }
272
273 rr.qtype = QType::A;
274 for(char c='a'; c<= 'k';++c) {
275 gtld[0]=c;
276 rr.qname=DNSName(gtld);
277 rr.content="1.2.3.4";
278 records.push_back(rr);
279 }
280
281 rr.qname=DNSName("a.gtld-servers.net");
282 rr.qtype=QType::AAAA;
283 rr.content="2001:503:a83e::2:30";
284 records.push_back(rr);
285
286 rr.qname=DNSName("b.gtld-servers.net");
287 rr.qtype=QType::AAAA;
288 rr.content="2001:503:231d::2:30";
289 records.push_back(rr);
290
291
292 vector<uint8_t> packet;
293 DNSPacketWriter pw(packet, DNSName("www.google.com"), QType::A);
d190894c 294 // shuffle(records);
6b0ea82d 295 for(const auto& rec : records) {
8695de46 296 pw.startRecord(rec.qname, rec.qtype.getCode(), rec.ttl, 1, DNSResourceRecord::ADDITIONAL);
32122aab 297 auto drc = DNSRecordContent::mastermake(rec.qtype.getCode(), 1, rec.content);
6b0ea82d 298 drc->toPacket(pw);
6b0ea82d 299 }
300
301 pw.commit();
302 return packet;
303}
304
305
306
34383528
BH
307struct MakeARecordTestMM
308{
309 string getName() const
310 {
311 return (boost::format("make a-record (mm)")).str();
312 }
313
314 void operator()() const
315 {
32122aab 316 auto drc = DNSRecordContent::mastermake(QType::A, 1,
6177a176 317 "1.2.3.4");
34383528
BH
318 }
319};
320
321
322struct A2RecordTest
323{
324 explicit A2RecordTest(int records) : d_records(records) {}
325
326 string getName() const
327 {
328 return (boost::format("%d a records") % d_records).str();
329 }
330
331 void operator()() const
332 {
333 vector<uint8_t> packet;
e325f20c 334 DNSPacketWriter pw(packet, DNSName("outpost.ds9a.nl"), QType::A);
34383528 335 ARecordContent arc("1.2.3.4");
e325f20c 336 DNSName name("outpost.ds9a.nl");
34383528
BH
337 for(int records = 0; records < d_records; records++) {
338 pw.startRecord(name, QType::A);
339
340 arc.toPacket(pw);
341 }
342 pw.commit();
343 }
344 int d_records;
345};
346
347
348struct TXTRecordTest
349{
350 explicit TXTRecordTest(int records) : d_records(records) {}
351
352 string getName() const
353 {
354 return (boost::format("%d TXT records") % d_records).str();
355 }
356
357 void operator()() const
358 {
359 vector<uint8_t> packet;
e325f20c 360 DNSPacketWriter pw(packet, DNSName("outpost.ds9a.nl"), QType::TXT);
34383528 361 for(int records = 0; records < d_records; records++) {
e325f20c 362 pw.startRecord(DNSName("outpost.ds9a.nl"), QType::TXT);
34383528
BH
363 TXTRecordContent arc("\"een leuk verhaaltje in een TXT\"");
364 arc.toPacket(pw);
365 }
366 pw.commit();
367 }
368 int d_records;
369};
370
371
372struct GenericRecordTest
373{
374 explicit GenericRecordTest(int records, uint16_t type, const std::string& content)
375 : d_records(records), d_type(type), d_content(content) {}
376
377 string getName() const
378 {
379 return (boost::format("%d %s records") % d_records %
b7821a82 380 DNSRecordContent::NumberToType(d_type)).str();
34383528
BH
381 }
382
383 void operator()() const
384 {
385 vector<uint8_t> packet;
e325f20c 386 DNSPacketWriter pw(packet, DNSName("outpost.ds9a.nl"), d_type);
34383528 387 for(int records = 0; records < d_records; records++) {
e325f20c 388 pw.startRecord(DNSName("outpost.ds9a.nl"), d_type);
32122aab 389 auto drc = DNSRecordContent::mastermake(d_type, 1,
6177a176 390 d_content);
34383528 391 drc->toPacket(pw);
34383528
BH
392 }
393 pw.commit();
394 }
395 int d_records;
396 uint16_t d_type;
397 string d_content;
398};
399
400
401struct AAAARecordTest
402{
403 explicit AAAARecordTest(int records) : d_records(records) {}
404
405 string getName() const
406 {
407 return (boost::format("%d aaaa records (mm)") % d_records).str();
408 }
409
410 void operator()() const
411 {
412 vector<uint8_t> packet;
e325f20c 413 DNSPacketWriter pw(packet, DNSName("outpost.ds9a.nl"), QType::AAAA);
34383528 414 for(int records = 0; records < d_records; records++) {
e325f20c 415 pw.startRecord(DNSName("outpost.ds9a.nl"), QType::AAAA);
32122aab 416 auto drc = DNSRecordContent::mastermake(QType::AAAA, 1, "fe80::21d:92ff:fe6d:8441");
34383528 417 drc->toPacket(pw);
34383528
BH
418 }
419 pw.commit();
420 }
421 int d_records;
422};
423
424struct SOARecordTest
425{
426 explicit SOARecordTest(int records) : d_records(records) {}
427
428 string getName() const
429 {
430 return (boost::format("%d soa records (mm)") % d_records).str();
431 }
432
433 void operator()() const
434 {
435 vector<uint8_t> packet;
e325f20c 436 DNSPacketWriter pw(packet, DNSName("outpost.ds9a.nl"), QType::SOA);
34383528
BH
437
438 for(int records = 0; records < d_records; records++) {
e325f20c 439 pw.startRecord(DNSName("outpost.ds9a.nl"), QType::SOA);
32122aab 440 auto drc = DNSRecordContent::mastermake(QType::SOA, 1, "a0.org.afilias-nst.info. noc.afilias-nst.info. 2008758137 1800 900 604800 86400");
34383528 441 drc->toPacket(pw);
34383528
BH
442 }
443 pw.commit();
444 }
445 int d_records;
446};
447
448vector<uint8_t> makeEmptyQuery()
449{
450 vector<uint8_t> packet;
e325f20c 451 DNSPacketWriter pw(packet, DNSName("outpost.ds9a.nl"), QType::SOA);
34383528
BH
452 return packet;
453}
454
34383528
BH
455vector<uint8_t> makeTypicalReferral()
456{
457 vector<uint8_t> packet;
e325f20c 458 DNSPacketWriter pw(packet, DNSName("outpost.ds9a.nl"), QType::A);
34383528 459
e693ff5a 460 pw.startRecord(DNSName("ds9a.nl"), QType::NS, 3600, 1, DNSResourceRecord::AUTHORITY);
32122aab 461 auto drc = DNSRecordContent::mastermake(QType::NS, 1, "ns1.ds9a.nl");
34383528 462 drc->toPacket(pw);
34383528 463
e693ff5a 464 pw.startRecord(DNSName("ds9a.nl"), QType::NS, 3600, 1, DNSResourceRecord::AUTHORITY);
32122aab 465 drc = DNSRecordContent::mastermake(QType::NS, 1, "ns2.ds9a.nl");
34383528 466 drc->toPacket(pw);
34383528
BH
467
468
e693ff5a 469 pw.startRecord(DNSName("ns1.ds9a.nl"), QType::A, 3600, 1, DNSResourceRecord::ADDITIONAL);
32122aab 470 drc = DNSRecordContent::mastermake(QType::A, 1, "1.2.3.4");
34383528 471 drc->toPacket(pw);
34383528 472
e693ff5a 473 pw.startRecord(DNSName("ns2.ds9a.nl"), QType::A, 3600, 1, DNSResourceRecord::ADDITIONAL);
32122aab 474 drc = DNSRecordContent::mastermake(QType::A, 1, "4.3.2.1");
34383528 475 drc->toPacket(pw);
34383528
BH
476
477 pw.commit();
478 return packet;
479}
480
b7821a82
BH
481struct StackMallocTest
482{
483 string getName() const
484 {
485 return "stack allocation";
486 }
487
488 void operator()() const
489 {
490 char *buffer= new char[200000];
4da9585d 491 delete[] buffer;
b7821a82
BH
492 }
493
494};
495
496
34383528
BH
497struct EmptyQueryTest
498{
499 string getName() const
500 {
501 return "write empty query";
502 }
503
504 void operator()() const
505 {
506 vector<uint8_t> packet=makeEmptyQuery();
507 }
508
509};
510
511struct TypicalRefTest
512{
513 string getName() const
514 {
515 return "write typical referral";
516 }
517
518 void operator()() const
519 {
520 vector<uint8_t> packet=makeTypicalReferral();
521 }
522
523};
524
6b0ea82d 525struct BigRefTest
526{
527 string getName() const
528 {
529 return "write big referral";
530 }
531
532 void operator()() const
533 {
534 vector<uint8_t> packet=makeBigReferral();
535 }
536
537};
538
539struct BigDNSPacketRefTest
540{
541 string getName() const
542 {
543 return "write big dnspacket referral";
544 }
545
546 void operator()() const
547 {
548 vector<uint8_t> packet=makeBigDNSPacketReferral();
549 }
550
551};
552
553
b7821a82
BH
554struct TCacheComp
555{
0c0fd241 556 bool operator()(const pair<DNSName, QType>& a, const pair<DNSName, QType>& b) const
b7821a82 557 {
0c0fd241 558 if(a.first < b.first)
b7821a82 559 return true;
0c0fd241 560 if(b.first < a.first)
b7821a82
BH
561 return false;
562
563 return a.second < b.second;
564 }
565};
566
567struct NegCacheEntry
568{
8171ab83 569 DNSName d_name;
b7821a82 570 QType d_qtype;
8171ab83 571 DNSName d_qname;
b7821a82
BH
572 uint32_t d_ttd;
573};
574
575struct timeval d_now;
576
b7821a82 577
34383528
BH
578
579struct ParsePacketTest
580{
581 explicit ParsePacketTest(const vector<uint8_t>& packet, const std::string& name)
582 : d_packet(packet), d_name(name)
583 {}
584
585 string getName() const
586 {
587 return "parse '"+d_name+"'";
588 }
589
590 void operator()() const
591 {
27c0050c 592 MOADNSParser mdp(false, (const char*)&*d_packet.begin(), d_packet.size());
e8b23f3b 593 typedef map<pair<DNSName, QType>, set<DNSResourceRecord>, TCacheComp > tcache_t;
b7821a82
BH
594 tcache_t tcache;
595
596 struct {
597 vector<DNSResourceRecord> d_result;
598 bool d_aabit;
599 int d_rcode;
600 } lwr;
601 DNSResourceRecord rr;
602 for(MOADNSParser::answers_t::const_iterator i=mdp.d_answers.begin(); i!=mdp.d_answers.end(); ++i) {
603 DNSResourceRecord rr;
604 rr.qtype=i->first.d_type;
e325f20c 605 rr.qname=i->first.d_name;
b7821a82
BH
606
607 rr.ttl=i->first.d_ttl;
608 rr.content=i->first.d_content->getZoneRepresentation(); // this should be the serialised form
b7821a82
BH
609 lwr.d_result.push_back(rr);
610 }
611
8b77d409 612
34383528
BH
613 }
614 const vector<uint8_t>& d_packet;
615 std::string d_name;
616};
617
b7821a82
BH
618struct ParsePacketBareTest
619{
620 explicit ParsePacketBareTest(const vector<uint8_t>& packet, const std::string& name)
621 : d_packet(packet), d_name(name)
622 {}
623
624 string getName() const
625 {
626 return "parse '"+d_name+"' bare";
627 }
628
629 void operator()() const
630 {
27c0050c 631 MOADNSParser mdp(false, (const char*)&*d_packet.begin(), d_packet.size());
b7821a82
BH
632 }
633 const vector<uint8_t>& d_packet;
634 std::string d_name;
635};
636
637
34383528
BH
638struct SimpleCompressTest
639{
640 explicit SimpleCompressTest(const std::string& name)
641 : d_name(name)
642 {}
643
644 string getName() const
645 {
646 return "compress '"+d_name+"'";
647 }
648
649 void operator()() const
650 {
651 simpleCompress(d_name);
652 }
653 std::string d_name;
654};
655
656struct VectorExpandTest
657{
658 string getName() const
659 {
660 return "vector expand";
661 }
662
663 void operator()() const
664 {
665 vector<uint8_t> d_record;
666 d_record.resize(12);
667
668 string out="\x03www\x04ds9a\x02nl";
669 string::size_type len = d_record.size();
670 d_record.resize(len + out.length());
671 memcpy(&d_record[len], out.c_str(), out.length());
672 }
673
674};
675
b8a514bb 676struct DNSNameParseTest
677{
678 string getName() const
679 {
680 return "DNSName parse";
681 }
682
683 void operator()() const
684 {
685 DNSName name("www.powerdns.com");
686 }
687
688};
689
690struct DNSNameRootTest
691{
692 string getName() const
693 {
694 return "DNSName root";
695 }
696
697 void operator()() const
698 {
699 DNSName name(".");
700 }
701
702};
703
b7821a82
BH
704
705
706struct IEqualsTest
707{
708 string getName() const
709 {
710 return "iequals test";
711 }
712
713 void operator()() const
714 {
715 static string a("www.ds9a.nl"), b("www.lwn.net");
b00cab1d 716 g_ret = boost::iequals(a, b);
b7821a82
BH
717 }
718
719};
720
721struct MyIEqualsTest
722{
723 string getName() const
724 {
725 return "pdns_iequals test";
726 }
727
728 void operator()() const
729 {
730 static string a("www.ds9a.nl"), b("www.lwn.net");
b00cab1d 731 g_ret = pdns_iequals(a, b);
b7821a82
BH
732 }
733
734};
735
736
737struct StrcasecmpTest
738{
739 string getName() const
740 {
741 return "strcasecmp test";
742 }
743
744 void operator()() const
745 {
746 static string a("www.ds9a.nl"), b("www.lwn.net");
b00cab1d 747 g_ret = strcasecmp(a.c_str(), b.c_str());
b7821a82
BH
748 }
749};
750
751
88227be0
KM
752struct Base64EncodeTest
753{
754 string getName() const
755 {
756 return "Bas64Encode test";
757 }
758
759 void operator()() const
760 {
761 static string a("dq4KydZjmcoQQ45VYBP2EDR8FqKaMul0eSHBt7Xx5F7A4HFtabXEzDLD01bnSiGK");
762 Base64Encode(a);
763 }
764};
765
766
767struct B64DecodeTest
768{
769 string getName() const
770 {
771 return "B64Decode test";
772 }
773
774 void operator()() const
775 {
776 static string a("ZHE0S3lkWmptY29RUTQ1VllCUDJFRFI4RnFLYU11bDBlU0hCdDdYeDVGN0E0SEZ0YWJYRXpETEQwMWJuU2lHSw=="), b;
777 g_ret = B64Decode(a,b);
778 }
779};
780
781
34383528
BH
782struct NOPTest
783{
784 string getName() const
785 {
786 return "null test";
787 }
788
789 void operator()() const
790 {
791 }
792
793};
794
b756da67
PL
795struct StatRingDNSNameQTypeToStringTest
796{
797 explicit StatRingDNSNameQTypeToStringTest(const DNSName &name, const QType type) : d_name(name), d_type(type) {}
798
799 string getName() const { return "StatRing test with DNSName and QType to string"; }
800
801 void operator()() const {
802 S.ringAccount("testring", d_name.toLogString()+"/"+d_type.getName());
803 };
804
805 DNSName d_name;
806 QType d_type;
807};
808
c410bb1d
PL
809struct StatRingDNSNameQTypeTest
810{
811 explicit StatRingDNSNameQTypeTest(const DNSName &name, const QType type) : d_name(name), d_type(type) {}
812
813 string getName() const { return "StatRing test with DNSName and QType"; }
814
815 void operator()() const {
3b2aeba3 816 S.ringAccount("testringdnsname", d_name, d_type);
c410bb1d
PL
817 };
818
819 DNSName d_name;
820 QType d_type;
821};
822
34383528 823
5a6caecd
OM
824struct NetmaskTreeTest
825{
826 string getName() const { return "NetmaskTreeTest"; }
827
828 void operator()() const {
829 Netmask nm("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/64");
830 NetmaskTree<bool> tree;
831
832 for (int i = 0; i < 100; i++)
833 tree.insert_or_assign(nm, true);
834 }
835};
34383528
BH
836
837int main(int argc, char** argv)
838try
839{
840 reportAllTypes();
e325f20c 841
b7821a82 842 doRun(NOPTest());
ecefa116 843
b7821a82
BH
844 doRun(IEqualsTest());
845 doRun(MyIEqualsTest());
846 doRun(StrcasecmpTest());
88227be0
KM
847 doRun(Base64EncodeTest());
848 doRun(B64DecodeTest());
b7821a82
BH
849
850 doRun(StackMallocTest());
34383528 851
34383528
BH
852 doRun(EmptyQueryTest());
853 doRun(TypicalRefTest());
6b0ea82d 854 doRun(BigRefTest());
855 doRun(BigDNSPacketRefTest());
34383528 856
69319910 857 auto packet = makeEmptyQuery();
34383528
BH
858 doRun(ParsePacketTest(packet, "empty-query"));
859
860 packet = makeTypicalReferral();
861 cerr<<"typical referral size: "<<packet.size()<<endl;
b7821a82 862 doRun(ParsePacketBareTest(packet, "typical-referral"));
34383528 863
b7821a82 864 doRun(ParsePacketTest(packet, "typical-referral"));
34383528
BH
865
866 doRun(SimpleCompressTest("www.france.ds9a.nl"));
867
b7821a82 868
34383528 869 doRun(VectorExpandTest());
7519bae5
BH
870
871 doRun(GetTimeTest());
1f9faf8b
BH
872
873 doRun(GetLockUncontendedTest());
874 doRun(StaticMemberTest());
875
34383528
BH
876 doRun(ARecordTest(1));
877 doRun(ARecordTest(2));
878 doRun(ARecordTest(4));
879 doRun(ARecordTest(64));
880
881 doRun(A2RecordTest(1));
882 doRun(A2RecordTest(2));
883 doRun(A2RecordTest(4));
884 doRun(A2RecordTest(64));
885
886 doRun(MakeStringFromCharStarTest());
887 doRun(MakeARecordTest());
888 doRun(MakeARecordTestMM());
889
890 doRun(AAAARecordTest(1));
891 doRun(AAAARecordTest(2));
892 doRun(AAAARecordTest(4));
893 doRun(AAAARecordTest(64));
894
895 doRun(TXTRecordTest(1));
896 doRun(TXTRecordTest(2));
897 doRun(TXTRecordTest(4));
898 doRun(TXTRecordTest(64));
899
900 doRun(GenericRecordTest(1, QType::NS, "powerdnssec1.ds9a.nl"));
901 doRun(GenericRecordTest(2, QType::NS, "powerdnssec1.ds9a.nl"));
902 doRun(GenericRecordTest(4, QType::NS, "powerdnssec1.ds9a.nl"));
903 doRun(GenericRecordTest(64, QType::NS, "powerdnssec1.ds9a.nl"));
904
ab570fc5 905
34383528
BH
906
907 doRun(SOARecordTest(1));
908 doRun(SOARecordTest(2));
909 doRun(SOARecordTest(4));
910 doRun(SOARecordTest(64));
911
ab570fc5 912 doRun(StringtokTest());
913 doRun(VStringtokTest());
179dad39 914 doRun(StringAppendTest());
6b0ea82d 915 doRun(BoostStringAppendTest());
ab570fc5 916
b8a514bb 917 doRun(DNSNameParseTest());
918 doRun(DNSNameRootTest());
919
5a6caecd
OM
920 doRun(NetmaskTreeTest());
921
b756da67
PL
922#ifndef RECURSOR
923 S.doRings();
924
925 S.declareRing("testring", "Just some ring where we'll account things");
926 doRun(StatRingDNSNameQTypeToStringTest(DNSName("example.com"), QType(1)));
c410bb1d 927
3b2aeba3 928 S.declareDNSNameQTypeRing("testringdnsname", "Just some ring where we'll account things");
c410bb1d 929 doRun(StatRingDNSNameQTypeTest(DNSName("example.com"), QType(1)));
b756da67
PL
930#endif
931
34383528
BH
932 cerr<<"Total runs: " << g_totalRuns<<endl;
933
934}
935catch(std::exception &e)
936{
937 cerr<<"Fatal: "<<e.what()<<endl;
938}
939