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 CA39FA0A02; Thu, 14 Jan 2021 17:45:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 214B91413B4; Thu, 14 Jan 2021 17:45:44 +0100 (CET) Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) by mails.dpdk.org (Postfix) with ESMTP id 5C568141281 for ; Thu, 14 Jan 2021 17:45:43 +0100 (CET) Received: by mail-pg1-f181.google.com with SMTP id 30so4146560pgr.6 for ; Thu, 14 Jan 2021 08:45:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LpOiSRaQKLN/ETuChUVY+gNjLkbGVbXaCVeJ+4j/+lw=; b=G/pSpPTTfgwW03W6oGF3VBY9EBluFApA4zmyQvyUMfhG5lQuunq7ka12DYwNZxOma7 Bm5NdcT3KGxMvm2BML7JtzzRfZvY17kvit5CNKmoQwsDokxHj/yzocyliGWl1P/+Wh60 XnuF7qytPavtK5omxx71OA3OqHszrBqM2F/0P6GacUhQSIgRWZU6xzuIV+3qYy+GJioc hdoWMFSuz+0+USQD0mYa3uI8rWu63R3/euSZhc3+eH3YBA70xFHdM0/aaWn44pTD2rHS NM/bVV9U5vPF9rwFl0kjk+wq5uNjzOyMAhuFW/4g0a9PPPqy7cwts3x1DtpZViBYMmtp FsQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LpOiSRaQKLN/ETuChUVY+gNjLkbGVbXaCVeJ+4j/+lw=; b=lQVxgKif2tj4jMnG/aqdpKOEPmc2Um61BKNA1NNwBIqciQyyq0QTN1RTfPQayeOMXL ynPYOjNmLLw9yNM41ySpedMUGoQAVHoMxdQp6WTF6gcGlth3Ce1InwYUy6OAFM5wrjM/ KnbNqzSwv2dE+X/cRpNfilBWWe3qSyAzFP0n2tVyG6/qoWvQtTq6+G5Yt8fdIo6+FR8j SSgRxvTg5l1OnBd1vX6904pyV5ecBjhnfEpfo19ktvjnvNJb6KkZWJwrgGJyugHo4VDB prgTxWNXzTg/ZkjaZuaab2aNErKhh4H2/Y1RWsHFY4KDBXqKUSAJOueUZW69XFgOzLb+ Q6Bg== X-Gm-Message-State: AOAM533Hfj74p+pe/QJ/tr/tZsodMxEnICnL++G98PNn6ptJpJO4UJ+r +u0IZyjMNL/cz/hVCml4PFojzQ== X-Google-Smtp-Source: ABdhPJwAPmplyCHstEsXRSyqK43tLbcvfwFXMDA4U4hioFa6tsSdbhCzXT0HJ16HGzl/iEzxvnhJSQ== X-Received: by 2002:a65:460d:: with SMTP id v13mr8260439pgq.414.1610642742389; Thu, 14 Jan 2021 08:45:42 -0800 (PST) Received: from hermes.wavecable.com (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id e138sm5692637pfh.78.2021.01.14.08.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:45:41 -0800 (PST) From: Stephen Hemminger To: bruce.richardson@intel.com, harry.van.haaren@intel.com, pablo.de.lara.guarch@intel.com Cc: stable@dpdk.org, dev@dpdk.org, Stephen Hemminger Date: Thu, 14 Jan 2021 08:45:37 -0800 Message-Id: <20210114164537.28936-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] test: don't break terminal settings when running tests X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 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