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

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

View File

@ -32,15 +32,16 @@ type Config struct {
}
type Result struct {
Status int64
GasUsed uint64
SyscallCount int64
ExecDur time.Duration
PagesUsed int
StartTime time.Time
Status int64
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 {
@ -83,11 +86,12 @@ func Run(c Config) (*Result, error) {
p.Logger.Printf("[SYSTEM] return status: %v", ret)
return &Result{
Status: ret,
GasUsed: vm.Gas,
SyscallCount: p.SyscallCount(),
ExecDur: dur,
PagesUsed: len(vm.Memory) / 65536,
StartTime: begin,
Status: ret,
GasUsed: vm.Gas,
SyscallCount: p.SyscallCount(),
ExecDur: dur,
PagesBeforeExec: pagesBefore,
PagesUsed: len(vm.Memory) / 65536,
StartTime: begin,
}, nil
}