summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/benchmarks/fs/fio_test.go18
-rw-r--r--test/benchmarks/tools/sysbench.go31
-rw-r--r--test/packetimpact/runner/dut.go2
-rw-r--r--test/root/cgroup_test.go5
4 files changed, 31 insertions, 25 deletions
diff --git a/test/benchmarks/fs/fio_test.go b/test/benchmarks/fs/fio_test.go
index 0c772b768..83b8376a5 100644
--- a/test/benchmarks/fs/fio_test.go
+++ b/test/benchmarks/fs/fio_test.go
@@ -33,37 +33,37 @@ import (
func BenchmarkFio(b *testing.B) {
testCases := []tools.Fio{
tools.Fio{
- Test: "write4K",
+ Test: "write",
Size: b.N,
BlockSize: 4,
IODepth: 4,
},
tools.Fio{
- Test: "write1M",
+ Test: "write",
Size: b.N,
BlockSize: 1024,
IODepth: 4,
},
tools.Fio{
- Test: "read4K",
+ Test: "read",
Size: b.N,
BlockSize: 4,
IODepth: 4,
},
tools.Fio{
- Test: "read1M",
+ Test: "read",
Size: b.N,
BlockSize: 1024,
IODepth: 4,
},
tools.Fio{
- Test: "randwrite4K",
+ Test: "randwrite",
Size: b.N,
BlockSize: 4,
IODepth: 4,
},
tools.Fio{
- Test: "randread4K",
+ Test: "randread",
Size: b.N,
BlockSize: 4,
IODepth: 4,
@@ -82,11 +82,15 @@ func BenchmarkFio(b *testing.B) {
Name: "operation",
Value: tc.Test,
}
+ blockSize := tools.Parameter{
+ Name: "blockSize",
+ Value: fmt.Sprintf("%dK", tc.BlockSize),
+ }
filesystem := tools.Parameter{
Name: "filesystem",
Value: string(fsType),
}
- name, err := tools.ParametersToName(operation, filesystem)
+ name, err := tools.ParametersToName(operation, blockSize, filesystem)
if err != nil {
b.Fatalf("Failed to parser paramters: %v", err)
}
diff --git a/test/benchmarks/tools/sysbench.go b/test/benchmarks/tools/sysbench.go
index 2b8e6c8aa..350f8ec98 100644
--- a/test/benchmarks/tools/sysbench.go
+++ b/test/benchmarks/tools/sysbench.go
@@ -38,13 +38,15 @@ type SysbenchBase struct {
}
// baseFlags returns top level flags.
-func (s *SysbenchBase) baseFlags(b *testing.B) []string {
+func (s *SysbenchBase) baseFlags(b *testing.B, useEvents bool) []string {
var ret []string
if s.Threads > 0 {
ret = append(ret, fmt.Sprintf("--threads=%d", s.Threads))
}
- ret = append(ret, "--time=0") // Ensure events is used.
- ret = append(ret, fmt.Sprintf("--events=%d", b.N))
+ ret = append(ret, "--time=0") // Ensure other mechanism is used.
+ if useEvents {
+ ret = append(ret, fmt.Sprintf("--events=%d", b.N))
+ }
return ret
}
@@ -56,7 +58,7 @@ type SysbenchCPU struct {
// MakeCmd makes commands for SysbenchCPU.
func (s *SysbenchCPU) MakeCmd(b *testing.B) []string {
cmd := []string{"sysbench"}
- cmd = append(cmd, s.baseFlags(b)...)
+ cmd = append(cmd, s.baseFlags(b, true /* useEvents */)...)
cmd = append(cmd, "cpu", "run")
return cmd
}
@@ -86,7 +88,6 @@ func (s *SysbenchCPU) parseEvents(data string) (float64, error) {
type SysbenchMemory struct {
SysbenchBase
BlockSize int // size of test memory block in megabytes [1].
- TotalSize int // size of data to transfer in gigabytes [100].
Scope string // memory access scope {global, local} [global].
HugeTLB bool // allocate memory from HugeTLB [off].
OperationType string // type of memory ops {read, write, none} [write].
@@ -103,13 +104,10 @@ func (s *SysbenchMemory) MakeCmd(b *testing.B) []string {
// flags makes flags for SysbenchMemory cmds.
func (s *SysbenchMemory) flags(b *testing.B) []string {
- cmd := s.baseFlags(b)
+ cmd := s.baseFlags(b, false /* useEvents */)
if s.BlockSize != 0 {
cmd = append(cmd, fmt.Sprintf("--memory-block-size=%dM", s.BlockSize))
}
- if s.TotalSize != 0 {
- cmd = append(cmd, fmt.Sprintf("--memory-total-size=%dG", s.TotalSize))
- }
if s.Scope != "" {
cmd = append(cmd, fmt.Sprintf("--memory-scope=%s", s.Scope))
}
@@ -122,6 +120,10 @@ func (s *SysbenchMemory) flags(b *testing.B) []string {
if s.AccessMode != "" {
cmd = append(cmd, fmt.Sprintf("--memory-access-mode=%s", s.AccessMode))
}
+ // Sysbench ignores events for memory tests, and uses the total
+ // size parameter to determine when the test is done. We scale
+ // with this instead.
+ cmd = append(cmd, fmt.Sprintf("--memory-total-size=%dG", b.N))
return cmd
}
@@ -150,7 +152,6 @@ func (s *SysbenchMemory) parseOperations(data string) (float64, error) {
type SysbenchMutex struct {
SysbenchBase
Num int // total size of mutex array [4096].
- Locks int // number of mutex locks per thread [50000].
Loops int // number of loops to do outside mutex lock [10000].
}
@@ -165,16 +166,18 @@ func (s *SysbenchMutex) MakeCmd(b *testing.B) []string {
// flags makes flags for SysbenchMutex commands.
func (s *SysbenchMutex) flags(b *testing.B) []string {
var cmd []string
- cmd = append(cmd, s.baseFlags(b)...)
+ cmd = append(cmd, s.baseFlags(b, false /* useEvents */)...)
if s.Num > 0 {
cmd = append(cmd, fmt.Sprintf("--mutex-num=%d", s.Num))
}
- if s.Locks > 0 {
- cmd = append(cmd, fmt.Sprintf("--mutex-locks=%d", s.Locks))
- }
if s.Loops > 0 {
cmd = append(cmd, fmt.Sprintf("--mutex-loops=%d", s.Loops))
}
+ // Sysbench does not respect --events for mutex tests. From [1]:
+ // "Here --time or --events are completely ignored. Sysbench always
+ // runs one event per thread."
+ // [1] https://tomfern.com/posts/sysbench-guide-1
+ cmd = append(cmd, fmt.Sprintf("--mutex-locks=%d", b.N))
return cmd
}
diff --git a/test/packetimpact/runner/dut.go b/test/packetimpact/runner/dut.go
index 3e26c73cb..3da265b78 100644
--- a/test/packetimpact/runner/dut.go
+++ b/test/packetimpact/runner/dut.go
@@ -551,7 +551,7 @@ func StartContainer(ctx context.Context, runOpts dockerutil.RunOpts, c *dockerut
hostconf.AutoRemove = true
hostconf.Sysctls = map[string]string{"net.ipv6.conf.all.disable_ipv6": "0"}
- if err := c.CreateFrom(ctx, conf, hostconf, nil); err != nil {
+ if err := c.CreateFrom(ctx, runOpts.Image, conf, hostconf, nil); err != nil {
return fmt.Errorf("unable to create container %s: %w", c.Name, err)
}
diff --git a/test/root/cgroup_test.go b/test/root/cgroup_test.go
index a26b83081..a74d6b1c1 100644
--- a/test/root/cgroup_test.go
+++ b/test/root/cgroup_test.go
@@ -249,12 +249,11 @@ func TestCgroup(t *testing.T) {
case "pids-limit":
val := attr.value
hostconf.Resources.PidsLimit = &val
-
}
}
// Create container.
- if err := d.CreateFrom(ctx, conf, hostconf, nil); err != nil {
+ if err := d.CreateFrom(ctx, "basic/alpine", conf, hostconf, nil); err != nil {
t.Fatalf("create failed with: %v", err)
}
@@ -323,7 +322,7 @@ func TestCgroupParent(t *testing.T) {
}, "sleep", "10000")
hostconf.Resources.CgroupParent = parent
- if err := d.CreateFrom(ctx, conf, hostconf, nil); err != nil {
+ if err := d.CreateFrom(ctx, "basic/alpine", conf, hostconf, nil); err != nil {
t.Fatalf("create failed with: %v", err)
}