* [dpdk-dev] [PATCH] test: don't break terminal settings when running tests
@ 2021-01-14 16:45 Stephen Hemminger
2021-01-14 17:01 ` Van Haaren, Harry
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2021-01-14 16:45 UTC (permalink / raw)
To: bruce.richardson, harry.van.haaren, pablo.de.lara.guarch
Cc: stable, dev, Stephen Hemminger
When running one test (via DPDK_TEST) the test program
would leave the terminal in raw mode. This was because
it was setting up cmdline to do interactive input.
The fix is to use cmdline_new() for the interactive
case.
This also fixes a memory leak because the test
runner was never calling cmdline_free().
Fixes: 9b848774a5dc ("test: use env variable to run tests")
Cc: harry.van.haaren@intel.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
revise test bugfix
---
app/test/test.c | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/app/test/test.c b/app/test/test.c
index ba0b0309b561..624dd48042f8 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -164,29 +164,38 @@ main(int argc, char **argv)
#ifdef RTE_LIB_CMDLINE
- cl = cmdline_stdin_new(main_ctx, "RTE>>");
- if (cl == NULL) {
- ret = -1;
- goto out;
- }
-
char *dpdk_test = getenv("DPDK_TEST");
if (dpdk_test && strlen(dpdk_test)) {
char buf[1024];
+
+ cl = cmdline_new(main_ctx, "RTE>>", 0, 1);
+ if (cl == NULL) {
+ ret = -1;
+ goto out;
+ }
+
snprintf(buf, sizeof(buf), "%s\n", dpdk_test);
if (cmdline_in(cl, buf, strlen(buf)) < 0) {
printf("error on cmdline input\n");
+
+ ret = -1;
+ } else {
+ ret = last_test_result;
+ }
+ cmdline_free(cl);
+ goto out;
+ } else {
+ /* if no DPDK_TEST env variable, go interactive */
+ cl = cmdline_stdin_new(main_ctx, "RTE>>");
+ if (cl == NULL) {
ret = -1;
goto out;
}
+ cmdline_interact(cl);
cmdline_stdin_exit(cl);
- ret = last_test_result;
- goto out;
+ cmdline_free(cl);
}
- /* if no DPDK_TEST env variable, go interactive */
- cmdline_interact(cl);
- cmdline_stdin_exit(cl);
#endif
ret = 0;
--
2.29.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] test: don't break terminal settings when running tests
2021-01-14 16:45 [dpdk-dev] [PATCH] test: don't break terminal settings when running tests Stephen Hemminger
@ 2021-01-14 17:01 ` Van Haaren, Harry
2021-01-17 17:45 ` Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: Van Haaren, Harry @ 2021-01-14 17:01 UTC (permalink / raw)
To: Stephen Hemminger, Richardson, Bruce, De Lara Guarch, Pablo; +Cc: stable, dev
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Thursday, January 14, 2021 4:46 PM
> To: Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren, Harry
> <harry.van.haaren@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> Cc: stable@dpdk.org; dev@dpdk.org; Stephen Hemminger
> <stephen@networkplumber.org>
> Subject: [PATCH] test: don't break terminal settings when running tests
>
> When running one test (via DPDK_TEST) the test program
> would leave the terminal in raw mode. This was because
> it was setting up cmdline to do interactive input.
>
> The fix is to use cmdline_new() for the interactive
> case.
>
> This also fixes a memory leak because the test
> runner was never calling cmdline_free().
>
> Fixes: 9b848774a5dc ("test: use env variable to run tests")
> Cc: harry.van.haaren@intel.com
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Tested-by: Harry van Haaren <harry.van.haaren@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] test: don't break terminal settings when running tests
2021-01-14 17:01 ` Van Haaren, Harry
@ 2021-01-17 17:45 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2021-01-17 17:45 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Richardson, Bruce, De Lara Guarch, Pablo, dev, stable, Van Haaren, Harry
14/01/2021 18:01, Van Haaren, Harry:
> > From: Stephen Hemminger <stephen@networkplumber.org>
> > Sent: Thursday, January 14, 2021 4:46 PM
> > To: Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren, Harry
> > <harry.van.haaren@intel.com>; De Lara Guarch, Pablo
> > <pablo.de.lara.guarch@intel.com>
> > Cc: stable@dpdk.org; dev@dpdk.org; Stephen Hemminger
> > <stephen@networkplumber.org>
> > Subject: [PATCH] test: don't break terminal settings when running tests
> >
> > When running one test (via DPDK_TEST) the test program
> > would leave the terminal in raw mode. This was because
> > it was setting up cmdline to do interactive input.
> >
> > The fix is to use cmdline_new() for the interactive
> > case.
> >
> > This also fixes a memory leak because the test
> > runner was never calling cmdline_free().
> >
> > Fixes: 9b848774a5dc ("test: use env variable to run tests")
> > Cc: harry.van.haaren@intel.com
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
>
> Tested-by: Harry van Haaren <harry.van.haaren@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-17 17:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14 16:45 [dpdk-dev] [PATCH] test: don't break terminal settings when running tests Stephen Hemminger
2021-01-14 17:01 ` Van Haaren, Harry
2021-01-17 17:45 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).