Esempio n. 1
0
func (r Fio2GNUPlotRunner) runPlotWithPattern(pattern string) error {
	var cmdArguments []string

	cmdArguments = append(cmdArguments, "-p")
	cmdArguments = append(cmdArguments, pattern)
	cmdArguments = append(cmdArguments, "-g")

	return errgo.Mask(exec.RunCommand("fio2gnuplot", cmdArguments, r.conf.LogsDirectory))
}
Esempio n. 2
0
func (r FioRunner) RunTest(test string) (string, error) {
	var cmdArguments []string

	if r.conf.WorkingDirectory != "" {
		cmdArguments = append(cmdArguments, "--directory="+r.conf.WorkingDirectory)
	}

	if r.conf.GenerateBandwithLogs {
		cmdArguments = append(cmdArguments, fmt.Sprintf("--write_bw_log=%s/%s", r.conf.LogsDirectory, r.conf.LogsPrefix))
	}

	if r.conf.GenerateIOPSLogs {
		cmdArguments = append(cmdArguments, fmt.Sprintf("--write_iops_log=%s/%s", r.conf.LogsDirectory, r.conf.LogsPrefix))
	}

	if r.conf.GenerateLatencyLogs {
		cmdArguments = append(cmdArguments, fmt.Sprintf("--write_lat_log=%s/%s", r.conf.LogsDirectory, r.conf.LogsPrefix))
	}

	cmdArguments = append(cmdArguments, fmt.Sprintf("--output=%s/%s", r.conf.LogsDirectory, r.conf.OutputFilename))

	testfilePath := fmt.Sprintf("%s/%s", r.conf.JobDirectory, test)
	cmdArguments = append(cmdArguments, testfilePath)

	if err := r.createWorkingDirectory(); err != nil {
		return "", errgo.Mask(err)
	}

	runErr := exec.RunCommand("fio", cmdArguments, "")

	if err := r.removeWorkingDirectory(); err != nil {
		return "", errgo.Mask(err)
	}

	if runErr != nil {
		return "", errgo.Mask(runErr)
	}

	output, err := r.getOutputLog()

	if err != nil {
		return "", errgo.Mask(err)
	}

	return output, nil
}