Fix native benchmarks.

PiperOrigin-RevId: 350509137
This commit is contained in:
Adin Scannell
2021-01-07 01:17:10 -08:00
committed by gVisor bot
parent fa8682da0f
commit 776016ac64
3 changed files with 16 additions and 10 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ _templates:
retry:
automatic: false
soft_fail: true
if: build.message =~ /benchmarks/ || build.branch == "master"
if: build.branch == "master"
env:
# BENCHMARKS_OFFICIAL is set from hooks/pre-command, based
# on whether this is executing on the master branch.
@@ -152,7 +152,7 @@ steps:
label: ":fire: Benchmarks smoke test"
command: make benchmark-platforms
# Use the opposite of the benchmarks filter.
if: build.message !~ /benchmarks/ && build.branch != "master"
if: build.branch != "master"
# Run all benchmarks.
- <<: *benchmarks
+2 -2
View File
@@ -351,9 +351,9 @@ run_benchmark = \
benchmark-platforms: load-benchmarks $(RUNTIME_BIN) ## Runs benchmarks for runc and all given platforms in BENCHMARK_PLATFORMS.
@$(foreach PLATFORM,$(BENCHMARKS_PLATFORMS), \
$(call run_benchmark,$(PLATFORM),--platform=$(PLATFORM) --vfs2) && \
$(call run_benchmark,$(PLATFORM),--platform=$(PLATFORM) --vfs2) && \
) true
@$(call run-benchmark,runc)
@$(call run_benchmark,runc)
.PHONY: benchmark-platforms
run-benchmark: load-benchmarks $(RUNTIME_BIN) ## Runs single benchmark and optionally sends data to BigQuery.
+12 -6
View File
@@ -16,6 +16,7 @@ package harness
import (
"context"
"errors"
"net"
"os/exec"
@@ -66,14 +67,19 @@ func (l *localMachine) RunCommand(cmd string, args ...string) (string, error) {
// IPAddress implements Machine.IPAddress.
func (l *localMachine) IPAddress() (net.IP, error) {
conn, err := net.Dial("udp", "8.8.8.8:80")
addrs, err := net.InterfaceAddrs()
if err != nil {
return nil, err
return net.IP{}, err
}
defer conn.Close()
addr := conn.LocalAddr().(*net.UDPAddr)
return addr.IP, nil
for _, a := range addrs {
if ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
if ipnet.IP.To4() != nil {
return ipnet.IP, nil
}
}
}
// Unable to locate non-loopback address.
return nil, errors.New("no IPAddress available")
}
// CleanUp implements Machine.CleanUp and does nothing for localMachine.