From: Simon Marchi Date: Tue, 30 Jul 2019 01:29:51 +0000 (-0400) Subject: cli: remove `convert` command's --path and --url options X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=453b777b566c7397f45689aa039f25cced5bad5b cli: remove `convert` command's --path and --url options It was decided that these two options can be removed. They are shortcuts for things that can be set using --params. The --path option, in particular, is not useful as it used to be: the de-facto standard parameter that sources are going to accept for their input data is no longer `path` (it is now `inputs`). Change-Id: I023e9cdaf319d7a9d2951315ce595ce099648391 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/1804 Tested-by: jenkins Reviewed-by: Philippe Proulx --- diff --git a/doc/man/babeltrace2-convert.1.txt b/doc/man/babeltrace2-convert.1.txt index ad196de0..62c5172a 100644 --- a/doc/man/babeltrace2-convert.1.txt +++ b/doc/man/babeltrace2-convert.1.txt @@ -197,19 +197,6 @@ opt:--params='PARAMS':: + See <> for the format of 'PARAMS'. -opt:--path='PATH':: - Set the nlparam:path initialization parameter of the current - component to 'PATH' (replace the parameter if it exists). -+ -You can use this option instead of manually specifying `path="PATH"` in -a opt:--params option to use your shell's tilde expansion (`~`). Tilde -expansion requires the tilde to be the first character of the argument, -which is not possible with `path="PATH"`. - -opt:--url='URL':: - Set the nlparam:url initialization parameter of the current - component to 'URL' (replace the parameter if it exists). - See <> for usage examples. @@ -491,14 +478,6 @@ opt:-p 'PARAMS', opt:--params='PARAMS':: component's initialization parameters, replace the parameter. See <> for the format of 'PARAMS'. -opt:-P 'PATH', opt:--path='PATH':: - Set the nlparam:path initialization parameter of the current - component to 'PATH' (replace the parameter if it exists). - -opt:-u 'URL', opt:--url='URL':: - Set the nlparam:url initialization parameter of the current - component to 'URL' (replace the parameter if it exists). - Legacy options to create implicit components ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/cli/babeltrace2-cfg-cli-args.c b/src/cli/babeltrace2-cfg-cli-args.c index 617bd51a..2ff5f961 100644 --- a/src/cli/babeltrace2-cfg-cli-args.c +++ b/src/cli/babeltrace2-cfg-cli-args.c @@ -889,7 +889,6 @@ enum { OPT_OUTPUT, OPT_OUTPUT_FORMAT, OPT_PARAMS, - OPT_PATH, OPT_PLUGIN_PATH, OPT_RESET_BASE_PARAMS, OPT_RETRY_DURATION, @@ -897,7 +896,6 @@ enum { OPT_RUN_ARGS_0, OPT_STREAM_INTERSECTION, OPT_TIMERANGE, - OPT_URL, OPT_VERBOSE, OPT_VERSION, }; @@ -2361,8 +2359,6 @@ void print_convert_usage(FILE *fp) fprintf(fp, " -p, --params=PARAMS Add initialization parameters PARAMS to the\n"); fprintf(fp, " current component (see the expected format\n"); fprintf(fp, " of PARAMS below)\n"); - fprintf(fp, " -P, --path=PATH Set the `path` string parameter of the\n"); - fprintf(fp, " current component to PATH\n"); fprintf(fp, " --plugin-path=PATH[:PATH]... Add PATH to the list of paths from which\n"); fprintf(fp, " dynamic plugins can be loaded\n"); fprintf(fp, " --retry-duration=DUR When babeltrace2(1) needs to retry to run\n"); @@ -2377,8 +2373,6 @@ void print_convert_usage(FILE *fp) fprintf(fp, " formatted for `xargs -0`, and quit\n"); fprintf(fp, " --stream-intersection Only process events when all streams\n"); fprintf(fp, " are active\n"); - fprintf(fp, " -u, --url=URL Set the `url` string parameter of the\n"); - fprintf(fp, " current component to URL\n"); fprintf(fp, " -h, --help Show this help and quit\n"); fprintf(fp, "\n"); fprintf(fp, "Implicit `source.ctf.fs` component options:\n"); @@ -2503,14 +2497,12 @@ const struct bt_argpar_opt_descr convert_options[] = { { OPT_OUTPUT, 'w', "output", true }, { OPT_OUTPUT_FORMAT, 'o', "output-format", true }, { OPT_PARAMS, 'p', "params", true }, - { OPT_PATH, 'P', "path", true }, { OPT_PLUGIN_PATH, '\0', "plugin-path", true }, { OPT_RETRY_DURATION, '\0', "retry-duration", true }, { OPT_RUN_ARGS, '\0', "run-args", false }, { OPT_RUN_ARGS_0, '\0', "run-args-0", false }, { OPT_STREAM_INTERSECTION, '\0', "stream-intersection", false }, { OPT_TIMERANGE, '\0', "timerange", true }, - { OPT_URL, 'u', "url", true }, { OPT_VERBOSE, 'v', "verbose", false }, BT_ARGPAR_OPT_DESCR_SENTINEL }; @@ -3518,10 +3510,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[], * First pass: collect all arguments which need to be passed * as is to the run command. This pass can also add --name * arguments if needed to automatically name unnamed component - * instances. Also it does the following transformations: - * - * --path=PATH -> --params=path="PATH" - * --url=URL -> --params=url="URL" + * instances. * * Also it appends the plugin paths of --plugin-path to * `plugin_paths`. @@ -3644,29 +3633,6 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[], goto error; } break; - case OPT_PATH: - if (cur_name_prefix->len == 0) { - BT_CLI_LOGE_APPEND_CAUSE("No current component of which to set `path` parameter:\n %s", - arg); - goto error; - } - - if (append_string_parameter_to_args(run_args, "path", arg)) { - goto error; - } - break; - case OPT_URL: - if (cur_name_prefix->len == 0) { - BT_CLI_LOGE_APPEND_CAUSE("No current component of which to set `url` parameter:\n %s", - arg); - goto error; - } - - - if (append_string_parameter_to_args(run_args, "url", arg)) { - goto error; - } - break; case OPT_NAME: if (cur_name_prefix->len == 0) { BT_CLI_LOGE_APPEND_CAUSE("No current component to name:\n %s", diff --git a/tests/cli/test_convert_args b/tests/cli/test_convert_args index 0afe79ad..85d8465b 100755 --- a/tests/cli/test_convert_args +++ b/tests/cli/test_convert_args @@ -90,14 +90,12 @@ if [ "$BT_OS_TYPE" = "mingw" ]; then output_path=$(cygpath -m "$output_path") fi -plan_tests 77 +plan_tests 73 test_bt_convert_run_args 'path leftover' "$path_to_trace" "--component source.ctf.fs --name auto-disc-source-ctf-fs --params 'inputs=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty" test_bt_convert_run_args 'path leftovers' "$path_to_trace $path_to_trace2" "--component source.ctf.fs --name auto-disc-source-ctf-fs --params 'inputs=[\"$path_to_trace\", \"${path_to_trace2}\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty" test_bt_convert_run_args 'path leftover + named user source with --params' "$path_to_trace --component ZZ:source.another.source --params salut=yes" "--component ZZ:source.another.source --params salut=yes --component source.ctf.fs --name auto-disc-source-ctf-fs --params 'inputs=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect ZZ:muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty" test_bt_convert_run_args 'path leftover + named user source with --name --params' "$path_to_trace --component source.another.source --name HELLO --params salut=yes" "--component source.another.source --name HELLO --params salut=yes --component source.ctf.fs --name auto-disc-source-ctf-fs --params 'inputs=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect HELLO:muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty" -test_bt_convert_run_args 'path leftover + user source with --path --params' "$path_to_trace --component source.another.source --path some-path --params salut=yes" "--component source.another.source --params 'path=\"some-path\"' --params salut=yes --name source.another.source --component source.ctf.fs --name auto-disc-source-ctf-fs --params 'inputs=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 'source\\.another\\.source:muxer' --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty" -test_bt_convert_run_args 'user source with --url + -o dummy' '--component MY:source.my.source --url the-url -o dummy' "--component MY:source.my.source --params 'url=\"the-url\"' --component sink.utils.dummy --name dummy --component filter.utils.muxer --name muxer --connect MY:muxer --connect muxer:dummy" test_bt_convert_run_args 'path leftover + --omit-home-plugin-path' "$path_to_trace --omit-home-plugin-path" "--omit-home-plugin-path --component source.ctf.fs --name auto-disc-source-ctf-fs --params 'inputs=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty" test_bt_convert_run_args 'path leftover + --omit-system-plugin-path' "$path_to_trace --omit-system-plugin-path" "--omit-system-plugin-path --component source.ctf.fs --name auto-disc-source-ctf-fs --params 'inputs=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty" test_bt_convert_run_args 'path leftover + --plugin-path' "--plugin-path=PATH1:PATH2 $path_to_trace" "--plugin-path PATH1:PATH2 --component source.ctf.fs --name auto-disc-source-ctf-fs --params 'inputs=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty" @@ -145,8 +143,6 @@ test_bt_convert_fails 'bad --component format (extra dot found)' '--component na test_bt_convert_fails 'duplicate component name' '--component hello:sink.a.b --component hello:source.c.d' test_bt_convert_fails 'unknown option' '--component hello:sink.a.b --salut' test_bt_convert_fails '--params without current component' '--params lol=23' -test_bt_convert_fails '--path without current component' "--path $path_to_trace" -test_bt_convert_fails '--url without current component' '--url net://some-host/host/target/session' test_bt_convert_fails '--nane without current component' '--name chapeau' test_bt_convert_fails 'duplicate --begin' '--begin abc --clock-seconds --begin cde' test_bt_convert_fails 'duplicate --end' '--begin abc --end xyz --clock-seconds --end cde' diff --git a/tests/cli/test_trace_copy b/tests/cli/test_trace_copy index 8b4a46d4..90dce380 100755 --- a/tests/cli/test_trace_copy +++ b/tests/cli/test_trace_copy @@ -73,7 +73,7 @@ for path in "${SUCCESS_TRACES[@]}"; do fi fi - "${BT_TESTS_BT2_BIN}" "${path}" --component sink.ctf.fs --path "${out_path}" >/dev/null 2>&1 + "${BT_TESTS_BT2_BIN}" "${path}" --component sink.ctf.fs "--params=path=\"${out_path}\"" >/dev/null 2>&1 ok $? "Copy trace ${trace} with ctf-fs sink" "${BT_TESTS_BT2_BIN}" "${out_path}" >/dev/null 2>&1