Compare commits

..

No commits in common. "df2ade4988f9845f19d019fa0bed3e8fcbf93478" and "ee117b388b5e99eed99735e0830a5eae60397902" have entirely different histories.

2 changed files with 23 additions and 21 deletions

View File

@ -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
results := make([]stage.ExecutorResult, len(cmds))
for i := 0; i < len(cmds); i += 1 {
cmd := &cmds[i]
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}
}
}
pbCmd := convertPBCmd([]stage.Cmd{*cmd})
slog.Debug("sandbox execute", "i", i, "pbCmd size", proto.Size(pbCmd[0]))
pbReq := &pb.Request{Cmd: pbCmd}
}
pbCmds := convertPBCmd(cmds)
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))
pbRet, err := e.execClient.Exec(context.TODO(), pbReq)
if err != nil {
@ -43,9 +45,9 @@ func (e *Sandbox) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
if 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)
results[i] = result
}
return results, nil
}

View File

@ -39,19 +39,17 @@ func (*Diff) Run(results []stage.ExecutorResult, confAny any) (
if err != nil {
return nil, true, err
}
answerStr := string(answer)
resultStr := result.Files[output.FileName]
isSame := stringsEqual(
answerStr,
resultStr,
string(answer),
result.Files[output.FileName],
output.CompareSpace,
)
slog.Info(
slog.Debug(
"compare",
"filename", output.FileName,
"answerPath", output.AnswerPath,
"actualLength", len(resultStr),
"answerLength", len(answerStr),
"actualLength", len(result.Files[output.FileName]),
"answerLength", len(string(answer)),
"index", i,
"isSame", isSame,
)
@ -75,6 +73,8 @@ func (*Diff) Run(results []stage.ExecutorResult, confAny any) (
}
// Convert answer to string and split by lines
truncated := false
answerStr := string(answer)
resultStr := result.Files[output.FileName]
if len(answerStr) > output.MaxDiffLength {
answerStr = answerStr[:output.MaxDiffLength]
truncated = true