Beispiel #1
0
func (ctx *context) testImpl(inst vm.Instance, command string, duration time.Duration) (crashed bool, err error) {
	outc, errc, err := inst.Run(duration, nil, command)
	if err != nil {
		return false, fmt.Errorf("failed to run command in VM: %v", err)
	}
	desc, text, output, crashed, timedout := vm.MonitorExecution(outc, errc, false, false, ctx.cfg.ParsedIgnores)
	_, _, _ = text, output, timedout
	if !crashed {
		Logf(2, "reproducing crash '%v': program did not crash", ctx.crashDesc)
		return false, nil
	}
	Logf(2, "reproducing crash '%v': program crashed: %v", ctx.crashDesc, desc)
	return true, nil
}
Beispiel #2
0
func testImpl(inst vm.Instance, command string, timeout time.Duration) (res bool) {
	outc, errc, err := inst.Run(timeout, command)
	if err != nil {
		Fatalf("failed to run command in VM: %v", err)
	}
	desc, text, output, crashed, timedout := vm.MonitorExecution(outc, errc, false, false)
	_, _ = text, output
	if crashed || timedout {
		Logf(0, "program crashed with: %v", desc)
		return true
	}
	Logf(0, "program did not crash")
	return false
}
Beispiel #3
0
func testImpl(inst vm.Instance, command string, timeout time.Duration) (res bool) {
	outc, errc, err := inst.Run(timeout, command)
	if err != nil {
		log.Fatalf("failed to run command in VM: %v", err)
	}
	var output []byte
	for {
		select {
		case out := <-outc:
			output = append(output, out...)
			if loc := vm.CrashRe.FindIndex(output); loc != nil {
				log.Printf("program crashed with '%s'", output[loc[0]:loc[1]])
				return true
			}
		case err := <-errc:
			if err != nil {
				log.Printf("program crashed with result '%v'", err)
				return true
			}
			log.Printf("program did not crash")
			return false
		}
	}
}