From patchwork Tue May 3 17:46:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Hrubis X-Patchwork-Id: 1625670 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=nBiTBKM7; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Q5gzenTd; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kt6nc2bRFz9sG2 for ; Wed, 4 May 2022 03:45:56 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 3DFE13CAA19 for ; Tue, 3 May 2022 19:45:54 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 3DCAD3CA94A for ; Tue, 3 May 2022 19:45:03 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id D4F95600700 for ; Tue, 3 May 2022 19:45:02 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 92DF821872; Tue, 3 May 2022 17:45:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651599902; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SmMlMt9FuzVniuKZ4bMUYl5uGry3oCLmPOjzocf6Yck=; b=nBiTBKM7sxB3uCWulbLGds9jVyemqY1NPw4beEKV1mXrOtk3k7YOp6Kx39a2YTg/4WfROK U8k8/FImzC3xN2VN8VBG5f3A+HjPBWOPojWNSF9mp07RXBOeVHPANUqSMxZWHFkoRP6Fm2 E9Yd4/BgWaKNCcSpl+xInGpmEC3SsGU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651599902; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SmMlMt9FuzVniuKZ4bMUYl5uGry3oCLmPOjzocf6Yck=; b=Q5gzenTdwSpLd1QvetV3EmaDqvIv9YfhyGzYvJkd9Sd8ZmvaHa2A5WG0FH0hzv0RSHNV55 l/zDh8fk2EDnooCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7550213ABE; Tue, 3 May 2022 17:45:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 27k3Fx5qcWLrPQAAMHmgww (envelope-from ); Tue, 03 May 2022 17:45:02 +0000 From: Cyril Hrubis To: ltp@lists.linux.it Date: Tue, 3 May 2022 19:46:52 +0200 Message-Id: <20220503174718.21205-5-chrubis@suse.cz> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220503174718.21205-1-chrubis@suse.cz> References: <20220503174718.21205-1-chrubis@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH v2 04/30] mtest01/mtest01: Convert to runtime X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: automated-testing@lists.yoctoproject.org Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Cyril Hrubis --- testcases/kernel/mem/mtest01/mtest01.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/testcases/kernel/mem/mtest01/mtest01.c b/testcases/kernel/mem/mtest01/mtest01.c index 20cb95191..2991d3d2e 100644 --- a/testcases/kernel/mem/mtest01/mtest01.c +++ b/testcases/kernel/mem/mtest01/mtest01.c @@ -41,8 +41,6 @@ #define ALLOC_THRESHOLD (6*FIVE_HUNDRED_MB) #endif -#define STOP_THRESHOLD 15 /* seconds remaining before reaching timeout */ - static pid_t *pid_list; static sig_atomic_t children_done; static int max_pids; @@ -137,6 +135,7 @@ static void child_loop_alloc(unsigned long long alloc_bytes) { unsigned long bytecount = 0; char *mem; + int runtime_rem; tst_res(TINFO, "... child %d starting", getpid()); @@ -153,12 +152,15 @@ static void child_loop_alloc(unsigned long long alloc_bytes) if (bytecount >= alloc_bytes) break; } + + runtime_rem = tst_remaining_runtime(); + if (dowrite) tst_res(TINFO, "... [t=%d] %lu bytes allocated and used in child %d", - tst_timeout_remaining(), bytecount, getpid()); + runtime_rem, bytecount, getpid()); else tst_res(TINFO, "... [t=%d] %lu bytes allocated only in child %d", - tst_timeout_remaining(), bytecount, getpid()); + runtime_rem, bytecount, getpid()); kill(getppid(), SIGRTMIN); raise(SIGSTOP); @@ -195,10 +197,9 @@ static void mem_test(void) /* wait in the loop for all children finish allocating */ while (children_done < pid_cntr) { - if (tst_timeout_remaining() < STOP_THRESHOLD) { + if (!tst_remaining_runtime()) { tst_res(TWARN, "the remaininig time is not enough for testing"); - break; } @@ -234,6 +235,7 @@ static struct tst_test test = { {"v", &verbose, "Verbose"}, {} }, + .max_iteration_runtime = 300, .setup = setup, .cleanup = cleanup, .test_all = mem_test,