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", Name: "stderr.txt",
Data: stderr.Bytes(), Data: stderr.Bytes(),
}, },
result.ToFile(), result.StatsFile(),
{ {
Name: "wasm.cid", Name: "wasm.cid",
Data: []byte(er.WASMCID), Data: []byte(er.WASMCID),

View File

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

View File

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