Skip to content

Migrate build dimension #974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions test/robot/monitor/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ func (t *Traces) All() []*Trace {
return t.entries
}

// MatchPackage returns the set of Trace objects that were traced with a specific package.
func (t *Traces) MatchPackage(p *Package) []*Trace {
result := []*Trace{}
for _, trace := range t.entries {
if trace.Input.Package == p.Id {
result = append(result, trace)
}
}
return result
}

func (o *DataOwner) updateTrace(ctx context.Context, action *trace.Action) error {
o.Write(func(data *Data) {
entry, _ := data.Traces.FindOrCreate(ctx, action)
Expand Down
2 changes: 2 additions & 0 deletions test/robot/replay/replay.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ message Input {
// VirtualSwapChainLib is the stash id of the vulkan virtual-swap-chain loader
// json file.
string virtual_swap_chain_json = 6;
// Package is the stash id of the package used to generate the report.
string package = 7;
}

// Output holds the outputs of a replay action.
Expand Down
2 changes: 2 additions & 0 deletions test/robot/report/report.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ message Input{
string gapit = 2;
// Gapis is the stash id of the graphics analysis server to use.
string gapis = 3;
// Package is the stash id of the package used to generate the report.
string package = 4;
}

// Output describes the outputs of a report action.
Expand Down
30 changes: 7 additions & 23 deletions test/robot/scheduler/replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,20 @@ import (
"github.com/google/gapid/test/robot/replay"
)

func (s schedule) getReplayTargetTools(ctx context.Context) *build.ToolSet {
ctx = log.V{"target": s.worker.Target}.Bind(ctx)
tools := s.pkg.FindTools(ctx, s.data.FindDevice(s.worker.Target))
if tools == nil {
return nil
}
if tools.Host.Gapir == "" {
return nil
}
return tools
}

func (s schedule) doReplay(ctx context.Context, t *monitor.Trace) error {
func (s schedule) doReplay(ctx context.Context, t *monitor.Trace, tools *build.ToolSet) error {
if !s.worker.Supports(job.Replay) {
return nil
}
ctx = log.Enter(ctx, "Replay")
ctx = log.V{"Package": s.pkg.Id}.Bind(ctx)
hostTools := s.getHostTools(ctx)
targetTools := s.getReplayTargetTools(ctx)
if hostTools == nil || targetTools == nil {
return log.Err(ctx, nil, "Failed to find tools for report!")
}
input := &replay.Input{
Trace: t.Action.Output.Trace,
Gapit: hostTools.Host.Gapit,
Gapis: hostTools.Host.Gapis,
Gapir: targetTools.Host.Gapir,
VirtualSwapChainLib: targetTools.Host.VirtualSwapChainLib,
VirtualSwapChainJson: targetTools.Host.VirtualSwapChainJson,
Gapit: tools.Host.Gapit,
Gapis: tools.Host.Gapis,
Gapir: tools.Host.Gapir,
VirtualSwapChainLib: tools.Host.VirtualSwapChainLib,
VirtualSwapChainJson: tools.Host.VirtualSwapChainJson,
Package: s.pkg.Id,
}
action := &replay.Action{
Input: input,
Expand Down
14 changes: 6 additions & 8 deletions test/robot/scheduler/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,23 @@ import (
"context"

"github.com/google/gapid/core/log"
"github.com/google/gapid/test/robot/build"
"github.com/google/gapid/test/robot/job"
"github.com/google/gapid/test/robot/monitor"
"github.com/google/gapid/test/robot/report"
)

func (s schedule) doReport(ctx context.Context, t *monitor.Trace) error {
func (s schedule) doReport(ctx context.Context, t *monitor.Trace, tools *build.ToolSet) error {
if !s.worker.Supports(job.Report) {
return nil
}
ctx = log.Enter(ctx, "Report")
ctx = log.V{"Package": s.pkg.Id}.Bind(ctx)
hostTools := s.getHostTools(ctx)
if hostTools == nil {
return log.Err(ctx, nil, "Failed to find tools for report!")
}
input := &report.Input{
Trace: t.Action.Output.Trace,
Gapit: hostTools.Host.Gapit,
Gapis: hostTools.Host.Gapis,
Trace: t.Action.Output.Trace,
Gapit: tools.Host.Gapit,
Gapis: tools.Host.Gapis,
Package: s.pkg.Id,
}
action := &report.Action{
Input: input,
Expand Down
34 changes: 30 additions & 4 deletions test/robot/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,30 @@ func Tick(ctx context.Context, managers *monitor.Managers, data *monitor.Data) [
s.pkg = pkg
for _, w := range data.Workers.All() {
s.worker = w
tools := s.getHostTools(ctx)
if tools == nil {
continue
}
for _, subj := range data.Subjects.All() {
if err := s.doTrace(ctx, subj); err != nil {
androidTools := s.getAndroidTools(ctx, subj)
if androidTools == nil {
continue
}
if err := s.doTrace(ctx, subj, tools, androidTools); err != nil {
errs = append(errs, err)
}
}
for _, t := range data.Traces.All() {
for _, t := range data.Traces.MatchPackage(s.pkg) {
if t.Status != job.Succeeded {
continue
}
if t.Output == nil {
continue
}
if err := s.doReport(ctx, t); err != nil {
if err := s.doReport(ctx, t, tools); err != nil {
errs = append(errs, err)
}
if err := s.doReplay(ctx, t); err != nil {
if err := s.doReplay(ctx, t, tools); err != nil {
errs = append(errs, err)
}
}
Expand All @@ -88,5 +96,23 @@ func (s schedule) getHostTools(ctx context.Context) *build.ToolSet {
if tools.Host.Gapir == "" {
return nil
}
if tools.Host.VirtualSwapChainLib == "" {
return nil
}
if tools.Host.VirtualSwapChainJson == "" {
return nil
}
return tools
}

func (s schedule) getAndroidTools(ctx context.Context, subj *monitor.Subject) *build.AndroidToolSet {
ctx = log.V{"target": s.worker.Target}.Bind(ctx)
tools := s.pkg.FindToolsForAPK(ctx, s.data.FindDevice(s.worker.Host), s.data.FindDevice(s.worker.Target), subj.GetAPK())
if tools == nil {
return nil
}
if tools.GapidApk == "" {
return nil
}
return tools
}
27 changes: 5 additions & 22 deletions test/robot/scheduler/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,20 @@ import (
"github.com/google/gapid/test/robot/trace"
)

func (s schedule) getTraceTargetTools(ctx context.Context, subj *monitor.Subject) *build.AndroidToolSet {
ctx = log.V{"target": s.worker.Target}.Bind(ctx)
tools := s.pkg.FindToolsForAPK(ctx, s.data.FindDevice(s.worker.Host), s.data.FindDevice(s.worker.Target), subj.GetAPK())

if tools == nil {
return nil
}
if tools.GapidApk == "" {
return nil
}
return tools
}

func (s schedule) doTrace(ctx context.Context, subj *monitor.Subject) error {
func (s schedule) doTrace(ctx context.Context, subj *monitor.Subject, tools *build.ToolSet, androidTools *build.AndroidToolSet) error {
if !s.worker.Supports(job.Trace) {
return nil
}
ctx = log.Enter(ctx, "Trace")
ctx = log.V{"Package": s.pkg.Id}.Bind(ctx)
hostTools := s.getHostTools(ctx)
targetTools := s.getTraceTargetTools(ctx, subj)
if hostTools == nil || targetTools == nil {
return log.Err(ctx, nil, "Failed to find tools for trace!")
}
input := &trace.Input{
Subject: subj.Id,
Gapit: hostTools.Host.Gapit,
GapidApk: targetTools.GapidApk,
Gapit: tools.Host.Gapit,
GapidApk: androidTools.GapidApk,
Package: s.pkg.Id,
Hints: subj.Hints,
Layout: &trace.ToolingLayout{
GapidAbi: targetTools.Abi,
GapidAbi: androidTools.Abi,
},
}
action := &trace.Action{
Expand Down
2 changes: 2 additions & 0 deletions test/robot/trace/trace.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ message Input {
subject.Hints hints = 4;
// layout represents details about what tools we're using to trace.
ToolingLayout layout = 5;
// Package is the stash id of the package used to trace.
string package = 6;
}

// ToolingLayout describes tools we use for tracing.
Expand Down
14 changes: 6 additions & 8 deletions test/robot/web/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,16 @@ import (
)

type traceInfo struct {
target Item
gapidApk Item
gapit Item
subject Item
host Item
target Item
subject Item
}

type task struct {
trace traceInfo

kind Item
host Item
pkg Item
result grid.Result
status grid.Status

Expand All @@ -45,10 +44,9 @@ type task struct {
func (t *task) Representation() interface{} {
tr := map[string]interface{}{}
tr["trace target"] = t.trace.target.Underlying()
tr["trace host"] = t.trace.host.Underlying()
tr["trace subject"] = t.trace.subject.Underlying()
tr["trace gapid.apk"] = t.trace.gapidApk.Underlying()
tr["trace gapit"] = t.trace.gapit.Underlying()
tr["host"] = t.host.Underlying()
tr["package"] = t.pkg.Underlying()
return []interface{}{tr, t.underlying}
}

Expand Down
Loading