make olin tests pass for now

This commit is contained in:
Cadey Ratio 2019-12-10 22:38:40 +00:00
parent 45fcf5fb84
commit 6b1a8165df
3 changed files with 20 additions and 15 deletions

View File

@ -155,7 +155,7 @@ func waitForNewWASM(ctx context.Context, wg *sync.WaitGroup, sh *shell.Shell, nc
Name: "stderr.txt",
Data: stderr.Bytes(),
},
result.ToFile(),
result.StatsFile(),
{
Name: "wasm.cid",
Data: []byte(er.WASMCID),

View File

@ -21,6 +21,7 @@ func runHandler(ctx context.Context, hdlr Handler, timeout time.Duration, messag
Data: message,
Env: map[string]string{
"RUN_ID": execID,
"MAGIC_CONCH": "yes",
},
UUID: execID,
}

View File

@ -36,11 +36,12 @@ type Result struct {
GasUsed uint64
SyscallCount int64
ExecDur time.Duration
PagesBeforeExec int
PagesUsed int
StartTime time.Time
}
func (r Result) ToFile() txtar.File {
func (r Result) StatsFile() txtar.File {
table := uitable.New()
table.AddRow("Status", fmt.Sprint(r.Status))
@ -48,6 +49,7 @@ func (r Result) ToFile() txtar.File {
table.AddRow("Syscall Count", fmt.Sprint(r.SyscallCount))
table.AddRow("Exec Duration", r.ExecDur.String())
table.AddRow("Pages Used", fmt.Sprint(r.PagesUsed))
table.AddRow("Page Delta", fmt.Sprint(r.PagesUsed-r.PagesBeforeExec))
return txtar.File{
Name: "vmstats.txt",
@ -73,6 +75,7 @@ func Run(c Config) (*Result, error) {
return nil, ErrNoCWAMain
}
pagesBefore := len(vm.Memory) / 65536
begin := time.Now()
ret, err := vm.Run(main)
if err != nil {
@ -87,6 +90,7 @@ func Run(c Config) (*Result, error) {
GasUsed: vm.Gas,
SyscallCount: p.SyscallCount(),
ExecDur: dur,
PagesBeforeExec: pagesBefore,
PagesUsed: len(vm.Memory) / 65536,
StartTime: begin,
}, nil