From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4658FA0A02 for ; Mon, 17 May 2021 18:13:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3DD7240041; Mon, 17 May 2021 18:13:59 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by mails.dpdk.org (Postfix) with ESMTP id 7A1E5410E2 for ; Mon, 17 May 2021 18:13:57 +0200 (CEST) Received: from 2.general.paelzer.uk.vpn ([10.172.196.173] helo=Keschdeichel.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lifsO-0007zX-Fa; Mon, 17 May 2021 16:13:52 +0000 From: Christian Ehrhardt To: Thomas Monjalon Cc: Wisam Jaddo , Ori Kam , Bruce Richardson , Andrew Rybchenko , David Marchand , dpdk stable Date: Mon, 17 May 2021 18:08:31 +0200 Message-Id: <20210517161039.3132619-82-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517161039.3132619-1-christian.ehrhardt@canonical.com> References: <20210517161039.3132619-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'app: fix exit messages' has been queued to stable release 19.11.9 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/19/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/b61be794c1602384eba1c1a56d8451f5b2c6e624 Thanks. Christian Ehrhardt --- >From b61be794c1602384eba1c1a56d8451f5b2c6e624 Mon Sep 17 00:00:00 2001 From: Thomas Monjalon Date: Mon, 5 Apr 2021 21:33:23 +0200 Subject: [PATCH] app: fix exit messages [ upstream commit 487cfc24370fdb7ea843aa510d6e6d2a7212dd23 ] Some applications were printing useless messages with rte_exit() after showing the help. Using exit() is enough in this case. Some applications were using a redundant printf or fprintf() before calling rte_exit(). The messages are unified in a single rte_exit(). Some rte_exit() calls were missing a line feed or returning a wrong code. Signed-off-by: Thomas Monjalon Acked-by: Wisam Jaddo Acked-by: Ori Kam Acked-by: Bruce Richardson Acked-by: Andrew Rybchenko Acked-by: David Marchand --- app/test-compress-perf/comp_perf_options_parse.c | 2 +- app/test-crypto-perf/cperf_options_parsing.c | 2 +- app/test-pmd/parameters.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c index 12d0a6caf0..898dd310dd 100644 --- a/app/test-compress-perf/comp_perf_options_parse.c +++ b/app/test-compress-perf/comp_perf_options_parse.c @@ -598,7 +598,7 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv) switch (opt) { case 'h': usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Displayed help\n"); + exit(EXIT_SUCCESS); break; /* long options */ case 0: diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index 49b469781c..22bf9cd4d6 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -953,7 +953,7 @@ cperf_options_parse(struct cperf_options *options, int argc, char **argv) switch (opt) { case 'h': usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Displayed help\n"); + exit(EXIT_SUCCESS); break; /* long options */ case 0: diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index a1c08a411a..9ce3b4f4be 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -694,7 +694,7 @@ launch_args_parse(int argc, char** argv) case 0: /*long options */ if (!strcmp(lgopts[opt_idx].name, "help")) { usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Displayed help\n"); + exit(EXIT_SUCCESS); } #ifdef RTE_LIBRTE_CMDLINE if (!strcmp(lgopts[opt_idx].name, "interactive")) { @@ -1356,7 +1356,7 @@ launch_args_parse(int argc, char** argv) break; case 'h': usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Displayed help\n"); + exit(EXIT_SUCCESS); break; default: usage(argv[0]); -- 2.31.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-17 17:40:32.699299088 +0200 +++ 0082-app-fix-exit-messages.patch 2021-05-17 17:40:29.247810073 +0200 @@ -1 +1 @@ -From 487cfc24370fdb7ea843aa510d6e6d2a7212dd23 Mon Sep 17 00:00:00 2001 +From b61be794c1602384eba1c1a56d8451f5b2c6e624 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 487cfc24370fdb7ea843aa510d6e6d2a7212dd23 ] + @@ -21,6 +23,4 @@ - .../comp_perf_options_parse.c | 2 +- - app/test-crypto-perf/cperf_options_parsing.c | 2 +- - app/test-flow-perf/main.c | 59 +++++++++---------- - app/test-pmd/parameters.c | 4 +- - app/test-regex/main.c | 3 +- - 5 files changed, 33 insertions(+), 37 deletions(-) + app/test-compress-perf/comp_perf_options_parse.c | 2 +- + app/test-crypto-perf/cperf_options_parsing.c | 2 +- + app/test-pmd/parameters.c | 4 ++-- + 3 files changed, 4 insertions(+), 4 deletions(-) @@ -29 +29 @@ -index 04a8d2fbee..019eddb7bd 100644 +index 12d0a6caf0..898dd310dd 100644 @@ -32 +32 @@ -@@ -620,7 +620,7 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv) +@@ -598,7 +598,7 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv) @@ -42 +42 @@ -index 0466f7baf8..40b6dfb648 100644 +index 49b469781c..22bf9cd4d6 100644 @@ -45 +45 @@ -@@ -983,7 +983,7 @@ cperf_options_parse(struct cperf_options *options, int argc, char **argv) +@@ -953,7 +953,7 @@ cperf_options_parse(struct cperf_options *options, int argc, char **argv) @@ -54,186 +53,0 @@ -diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c -index 99d0463456..0aef767350 100644 ---- a/app/test-flow-perf/main.c -+++ b/app/test-flow-perf/main.c -@@ -639,7 +639,7 @@ args_parse(int argc, char **argv) - case 0: - if (strcmp(lgopts[opt_idx].name, "help") == 0) { - usage(argv[0]); -- rte_exit(EXIT_SUCCESS, "Displayed help\n"); -+ exit(EXIT_SUCCESS); - } - - if (strcmp(lgopts[opt_idx].name, "group") == 0) { -@@ -647,7 +647,7 @@ args_parse(int argc, char **argv) - if (n >= 0) - flow_group = n; - else -- rte_exit(EXIT_SUCCESS, -+ rte_exit(EXIT_FAILURE, - "flow group should be >= 0\n"); - printf("group %d / ", flow_group); - } -@@ -667,7 +667,7 @@ args_parse(int argc, char **argv) - if (n > 0) - hairpin_queues_num = n; - else -- rte_exit(EXIT_SUCCESS, -+ rte_exit(EXIT_FAILURE, - "Hairpin queues should be > 0\n"); - - flow_actions[actions_idx++] = -@@ -680,7 +680,7 @@ args_parse(int argc, char **argv) - if (n > 0) - hairpin_queues_num = n; - else -- rte_exit(EXIT_SUCCESS, -+ rte_exit(EXIT_FAILURE, - "Hairpin queues should be > 0\n"); - - flow_actions[actions_idx++] = -@@ -704,11 +704,9 @@ args_parse(int argc, char **argv) - break; - } - /* Reached last item with no match */ -- if (i == (RTE_DIM(flow_options) - 1)) { -- fprintf(stderr, "Invalid encap item: %s\n", token); -- usage(argv[0]); -- rte_exit(EXIT_SUCCESS, "Invalid encap item\n"); -- } -+ if (i == (RTE_DIM(flow_options) - 1)) -+ rte_exit(EXIT_FAILURE, -+ "Invalid encap item: %s\n", token); - } - token = strtok(NULL, ","); - } -@@ -730,11 +728,9 @@ args_parse(int argc, char **argv) - break; - } - /* Reached last item with no match */ -- if (i == (RTE_DIM(flow_options) - 1)) { -- fprintf(stderr, "Invalid decap item: %s\n", token); -- usage(argv[0]); -- rte_exit(EXIT_SUCCESS, "Invalid decap item\n"); -- } -+ if (i == (RTE_DIM(flow_options) - 1)) -+ rte_exit(EXIT_FAILURE, -+ "Invalid decap item %s\n", token); - } - token = strtok(NULL, ","); - } -@@ -747,9 +743,9 @@ args_parse(int argc, char **argv) - if (n >= DEFAULT_RULES_BATCH) - rules_batch = n; - else { -- printf("\n\nrules_batch should be >= %d\n", -+ rte_exit(EXIT_FAILURE, -+ "rules_batch should be >= %d\n", - DEFAULT_RULES_BATCH); -- rte_exit(EXIT_SUCCESS, " "); - } - } - if (strcmp(lgopts[opt_idx].name, -@@ -758,7 +754,8 @@ args_parse(int argc, char **argv) - if (n >= (int) rules_batch) - rules_count = n; - else { -- printf("\n\nrules_count should be >= %d\n", -+ rte_exit(EXIT_FAILURE, -+ "rules_count should be >= %d\n", - rules_batch); - } - } -@@ -786,23 +783,23 @@ args_parse(int argc, char **argv) - if (strcmp(lgopts[opt_idx].name, "cores") == 0) { - n = atoi(optarg); - if ((int) rte_lcore_count() <= n) { -- printf("\nError: you need %d cores to run on multi-cores\n" -+ rte_exit(EXIT_FAILURE, -+ "Error: you need %d cores to run on multi-cores\n" - "Existing cores are: %d\n", n, rte_lcore_count()); -- rte_exit(EXIT_FAILURE, " "); - } - if (n <= RTE_MAX_LCORE && n > 0) - mc_pool.cores_count = n; - else { -- printf("Error: cores count must be > 0 " -- " and < %d\n", RTE_MAX_LCORE); -- rte_exit(EXIT_FAILURE, " "); -+ rte_exit(EXIT_FAILURE, -+ "Error: cores count must be > 0 and < %d\n", -+ RTE_MAX_LCORE); - } - } - break; - default: -- fprintf(stderr, "Invalid option: %s\n", argv[optind]); - usage(argv[0]); -- rte_exit(EXIT_SUCCESS, "Invalid option\n"); -+ rte_exit(EXIT_FAILURE, "Invalid option: %s\n", -+ argv[optind]); - break; - } - } -@@ -936,7 +933,7 @@ create_meter_rule(int port_id, uint32_t counter) - printf("Port %u create meter idx(%d) error(%d) message: %s\n", - port_id, counter, error.type, - error.message ? error.message : "(no stated reason)"); -- rte_exit(EXIT_FAILURE, "error in creating meter"); -+ rte_exit(EXIT_FAILURE, "Error in creating meter\n"); - } - } - -@@ -949,7 +946,7 @@ destroy_meter_rule(int port_id, uint32_t counter) - printf("Port %u destroy meter(%d) error(%d) message: %s\n", - port_id, counter, error.type, - error.message ? error.message : "(no stated reason)"); -- rte_exit(EXIT_FAILURE, "Error in deleting meter rule"); -+ rte_exit(EXIT_FAILURE, "Error in deleting meter rule\n"); - } - } - -@@ -1097,7 +1094,7 @@ destroy_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list) - memset(&error, 0x33, sizeof(error)); - if (rte_flow_destroy(port_id, flows_list[i], &error)) { - print_flow_error(error); -- rte_exit(EXIT_FAILURE, "Error in deleting flow"); -+ rte_exit(EXIT_FAILURE, "Error in deleting flow\n"); - } - - /* -@@ -1160,7 +1157,7 @@ insert_flows(int port_id, uint8_t core_id) - flows_list = rte_zmalloc("flows_list", - (sizeof(struct rte_flow *) * rules_count_per_core) + 1, 0); - if (flows_list == NULL) -- rte_exit(EXIT_FAILURE, "No Memory available!"); -+ rte_exit(EXIT_FAILURE, "No Memory available!\n"); - - cpu_time_used = 0; - flow_index = 0; -@@ -1180,7 +1177,7 @@ insert_flows(int port_id, uint8_t core_id) - - if (flow == NULL) { - print_flow_error(error); -- rte_exit(EXIT_FAILURE, "error in creating flow"); -+ rte_exit(EXIT_FAILURE, "Error in creating flow\n"); - } - flows_list[flow_index++] = flow; - } -@@ -1199,7 +1196,7 @@ insert_flows(int port_id, uint8_t core_id) - - if (!flow) { - print_flow_error(error); -- rte_exit(EXIT_FAILURE, "error in creating flow"); -+ rte_exit(EXIT_FAILURE, "Error in creating flow\n"); - } - - flows_list[flow_index++] = flow; -@@ -1517,7 +1514,7 @@ packet_per_second_stats(void) - old = rte_zmalloc("old", - sizeof(struct lcore_info) * RTE_MAX_LCORE, 0); - if (old == NULL) -- rte_exit(EXIT_FAILURE, "No Memory available!"); -+ rte_exit(EXIT_FAILURE, "No Memory available!\n"); - - memcpy(old, lcore_infos, - sizeof(struct lcore_info) * RTE_MAX_LCORE); @@ -241 +55 @@ -index a326c8ce4f..b7d4ef76b0 100644 +index a1c08a411a..9ce3b4f4be 100644 @@ -244 +58 @@ -@@ -671,7 +671,7 @@ launch_args_parse(int argc, char** argv) +@@ -694,7 +694,7 @@ launch_args_parse(int argc, char** argv) @@ -251 +65 @@ - #ifdef RTE_LIB_CMDLINE + #ifdef RTE_LIBRTE_CMDLINE @@ -253 +67 @@ -@@ -1413,7 +1413,7 @@ launch_args_parse(int argc, char** argv) +@@ -1356,7 +1356,7 @@ launch_args_parse(int argc, char** argv) @@ -262,15 +75,0 @@ -diff --git a/app/test-regex/main.c b/app/test-regex/main.c -index 82cffaacfa..18a22db533 100644 ---- a/app/test-regex/main.c -+++ b/app/test-regex/main.c -@@ -162,9 +162,8 @@ args_parse(int argc, char **argv, char *rules_file, char *data_file, - usage("RegEx test app"); - break; - default: -- fprintf(stderr, "Invalid option: %s\n", argv[optind]); - usage("RegEx test app"); -- rte_exit(EXIT_FAILURE, "Invalid option\n"); -+ rte_exit(EXIT_FAILURE, "Invalid option: %s\n", argv[optind]); - break; - } - }