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 Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7DD8CE77182 for ; Wed, 11 Dec 2024 12:23:13 +0000 (UTC) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 1BF1B3E890A for ; Wed, 11 Dec 2024 13:23:12 +0100 (CET) Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id E30AE3E88F5 for ; Wed, 11 Dec 2024 13:20:29 +0100 (CET) Authentication-Results: in-4.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=2a07:de40:b251:101:10:150:64:2; helo=smtp-out2.suse.de; envelope-from=andrea.cervesato@suse.de; receiver=lists.linux.it) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) (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-4.smtp.seeweb.it (Postfix) with ESMTPS id 38B9D100BA64 for ; Wed, 11 Dec 2024 13:20:29 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id DEB6F1F74A for ; Wed, 11 Dec 2024 12:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1733919626; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fn31eTE0G3TjWjqpZnxlaXUlE9ERe+88q2FdEd3GWKg=; b=hOsgwZiI2BgPYFev837m6NaNSM2Y1VztaRAcqeRLJfIB9QOekEprb5lcvm+xH5QeuIZAZ+ KIYOOvmZTGgH7i8T9txUwVAX6rDTDlqPYlMSwHXiyIa9QHAQJ7KVLV+L5px49kjbm2+CYM RJ3Vb9i73esHgn1x/G+9EdW7XDXDa00= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1733919626; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fn31eTE0G3TjWjqpZnxlaXUlE9ERe+88q2FdEd3GWKg=; b=UmA0JbzTc1yTxMTtANiP2sl/jVrj0eN5gEKbZMBYtPYdofKnLBEc7v8bVd/6uNY1/n1Cxw ShffokJgJu9/mMDQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1733919626; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fn31eTE0G3TjWjqpZnxlaXUlE9ERe+88q2FdEd3GWKg=; b=hOsgwZiI2BgPYFev837m6NaNSM2Y1VztaRAcqeRLJfIB9QOekEprb5lcvm+xH5QeuIZAZ+ KIYOOvmZTGgH7i8T9txUwVAX6rDTDlqPYlMSwHXiyIa9QHAQJ7KVLV+L5px49kjbm2+CYM RJ3Vb9i73esHgn1x/G+9EdW7XDXDa00= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1733919626; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fn31eTE0G3TjWjqpZnxlaXUlE9ERe+88q2FdEd3GWKg=; b=UmA0JbzTc1yTxMTtANiP2sl/jVrj0eN5gEKbZMBYtPYdofKnLBEc7v8bVd/6uNY1/n1Cxw ShffokJgJu9/mMDQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id CE61F13AD4 for ; Wed, 11 Dec 2024 12:20:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id sEoeMoqDWWdNAwAAD6G6ig (envelope-from ) for ; Wed, 11 Dec 2024 12:20:26 +0000 From: Andrea Cervesato Date: Wed, 11 Dec 2024 13:20:28 +0100 MIME-Version: 1.0 Message-Id: <20241211-fix_setsid_tests-v1-5-e103f36c6462@suse.com> References: <20241211-fix_setsid_tests-v1-0-e103f36c6462@suse.com> In-Reply-To: <20241211-fix_setsid_tests-v1-0-e103f36c6462@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733919626; l=2700; i=andrea.cervesato@suse.com; s=20240812; h=from:subject:message-id; bh=7yU30Gz510cpPLJcm0dh86l7z7mYvF6gUD+gyqisKJc=; b=rTN/9xbqciI3i9MnyopJnDe6lSrVUGt4Bhf7wQx6bkQ2zgccjlrjAPYKQLCnew1nsCNOXEqg1 1OMgW9bj3yYClBiCci96KEtuhouX6+luYDm9FFR2JvxRaBnyEEpYdeZ X-Developer-Key: i=andrea.cervesato@suse.com; a=ed25519; pk=RG/nLJ5snb1tLKGwSORQXBJ5XA4juT0WF2Pc/lq9meo= X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:mid,suse.com:email] X-Virus-Scanned: clamav-milter 1.0.3 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 05/10] Add ptem04 test 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ltp-bounces+ltp=archiver.kernel.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato Verify that it's possible to open a pseudo-terminal via /dev/ptmx, obtain a slave device and to check if it's possible to open it multiple times. Signed-off-by: Andrea Cervesato --- runtest/pty | 1 + testcases/kernel/pty/.gitignore | 1 + testcases/kernel/pty/ptem04.c | 57 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) diff --git a/runtest/pty b/runtest/pty index 329cc84cdc107ab8e814fea72a8088ea62d5ad25..63d927eca07aa3dbd312d5c5cc6b6681dbf3627d 100644 --- a/runtest/pty +++ b/runtest/pty @@ -9,5 +9,6 @@ pty07 pty07 ptem01 ptem01 ptem02 ptem02 ptem03 ptem03 +ptem04 ptem04 hangup01 hangup01 diff --git a/testcases/kernel/pty/.gitignore b/testcases/kernel/pty/.gitignore index 61fec1ddae3ea39d20e97123e34888708050c25c..c9bb33664f9de55038f4638406841f403f1a86c4 100644 --- a/testcases/kernel/pty/.gitignore +++ b/testcases/kernel/pty/.gitignore @@ -2,6 +2,7 @@ /ptem01 /ptem02 /ptem03 +/ptem04 /pty01 /pty02 /pty03 diff --git a/testcases/kernel/pty/ptem04.c b/testcases/kernel/pty/ptem04.c new file mode 100644 index 0000000000000000000000000000000000000000..ff91616db9d0d54b0a40477867ce30fff24cae00 --- /dev/null +++ b/testcases/kernel/pty/ptem04.c @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) International Business Machines Corp., 2002 + * Copyright (c) 2020 Petr Vorel + * Copyright (C) 2024 SUSE LLC Andrea Cervesato + */ + +/*\ + * [Description] + * + * Verify that it's possible to open a pseudo-terminal via /dev/ptmx, obtain a + * slave device and to check if it's possible to open it multiple times. + */ + +#define _GNU_SOURCE + +#include "tst_test.h" + +#define MASTERCLONE "/dev/ptmx" +#define NUM_SLAVES 10 + +static void run(void) +{ + int masterfd; + int slavefd[NUM_SLAVES]; + char *slavename; + + masterfd = SAFE_OPEN(MASTERCLONE, O_RDWR); + + slavename = ptsname(masterfd); + if (slavename == NULL) + tst_res(TFAIL, "Can't get slave device location"); + else + tst_res(TPASS, "pts device location is %s", slavename); + + TST_EXP_PASS(grantpt(masterfd)); + TST_EXP_PASS(unlockpt(masterfd)); + + for (int i = 0; i < NUM_SLAVES; i++) + slavefd[i] = TST_EXP_FD(open(slavename, O_RDWR)); + + for (int i = 0; i < NUM_SLAVES; i++) + SAFE_CLOSE(slavefd[i]); + + SAFE_CLOSE(masterfd); +} + +static void setup(void) +{ + if (access(MASTERCLONE, F_OK)) + tst_brk(TBROK, "%s device doesn't exist", MASTERCLONE); +} + +static struct tst_test test = { + .test_all = run, + .setup = setup, +}; -- 2.43.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp