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 30119A0A02 for ; 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 EF0F6141281; Thu, 14 Jan 2021 17:45:43 +0100 (CET) Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by mails.dpdk.org (Postfix) with ESMTP id 5D7A114137C for ; Thu, 14 Jan 2021 17:45:43 +0100 (CET) Received: by mail-pg1-f173.google.com with SMTP id z21so4154970pgj.4 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=Al/yZWvwgem8xnSYfdzUvw6i5zx4fGcGL8WE6viPIKtd/AqCxOHwNQVb+3WSJEqpPN 78/ASJglC9/F2QyUq2ldusUCUATErZaY6CfeA06BuqTkGDGPqAki8BCGozA5eMJWFYmB CKdzlCtftP6mTlAKyLxPmmHbmUuk9+QEBfzZ6QIOOUIbFMMTOjjzjavQ1FdZ32ud3kYa R7RK668fSJ0Qi9sIY8iyDkrtaot2YQ6XgIq0UoPgpnZxM1dFFSEMyYvV+O4PS87iYdC+ I/eg0JrMyBKKkgkNhc2LWS7kCzcmLp8OZuiH+dIZJwJYKR8sY4zJ2J2PlMZqPHlu2Zep oxKw== X-Gm-Message-State: AOAM530ljc+9i7nN380pOC6SMiC9IIcQgJIjP8yZkNcr7JoCWysxSsQ8 OLqNOlMVurmqMu9ckqBfAXeFDw== 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-stable] [PATCH] test: don't break terminal settings when running tests 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" 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