From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1895C48BD3 for ; Wed, 26 Jun 2019 13:46:40 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 4A82C2085A for ; Wed, 26 Jun 2019 13:46:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A82C2085A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6680120BD; Wed, 26 Jun 2019 15:46:39 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 22934F64 for ; Wed, 26 Jun 2019 15:46:36 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jun 2019 06:46:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,420,1557212400"; d="scan'208";a="172738770" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 26 Jun 2019 06:46:34 -0700 Received: from wgcvswdev001.ir.intel.com (wgcvswdev001.ir.intel.com [10.102.246.100]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id x5QDkXwq026436; Wed, 26 Jun 2019 14:46:34 +0100 Received: from wgcvswdev001.ir.intel.com (localhost [127.0.0.1]) by wgcvswdev001.ir.intel.com with ESMTP id x5QDk6Dc006865; Wed, 26 Jun 2019 14:46:06 +0100 Received: (from ppoornix@localhost) by wgcvswdev001.ir.intel.com with œ id x5QDk62T006861; Wed, 26 Jun 2019 14:46:06 +0100 From: Pallantla Poornima To: dev@dpdk.org Cc: reshma.pattan@intel.com, anatoly.burakov@intel.com, Pallantla Poornima Date: Wed, 26 Jun 2019 14:45:25 +0100 Message-Id: <1561556725-6671-1-git-send-email-pallantlax.poornima@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1560519475-9666-1-git-send-email-pallantlax.poornima@intel.com> References: <1560519475-9666-1-git-send-email-pallantlax.poornima@intel.com> Subject: [dpdk-dev] [PATCH v2] test/eal: add ut cases for in-memory and single-file-segment X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Added unit test case for eal command line 'in-memory' option which will cover below functions. get_seg_memfd() test_memfd_create() pagesz_flags() Added unit test case for eal command line 'single-file-segments' option which will cover resize_hugefile(). Signed-off-by: Pallantla Poornima Reviewed-by: Anatoly Burakov --- v2: Removed snprintf as suggested --- app/test/test_eal_flags.c | 66 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c index 9112c96d0..85f4fc64a 100644 --- a/app/test/test_eal_flags.c +++ b/app/test/test_eal_flags.c @@ -1010,6 +1010,24 @@ test_file_prefix(void) const char *argv4[] = {prgname, "-c", "1", "-n", "2", "-m", DEFAULT_MEM_SIZE, "--file-prefix=" memtest2 }; + /* primary process with inmemory mode */ + const char * const argv5[] = {prgname, "-c", "1", "-n", "2", "-m", + DEFAULT_MEM_SIZE, "--in-memory" }; + + /* primary process with memtest1 and inmemory mode */ + const char * const argv6[] = {prgname, "-c", "1", "-n", "2", "-m", + DEFAULT_MEM_SIZE, "--in-memory", + "--file-prefix=" memtest1 }; + + /* primary process with parent file-prefix and inmemory mode */ + const char * const argv7[] = {prgname, "-c", "1", "-n", "2", "-m", + DEFAULT_MEM_SIZE, "--in-memory", "--file-prefix", prefix }; + + /* primary process with memtest1 and single-file-segments mode */ + const char * const argv8[] = {prgname, "-c", "1", "-n", "2", "-m", + DEFAULT_MEM_SIZE, "--single-file-segments", + "--file-prefix=" memtest1 }; + /* check if files for current prefix are present */ if (process_hugefiles(prefix, HUGEPAGE_CHECK_EXISTS) != 1) { printf("Error - hugepage files for %s were not created!\n", prefix); @@ -1130,6 +1148,54 @@ test_file_prefix(void) return -1; } + /* this process will run in in-memory mode, so it should not leave any + * hugepage files behind. + */ + + /* test case to check eal-options with --in-memory mode */ + if (launch_proc(argv5) != 0) { + printf("Error - failed to run with in-memory mode\n"); + return -1; + } + + /*test case to check eal-options with --in-memory mode with + * custom file-prefix. + */ + if (launch_proc(argv6) != 0) { + printf("Error - failed to run with in-memory mode\n"); + return -1; + } + + /* check if hugefiles for memtest1 are present */ + if (process_hugefiles(memtest1, HUGEPAGE_CHECK_EXISTS) != 0) { + printf("Error - hugepage files for %s were created and not deleted!\n", + memtest1); + return -1; + } + + /* test case to check eal-options with --in-memory mode with + * parent file-prefix. + */ + if (launch_proc(argv7) != 0) { + printf("Error - failed to run with --file-prefix=%s\n", prefix); + return -1; + } + + /* this process will run in single file mode, so it should not leave any + * hugepage files behind. + */ + if (launch_proc(argv8) != 0) { + printf("Error - failed to run with single-file-segments mode\n"); + return -1; + } + + /* check if hugefiles for memtest1 are present */ + if (process_hugefiles(memtest1, HUGEPAGE_CHECK_EXISTS) != 0) { + printf("Error - hugepage files for %s were not deleted!\n", + memtest1); + return -1; + } + return 0; } -- 2.17.2