Example #1
0
func main() {
	fs := flag.NewFlagSet("fuzzlr", flag.ExitOnError)
	master := fs.String("master", "localhost:5050", "Location of leading Mesos master")
	shutdownTimeout := fs.Duration("shutdown.timeout", 10*time.Second, "Shutdown timeout")

	fs.Parse(os.Args[1:])

	sched := scheduler.New()
	driver, err := scheduler.NewDriver(*master, sched)
	if err != nil {
		log.Printf("Unable to create scheduler driver: %s", err)
		return
	}

	go func() {
		sigch := make(chan os.Signal, 1)
		signal.Notify(sigch, os.Interrupt, os.Kill)
		if s := <-sigch; s != os.Interrupt {
			return
		}
		log.Println("Fuzzlr is shutting down")
		if err := sched.Shutdown(*shutdownTimeout); err != nil {
			log.Print(err)
		}
		driver.Stop(false)
	}()

	if status, err := driver.Run(); err != nil {
		log.Printf("Framework stopped with status %s and error: %s", status, err)
	}

	log.Println("Exiting...")
}
Example #2
0
func main() {
	fs := flag.NewFlagSet("fuzzlr", flag.ExitOnError)
	master := fs.String("master", "localhost:5050", "Location of leading Mesos master.")
	servingPath := fs.String("binpath", "./bin/", "Directory where go-fuzz binaries are located.")
	bin := fs.String("bin", "./fuzz.zip", "Archive generated by go-fuzz-build.")
	corpus := fs.String("corpus", "./corpus.zip", "Corpus zip archive to seed the fuzzing with.")
	artifactPort := fs.Int("artifactPort", 12300, "Binding port for artifact server")
	address := fs.String("address", "127.0.0.1", "Binding address for artifact server")
	shutdownTimeout := fs.Duration("shutdown.timeout", 10*time.Second, "Shutdown timeout")

	fs.Parse(os.Args[1:])

	binpaths, err := filepath.Glob(*servingPath)
	if err != nil {
		log.Printf("Unable to read files from provided serving path %s: %v", *servingPath, err)
		return
	}
	commandInfos := []*mesos.CommandInfo_URI{}
	uris := []string{}
	for _, path := range binpaths {
		uri := serving.ServeExecutorArtifact(path, *address, *artifactPort)
		commandInfos = append(commandInfos, &mesos.CommandInfo_URI{
			Value:      uri,
			Executable: proto.Bool(true),
		})
		uris = append(uris, *uri)
	}
	go http.ListenAndServe(fmt.Sprintf("%s:%d", *address, *artifactPort), nil)
	log.Printf("Serving executor artifacts...")

	sched := scheduler.New(*bin, *corpus, uris...)
	driver, err := scheduler.NewDriver(*master, sched)
	if err != nil {
		log.Printf("Unable to create scheduler driver: %s", err)
		return
	}

	go func() {
		sigch := make(chan os.Signal, 1)
		signal.Notify(sigch, os.Interrupt, os.Kill)
		if s := <-sigch; s != os.Interrupt {
			return
		}
		log.Println("Fuzzlr is shutting down")
		if err := sched.Shutdown(*shutdownTimeout); err != nil {
			log.Print(err)
		}
		driver.Stop(false)
	}()

	if status, err := driver.Run(); err != nil {
		log.Printf("Framework stopped with status %s and error: %s", status, err)
	}

	log.Println("Exiting...")
}