Test-Runner is a Go module which can be used to execute programs against particular test cases and get corresponding outputs. The goal is to provide an easy module for testing programs for their correctness. This is one of the many modules required to create a completely functional backend for an "Online Judge".
- Runs programs in a completely isolated environment using containers
- Set and record memory and time limits using cgroups
- Easy to use interface
go get github.com/codeiiest/test-runner
import (
"io/ioutil"
"log"
"github.com/codeiiest/test-runner/runner/run"
)
func test(code string, lang string, filename string)
in := []string{"2", "4", "5"}
out := []string{"4", "16", "25"}
timeLimit := 2 // Time in seconds
memLimit := 500*1024*1024 // Memory in bytes
res := run.Evaluate(code, lang, filename, in, out,
len(in), timeLimit, memLimit)
log.Print(res)
}
- Limit Cpu count through cgroups (perhaps choose CPU?)
- Support for more languages (compilation and run scripts)
- Unit Tests
- Makefile
Please use the issue tracker. All contributions are more than welcome :)