Compare commits
No commits in common. "df2ade4988f9845f19d019fa0bed3e8fcbf93478" and "ee117b388b5e99eed99735e0830a5eae60397902" have entirely different histories.
df2ade4988
...
ee117b388b
|
@ -21,7 +21,6 @@ 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 {
|
||||||
|
@ -32,9 +31,12 @@ 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})
|
}
|
||||||
slog.Debug("sandbox execute", "i", i, "pbCmd size", proto.Size(pbCmd[0]))
|
pbCmds := convertPBCmd(cmds)
|
||||||
pbReq := &pb.Request{Cmd: pbCmd}
|
for i, pbCmd := range pbCmds {
|
||||||
|
slog.Debug("sandbox execute", "i", i, "pbCmd size", proto.Size(pbCmd))
|
||||||
|
}
|
||||||
|
pbReq := &pb.Request{Cmd: pbCmds}
|
||||||
slog.Debug("sandbox execute", "pbReq size", proto.Size(pbReq))
|
slog.Debug("sandbox execute", "pbReq size", proto.Size(pbReq))
|
||||||
pbRet, err := e.execClient.Exec(context.TODO(), pbReq)
|
pbRet, err := e.execClient.Exec(context.TODO(), pbReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -43,9 +45,9 @@ func (e *Sandbox) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
|
||||||
if pbRet.Error != "" {
|
if pbRet.Error != "" {
|
||||||
return nil, fmt.Errorf("sandbox execute error: %s", pbRet.Error)
|
return nil, fmt.Errorf("sandbox execute error: %s", pbRet.Error)
|
||||||
}
|
}
|
||||||
result := convertPBResult(pbRet.Results)[0]
|
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,19 +39,17 @@ 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(
|
||||||
answerStr,
|
string(answer),
|
||||||
resultStr,
|
result.Files[output.FileName],
|
||||||
output.CompareSpace,
|
output.CompareSpace,
|
||||||
)
|
)
|
||||||
slog.Info(
|
slog.Debug(
|
||||||
"compare",
|
"compare",
|
||||||
"filename", output.FileName,
|
"filename", output.FileName,
|
||||||
"answerPath", output.AnswerPath,
|
"answerPath", output.AnswerPath,
|
||||||
"actualLength", len(resultStr),
|
"actualLength", len(result.Files[output.FileName]),
|
||||||
"answerLength", len(answerStr),
|
"answerLength", len(string(answer)),
|
||||||
"index", i,
|
"index", i,
|
||||||
"isSame", isSame,
|
"isSame", isSame,
|
||||||
)
|
)
|
||||||
|
@ -75,6 +73,8 @@ 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