Compare commits
2 Commits
ee117b388b
...
df2ade4988
Author | SHA1 | Date | |
---|---|---|---|
df2ade4988 | |||
9f78569447 |
|
@ -21,6 +21,7 @@ func (e *Sandbox) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// cannot use range loop since we need to change the value
|
// cannot use range loop since we need to change the value
|
||||||
|
results := make([]stage.ExecutorResult, len(cmds))
|
||||||
for i := 0; i < len(cmds); i += 1 {
|
for i := 0; i < len(cmds); i += 1 {
|
||||||
cmd := &cmds[i]
|
cmd := &cmds[i]
|
||||||
if cmd.CopyIn == nil {
|
if cmd.CopyIn == nil {
|
||||||
|
@ -31,23 +32,20 @@ func (e *Sandbox) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
|
||||||
cmd.CopyIn[k] = stage.CmdFile{FileID: &fileID}
|
cmd.CopyIn[k] = stage.CmdFile{FileID: &fileID}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
pbCmd := convertPBCmd([]stage.Cmd{*cmd})
|
||||||
pbCmds := convertPBCmd(cmds)
|
slog.Debug("sandbox execute", "i", i, "pbCmd size", proto.Size(pbCmd[0]))
|
||||||
for i, pbCmd := range pbCmds {
|
pbReq := &pb.Request{Cmd: pbCmd}
|
||||||
slog.Debug("sandbox execute", "i", i, "pbCmd size", proto.Size(pbCmd))
|
slog.Debug("sandbox execute", "pbReq size", proto.Size(pbReq))
|
||||||
}
|
pbRet, err := e.execClient.Exec(context.TODO(), pbReq)
|
||||||
pbReq := &pb.Request{Cmd: pbCmds}
|
if err != nil {
|
||||||
slog.Debug("sandbox execute", "pbReq size", proto.Size(pbReq))
|
return nil, err
|
||||||
pbRet, err := e.execClient.Exec(context.TODO(), pbReq)
|
}
|
||||||
if err != nil {
|
if pbRet.Error != "" {
|
||||||
return nil, err
|
return nil, fmt.Errorf("sandbox execute error: %s", pbRet.Error)
|
||||||
}
|
}
|
||||||
if pbRet.Error != "" {
|
result := convertPBResult(pbRet.Results)[0]
|
||||||
return nil, fmt.Errorf("sandbox execute error: %s", pbRet.Error)
|
|
||||||
}
|
|
||||||
results := convertPBResult(pbRet.Results)
|
|
||||||
for _, result := range results {
|
|
||||||
maps.Copy(e.cachedMap, result.FileIDs)
|
maps.Copy(e.cachedMap, result.FileIDs)
|
||||||
|
results[i] = result
|
||||||
}
|
}
|
||||||
return results, nil
|
return results, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,17 +39,19 @@ func (*Diff) Run(results []stage.ExecutorResult, confAny any) (
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, true, err
|
return nil, true, err
|
||||||
}
|
}
|
||||||
|
answerStr := string(answer)
|
||||||
|
resultStr := result.Files[output.FileName]
|
||||||
isSame := stringsEqual(
|
isSame := stringsEqual(
|
||||||
string(answer),
|
answerStr,
|
||||||
result.Files[output.FileName],
|
resultStr,
|
||||||
output.CompareSpace,
|
output.CompareSpace,
|
||||||
)
|
)
|
||||||
slog.Debug(
|
slog.Info(
|
||||||
"compare",
|
"compare",
|
||||||
"filename", output.FileName,
|
"filename", output.FileName,
|
||||||
"answerPath", output.AnswerPath,
|
"answerPath", output.AnswerPath,
|
||||||
"actualLength", len(result.Files[output.FileName]),
|
"actualLength", len(resultStr),
|
||||||
"answerLength", len(string(answer)),
|
"answerLength", len(answerStr),
|
||||||
"index", i,
|
"index", i,
|
||||||
"isSame", isSame,
|
"isSame", isSame,
|
||||||
)
|
)
|
||||||
|
@ -73,8 +75,6 @@ func (*Diff) Run(results []stage.ExecutorResult, confAny any) (
|
||||||
}
|
}
|
||||||
// Convert answer to string and split by lines
|
// Convert answer to string and split by lines
|
||||||
truncated := false
|
truncated := false
|
||||||
answerStr := string(answer)
|
|
||||||
resultStr := result.Files[output.FileName]
|
|
||||||
if len(answerStr) > output.MaxDiffLength {
|
if len(answerStr) > output.MaxDiffLength {
|
||||||
answerStr = answerStr[:output.MaxDiffLength]
|
answerStr = answerStr[:output.MaxDiffLength]
|
||||||
truncated = true
|
truncated = true
|
||||||
|
|
Loading…
Reference in New Issue
Block a user