Example #1
0
func simple(ctx context.Context, t model.KeyedTest, sub model.KeyedSubmission, ball io.Reader) (err error) {
	str, err := runner.Simple(ctx, sub, ball)
	if err != nil {
		return
	}

	// TODO(flowlo): Use a json.Encoder
	var body []byte
	if body, err = json.Marshal(str); err != nil {
		return
	}
	return ws.Write(sub.Key.Parent(), body)
}
Example #2
0
func simple(ctx context.Context, params map[string]string, sub model.KeyedSubmission) error {
	log.Debugf(ctx, "Executing simple tester")
	stdout, stderr, err := runner.Simple(ctx, sub)
	log.Warningf(ctx, "%s %s %s", stdout, stderr, err)

	j, _ := json.Marshal(struct {
		Stdout string
		Stderr string
	}{
		Stdout: stdout.String(),
		Stderr: stderr.String(),
	})
	return ws.Write(sub.Key, j)
}