It effectively shows what the equivelant command line string would be.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
--version Print version info and exit
--help Print this page
--cmdhelp=cmd Print command help, "all" for all of them
--version Print version info and exit
--help Print this page
--cmdhelp=cmd Print command help, "all" for all of them
+ --showcmd Turn a job file into command line options
Any parameters following the options will be assumed to be job files,
unless they match a job file parameter. You can add as many as you want,
Any parameters following the options will be assumed to be job files,
unless they match a job file parameter. You can add as many as you want,
static char **ini_file;
static int max_jobs = MAX_JOBS;
static char **ini_file;
static int max_jobs = MAX_JOBS;
+static int dump_cmdline;
struct thread_data def_thread;
struct thread_data *threads = NULL;
struct thread_data def_thread;
struct thread_data *threads = NULL;
.has_arg = optional_argument,
.val = 'c',
},
.has_arg = optional_argument,
.val = 'c',
},
+ {
+ .name = "showcmd",
+ .has_arg = no_argument,
+ .val = 's'
+ },
if (td == &def_thread)
return 0;
if (td == &def_thread)
return 0;
+ /*
+ * if we are just dumping the output command line, don't add the job
+ */
+ if (dump_cmdline) {
+ put_job(td);
+ return 0;
+ }
+
engine = get_engine_name(td->o.ioengine);
td->io_ops = load_ioengine(td, engine);
if (!td->io_ops) {
engine = get_engine_name(td->o.ioengine);
td->io_ops = load_ioengine(td, engine);
if (!td->io_ops) {
name[strlen(name) - 1] = '\0';
name[strlen(name) - 1] = '\0';
+ if (dump_cmdline) {
+ log_info("fio ");
+ if (!global)
+ log_info("--name=%s ", name);
+ }
+
td = get_new_job(global, &def_thread);
if (!td) {
ret = 1;
td = get_new_job(global, &def_thread);
if (!td) {
ret = 1;
* easier on the user.
*/
ret |= fio_option_parse(td, p);
* easier on the user.
*/
ret |= fio_option_parse(td, p);
+ if (!ret && dump_cmdline)
+ log_info("--%s ", p);
+ if (dump_cmdline)
+ log_info("\n");
+
free(string);
free(name);
fclose(f);
free(string);
free(name);
fclose(f);
printf("\t--version\tPrint version info and exit\n");
printf("\t--help\t\tPrint this page\n");
printf("\t--cmdhelp=cmd\tPrint command help, \"all\" for all of them\n");
printf("\t--version\tPrint version info and exit\n");
printf("\t--help\t\tPrint this page\n");
printf("\t--cmdhelp=cmd\tPrint command help, \"all\" for all of them\n");
+ printf("\t--showcmd\tTurn a job file into command line options\n");
}
static int parse_cmd_line(int argc, char *argv[])
}
static int parse_cmd_line(int argc, char *argv[])
exit(0);
case 'c':
exit(fio_show_option_help(optarg));
exit(0);
case 'c':
exit(fio_show_option_help(optarg));
+ case 's':
+ dump_cmdline = 1;
+ break;
case 'v':
printf("%s\n", fio_version_string);
exit(0);
case 'v':
printf("%s\n", fio_version_string);
exit(0);
options_mem_free(&def_thread);
if (!thread_number) {
options_mem_free(&def_thread);
if (!thread_number) {
+ if (dump_cmdline)
+ return 0;
+
log_err("No jobs defined(s)\n");
return 1;
}
log_err("No jobs defined(s)\n");
return 1;
}