more testing and concurrent server benchmarking

This commit is contained in:
Miek Gieben 2013-06-22 08:55:30 +01:00
parent 9762efef1e
commit 5ae9b5214f
3 changed files with 8 additions and 2 deletions

View File

@ -108,6 +108,8 @@ func (rr *OPT) copy() RR {
return &OPT{*rr.Hdr.copyHeader(), rr.Option}
}
// return the old value -> delete SetVersion
// Version returns the EDNS version used. Only zero is defined.
func (rr *OPT) Version() uint8 {
return uint8(rr.Hdr.Ttl & 0x00FF00FFFF)

View File

@ -371,7 +371,8 @@ func TestParseFailure(t *testing.T) {
}
}
// A bit useless, how to use b.N?
/*
// A bit useless, how to use b.N?. It always returns 0
func BenchmarkZoneParsing(b *testing.B) {
b.StopTimer()
f, err := os.Open("t/miek.nl.signed_test")
@ -386,6 +387,7 @@ func BenchmarkZoneParsing(b *testing.B) {
}
}
}
*/
func TestZoneParsing(t *testing.T) {
f, err := os.Open("t/miek.nl.signed_test")

View File

@ -5,6 +5,7 @@
package dns
import (
"runtime"
"testing"
"time"
)
@ -59,8 +60,8 @@ func TestServing(t *testing.T) {
func BenchmarkServing(b *testing.B) {
b.StopTimer()
// Again start a server
HandleFunc("miek.nl.", HelloServer)
a := runtime.GOMAXPROCS(4)
go func() {
ListenAndServe("127.0.0.1:8053", "udp", nil)
}()
@ -73,6 +74,7 @@ func BenchmarkServing(b *testing.B) {
for i := 0; i < b.N; i++ {
c.Exchange(m, "127.0.0.1:8053")
}
runtime.GOMAXPROCS(a)
}
func TestDotAsCatchAllWildcard(t *testing.T) {