Skip to content

Commit 394f218

Browse files
authored
Merge pull request #496 from intel-go/develop
Release 0.6.1 with testing infrastructure improvements
2 parents e30524b + cccb9e9 commit 394f218

File tree

9 files changed

+131
-115
lines changed

9 files changed

+131
-115
lines changed

low/low.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ func ReportMempoolsState() {
643643
func CreateKni(portId uint16, core uint, name string) error {
644644
mempool := (*C.struct_rte_mempool)(CreateMempool("KNI"))
645645
if C.create_kni(C.uint16_t(portId), C.uint32_t(core), C.CString(name), mempool) != 0 {
646-
common.WrapWithNFError(nil, "Error with KNI allocation\n", common.FailToCreateKNI)
646+
return common.WrapWithNFError(nil, "Error with KNI allocation\n", common.FailToCreateKNI)
647647
}
648648
return nil
649649
}

test/framework/dockerlauncher.go

+37-22
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ var (
5050
regexp.MustCompile(`average= *(\d+\.?\d*) μs$`),
5151
regexp.MustCompile(`stddev= *(\d+\.?\d*) μs$`),
5252
}
53+
WrkStatsRegexps = [2]*regexp.Regexp{
54+
regexp.MustCompile(`Requests/sec: *(\d+\.?\d*)$`),
55+
regexp.MustCompile(`Transfer/sec: *(\d+\.?\d*)([K|M|G|T|P])B$`),
56+
}
57+
unitScale = map[string]float64{
58+
"K": 1.0,
59+
"M": 1024.0,
60+
"G": 1024.0 * 1024.0,
61+
"T": 1024.0 * 1024.0 * 1024.0,
62+
"P": 1024.0 * 1024.0 * 1024.0 * 1024.0,
63+
}
5364

5465
NoDeleteContainersOnExit = false
5566
username string
@@ -77,6 +88,7 @@ type RunningApp struct {
7788
CoresStats []CoresInfo
7889
abs *ApacheBenchmarkStats
7990
lats *LatencyStats
91+
wrks *WrkBenchmarkStats
8092
Logger *Logger
8193
benchStartTime time.Time
8294
benchEndTime time.Time
@@ -138,9 +150,10 @@ func (app *RunningApp) testRoutine(report chan<- TestReport, done <-chan struct{
138150
app.Status = TestRunning
139151
if app.config.Type == TestAppApacheBenchmark {
140152
app.abs = &ApacheBenchmarkStats{}
141-
}
142-
if app.config.Type == TestAppLatency {
153+
} else if app.config.Type == TestAppLatency {
143154
app.lats = &LatencyStats{}
155+
} else if app.config.Type == TestAppWrkBenchmark {
156+
app.wrks = &WrkBenchmarkStats{}
144157
}
145158

146159
scanner := bufio.NewScanner(logs)
@@ -156,6 +169,23 @@ func (app *RunningApp) testRoutine(report chan<- TestReport, done <-chan struct{
156169
} else if TestFailedRegexp.FindStringIndex(str) != nil {
157170
status = TestReportedFailed
158171
} else {
172+
fillstats := func(stats []float64, rexps []*regexp.Regexp) {
173+
for iii := range rexps {
174+
matches := rexps[iii].FindStringSubmatch(str)
175+
if len(matches) >= 2 {
176+
var value float64
177+
n, err := fmt.Sscanf(matches[1], "%f", &value)
178+
if err == nil && n == 1 {
179+
stats[iii] = value
180+
if len(matches) == 3 {
181+
// Next match is unit letter
182+
stats[iii] *= unitScale[matches[2]]
183+
}
184+
}
185+
}
186+
}
187+
}
188+
159189
// Scan for strings specific to test application type
160190
if app.config.Type == TestAppGo {
161191
// Get cores number information for NFF-Go application
@@ -175,28 +205,13 @@ func (app *RunningApp) testRoutine(report chan<- TestReport, done <-chan struct{
175205
}
176206
} else if app.config.Type == TestAppApacheBenchmark {
177207
// Get Apache Benchmark output
178-
for iii := range ABStatsRegexps {
179-
matches := ABStatsRegexps[iii].FindStringSubmatch(str)
180-
if len(matches) == 2 {
181-
var value float32
182-
n, err := fmt.Sscanf(matches[1], "%f", &value)
183-
if err == nil && n == 1 {
184-
app.abs.Stats[iii] = value
185-
}
186-
}
187-
}
208+
fillstats(app.abs.Stats[:], ABStatsRegexps[:])
188209
} else if app.config.Type == TestAppLatency {
189210
// Get Latency perf test output
190-
for iii := range LatStatsRegexps {
191-
matches := LatStatsRegexps[iii].FindStringSubmatch(str)
192-
if len(matches) == 2 {
193-
var value float32
194-
n, err := fmt.Sscanf(matches[1], "%f", &value)
195-
if err == nil && n == 1 {
196-
app.lats.Stats[iii] = value
197-
}
198-
}
199-
}
211+
fillstats(app.lats.Stats[:], LatStatsRegexps[:])
212+
} else if app.config.Type == TestAppWrkBenchmark {
213+
// Get Wrk Benchmark output
214+
fillstats(app.wrks.Stats[:], WrkStatsRegexps[:])
200215
}
201216
}
202217

test/framework/main/perf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"OUTPORT1_2": "1",
1818
"PKTGENCOREMASK": "0x1ff",
1919
"PKTGENPORT": "[1:2-3].0, [4-5:6].1",
20-
"CORES": "0-43"
20+
"CORES": "0-43"
2121
},
2222
"tests": [
2323
{

test/framework/report.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ type TestcaseReportInfo struct {
3030
ABStats *ApacheBenchmarkStats `json:",omitempty"`
3131
// Latency type tests
3232
LatStats *LatencyStats `json:",omitempty"`
33+
// Latency type tests
34+
WStats *WrkBenchmarkStats `json:",omitempty"`
3335
// Per application statistics
3436
Apps []RunningApp `json:"-"`
3537
}
@@ -151,7 +153,14 @@ const (
151153
</tr><tr>
152154
<td class="thinrborderstatnames">Requested speed [Pkts/sec]</td><td>{{index .Stats 1}}</td>
153155
</tr>
154-
</table>{{end}}{{/* end with .LatStats */}}{{end}}{{/* end if .LatStats */}}
156+
</table>{{end}}{{/* end with .LatStats */}}{{end}}{{/* end if .LatStats */}}{{if .WStats}}{{with .WStats}}
157+
<table class="bench">
158+
<tr>
159+
<td class="thinrborderstatnames">Requests per second [#/sec]</td><td>{{index .Stats 0}}</td>
160+
</tr><tr>
161+
<td class="thinrborderstatnames">Transfer rate [Kbytes/sec] received</td><td>{{index .Stats 1}}</td>
162+
</tr>
163+
</table>{{end}}{{/* end with .WStats */}}{{end}}{{/* end if .WStats */}}
155164
</td>
156165
</tr>{{range $appindex, $appelement := .Apps}}<tr style='display:none' id='{{genappid $testindex $appindex}}'>
157166
<td>

test/framework/report_test.go

+20-8
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,7 @@ func testScenarios(t *testing.T, logdir string, tests []TestcaseReportInfo) {
5454
}
5555

5656
for iii := range tests {
57-
select {
58-
case report.Pipe <- tests[iii]:
59-
t.Log("Reported test", iii)
60-
case err := <-report.Done:
61-
t.Fatal(err)
62-
}
57+
report.AddTestResult(&tests[iii])
6358
}
6459

6560
report.FinishReport()
@@ -88,6 +83,8 @@ func testManyApps(t *testing.T, testtype TestType) {
8883
appConfig[iii].Type = TestAppApacheBenchmark
8984
} else if iii == 0 && testtype == TestTypeLatency {
9085
appConfig[iii].Type = TestAppLatency
86+
} else if iii == 0 && testtype == TestTypeWrkBenchmark {
87+
appConfig[iii].Type = TestAppWrkBenchmark
9188
} else {
9289
appConfig[iii].Type = TestAppGo
9390
}
@@ -132,11 +129,15 @@ func testManyApps(t *testing.T, testtype TestType) {
132129
}
133130
} else if appConfig[iii].Type == TestAppApacheBenchmark {
134131
apps[iii].abs = &ApacheBenchmarkStats{
135-
Stats: [4]float32{111.111, 222.222, 333.333, 444.444},
132+
Stats: [4]float64{111.111, 222.222, 333.333, 444.444},
136133
}
137134
} else if appConfig[iii].Type == TestAppLatency {
138135
apps[iii].lats = &LatencyStats{
139-
Stats: [5]float32{111.111, 1000000, 222.222, 333.333, 444.444},
136+
Stats: [5]float64{111.111, 1000000, 222.222, 333.333, 444.444},
137+
}
138+
} else if appConfig[iii].Type == TestAppWrkBenchmark {
139+
apps[iii].wrks = &WrkBenchmarkStats{
140+
Stats: [2]float64{111.111, 222.222},
140141
}
141142
} else { // appConfig[iii].Type == TestAppGo
142143
apps[iii].CoresStats = make([]CoresInfo, NUM_MEASUREMENTS)
@@ -183,6 +184,13 @@ func testManyApps(t *testing.T, testtype TestType) {
183184
break
184185
}
185186
}
187+
} else if testtype == TestTypeWrkBenchmark {
188+
for iii := range apps {
189+
if apps[iii].config.Type == TestAppWrkBenchmark {
190+
tests[jjj].WStats = apps[iii].wrks
191+
break
192+
}
193+
}
186194
}
187195
}
188196

@@ -204,3 +212,7 @@ func TestApacheBenchmarkManyApps(t *testing.T) {
204212
func TestLatencyManyApps(t *testing.T) {
205213
testManyApps(t, TestTypeLatency)
206214
}
215+
216+
func TestWrkBenchmarkManyApps(t *testing.T) {
217+
testManyApps(t, TestTypeWrkBenchmark)
218+
}

test/framework/testsuite.go

+8
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,14 @@ func (config *TestsuiteConfig) executeOneTest(test *TestConfig, logdir string,
188188
break
189189
}
190190
}
191+
} else if test.Type == TestTypeWrkBenchmark {
192+
// Find which app has Wrk Benchmark statistics report
193+
for iii := range apps {
194+
if apps[iii].config.Type == TestAppWrkBenchmark {
195+
tri.WStats = apps[iii].wrks
196+
break
197+
}
198+
}
191199
}
192200

193201
return &tri

test/framework/types.go

+21-8
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const (
6161
TestAppPktgen
6262
TestAppApacheBenchmark
6363
TestAppLatency
64+
TestAppWrkBenchmark
6465
)
6566

6667
// UnmarshalJSON unmarshals data and checks app type validity.
@@ -77,6 +78,7 @@ func (at *AppType) UnmarshalJSON(data []byte) error {
7778
"TestAppPktgen": TestAppPktgen,
7879
"TestAppApacheBenchmark": TestAppApacheBenchmark,
7980
"TestAppLatency": TestAppLatency,
81+
"TestAppWrkBenchmark": TestAppWrkBenchmark,
8082
}[s]
8183
if !ok {
8284
return fmt.Errorf("invalid AppType %q", s)
@@ -91,9 +93,10 @@ type TestType int
9193
// Constants for different test types.
9294
const (
9395
TestTypeBenchmark TestType = iota
96+
TestTypeScenario
9497
TestTypeApacheBenchmark
9598
TestTypeLatency
96-
TestTypeScenario
99+
TestTypeWrkBenchmark
97100
)
98101

99102
// UnmarshalJSON unmarshals data and checks test type validity.
@@ -107,9 +110,10 @@ func (at *TestType) UnmarshalJSON(data []byte) error {
107110
// Use map to get int keys for string values
108111
got, ok := map[string]TestType{
109112
"TestTypeBenchmark": TestTypeBenchmark,
113+
"TestTypeScenario": TestTypeScenario,
110114
"TestTypeApacheBenchmark": TestTypeApacheBenchmark,
111115
"TestTypeLatency": TestTypeLatency,
112-
"TestTypeScenario": TestTypeScenario,
116+
"TestTypeWrkBenchmark": TestTypeWrkBenchmark,
113117
}[s]
114118
if !ok {
115119
return fmt.Errorf("invalid TestType %q", s)
@@ -137,16 +141,16 @@ type ReportCoresInfo struct {
137141

138142
// Indexes in array of Apache Benchmark stats ApacheBenchmarkStats
139143
const (
140-
RequestsPerSecond = iota
141-
TimePerRequest
142-
TimePerRequestConcurrent
143-
TransferRate
144+
AbRequestsPerSecond = iota
145+
AbTimePerRequest
146+
AbTimePerRequestConcurrent
147+
AbTransferRate
144148
)
145149

146150
// ApacheBenchmarkStats has info about running Apache Benchmark web
147151
// client.
148152
type ApacheBenchmarkStats struct {
149-
Stats [4]float32
153+
Stats [4]float64
150154
}
151155

152156
// Indexes in array of latency stats LatencyStats
@@ -160,7 +164,16 @@ const (
160164

161165
// LatencyStats has info about finished latency perf test
162166
type LatencyStats struct {
163-
Stats [5]float32
167+
Stats [5]float64
168+
}
169+
170+
const (
171+
WrkRequestsPerSecond = iota
172+
WrkTransferRate
173+
)
174+
175+
type WrkBenchmarkStats struct {
176+
Stats [2]float64
164177
}
165178

166179
// TestReport has info about test status and application.

vagrant/Vagrantfile

+14-6
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Vagrant.configure(2) do |config|
3333
config.vm.provider "libvirt" do |lv|
3434
lv.driver = "kvm"
3535
lv.memory = "4096"
36-
lv.cpus = 8
36+
lv.cpus = 16
3737
lv.storage_pool_name = "images"
3838
end
3939

@@ -52,7 +52,10 @@ sudo sed -i -e 's,biosdevname=0,biosdevname=1,' /etc/default/grub
5252
sudo sed -i -e 's,net.ifnames=0,net.ifnames=1,' /etc/default/grub
5353
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
5454
55-
if [ $(readlink /etc/udev/rules.d/80-net-setup-link.rules) == /dev/null ]
55+
echo Disabling SELinux
56+
sudo sed -i -e 's,SELINUX=enforcing,SELINUX=disabled,' /etc/selinux/config
57+
58+
if [ "$(readlink /etc/udev/rules.d/80-net-setup-link.rules)" == /dev/null ]
5659
then
5760
echo Fixing udev to use consistent interface names
5861
sudo rm /etc/udev/rules.d/80-net-setup-link.rules
@@ -80,16 +83,21 @@ echo Reassigning "${syscon}" interface to system name
8083
sudo nmcli c mod "${syscon}" connection.id 'System connection'
8184
8285
echo Unpacking Go language into /opt
83-
(cd /opt; sudo sh -c 'curl -L -s https://dl.google.com/go/go1.11.1.linux-amd64.tar.gz | tar zx')
86+
(cd /opt; sudo sh -c 'curl -L -s https://dl.google.com/go/go1.11.2.linux-amd64.tar.gz | tar zx')
8487
mkdir go
8588
chmod +x ~/scripts.sh
8689
. ~/scripts.sh
8790
echo . ~/scripts.sh >> .bashrc
88-
setupdocker
91+
setuptesthost
8992
90-
echo Downloading and building NFF-GO
93+
echo Downloading and building NFF-GO framework
9194
go get -d -v github.com/intel-go/nff-go
92-
(cd \"$GOPATH\"/src/github.com/intel-go/nff-go; git checkout develop; ./scripts/get-depends.sh; make)
95+
(cd "${GOPATH}"/src/github.com/intel-go/nff-go; git checkout develop; ./scripts/get-depends.sh; make)
96+
echo Downloading and building NFF-GO NAT example and its dependencies
97+
go get github.com/golang/protobuf/protoc-gen-go
98+
git clone -b develop --recurse-submodules http://github.com/intel-go/nff-go-nat
99+
(cd nff-go-nat; . env.sh; make)
100+
./nff-go-nat/test/httpperfserv/install-systemd-service.sh "-port 8008"
93101
94102
echo Setting up 1024 huge pages
95103
sudo sh -c 'echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages'

0 commit comments

Comments
 (0)