{"id":2224019,"url":"http://patchwork.ozlabs.org/api/patches/2224019/?format=json","web_url":"http://patchwork.ozlabs.org/project/ltp/patch/20260416-stream_refactoring-v2-4-8321b1ec6f68@suse.com/","project":{"id":59,"url":"http://patchwork.ozlabs.org/api/projects/59/?format=json","name":"Linux Test Project development","link_name":"ltp","list_id":"ltp.lists.linux.it","list_email":"ltp@lists.linux.it","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260416-stream_refactoring-v2-4-8321b1ec6f68@suse.com>","list_archive_url":null,"date":"2026-04-16T14:33:38","name":"[v2,4/7] fs: rewrite stream02 test using new API","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"5a5316555509cb0fb4b5d255ba9d7a5c5907a3cb","submitter":{"id":83220,"url":"http://patchwork.ozlabs.org/api/people/83220/?format=json","name":"Andrea Cervesato","email":"andrea.cervesato@suse.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ltp/patch/20260416-stream_refactoring-v2-4-8321b1ec6f68@suse.com/mbox/","series":[{"id":500172,"url":"http://patchwork.ozlabs.org/api/series/500172/?format=json","web_url":"http://patchwork.ozlabs.org/project/ltp/list/?series=500172","date":"2026-04-16T14:33:35","name":"Rewrite fs stream testing suite","version":2,"mbox":"http://patchwork.ozlabs.org/series/500172/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2224019/comments/","check":"warning","checks":"http://patchwork.ozlabs.org/api/patches/2224019/checks/","tags":{},"related":[],"headers":{"Return-Path":"<ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>","X-Original-To":["incoming@patchwork.ozlabs.org","ltp@lists.linux.it"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ltp@picard.linux.it"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=t1N6xbIm;\n\tdkim=fail reason=\"signature verification failed\" header.d=suse.de\n header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519\n header.b=VoH6SDBT;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa\n header.b=t1N6xbIm;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=VoH6SDBT;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=213.254.12.146; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)","smtp-out2.suse.de;\n dkim=pass header.d=suse.de header.s=susede2_rsa header.b=t1N6xbIm;\n dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=VoH6SDBT"],"Received":["from picard.linux.it (picard.linux.it [213.254.12.146])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fxLBX6pvGz1yG9\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 00:34:44 +1000 (AEST)","from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id 5357B3E4D3E\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 16:34:42 +0200 (CEST)","from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1))\n (No client certificate requested)\n by picard.linux.it (Postfix) with ESMTPS id 606683E4AD2\n for <ltp@lists.linux.it>; Thu, 16 Apr 2026 16:33:46 +0200 (CEST)","from smtp-out2.suse.de (smtp-out2.suse.de\n [IPv6:2a07:de40:b251:101:10:150:64:2])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 900E91A0089B\n for <ltp@lists.linux.it>; Thu, 16 Apr 2026 16:33:44 +0200 (CEST)","from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org\n [IPv6:2a07:de40:b281:104:10:150:64:97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out2.suse.de (Postfix) with ESMTPS id 57C855BD0F;\n Thu, 16 Apr 2026 14:33:37 +0000 (UTC)","from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 32F45593A7;\n Thu, 16 Apr 2026 14:33:37 +0000 (UTC)","from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id CMUZCkHz4GniGQAAD6G6ig\n (envelope-from <andrea.cervesato@suse.de>); Thu, 16 Apr 2026 14:33:37 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1776350017;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=4CnfRCCEy0xhzJnHxcpUi1PKIHJKu0pjPzdQJSVV44I=;\n b=t1N6xbIm/kQW0O1o+rQCVTV8nIgxzjdY+BA7tvMxBxdknY1D9VKz0O8A70eJw4D+RlqRCa\n GPN38O/NH3ImGSros1LM1XtTCDoyKVAynVgijl1pkcbe3kpq6kASmNF8vm8Pc8dcIIJifA\n quTkYrnUIGG3BK74fKvYstAoqoUk3I8=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1776350017;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=4CnfRCCEy0xhzJnHxcpUi1PKIHJKu0pjPzdQJSVV44I=;\n b=VoH6SDBTmxh70xOFPnGpfp2IwfrkNXGqxboS7ZT1LppeLjMSvPnWN/rb0hNN5PRK34Xt26\n E0zNvkwLAHLjNgAg==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1776350017;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=4CnfRCCEy0xhzJnHxcpUi1PKIHJKu0pjPzdQJSVV44I=;\n b=t1N6xbIm/kQW0O1o+rQCVTV8nIgxzjdY+BA7tvMxBxdknY1D9VKz0O8A70eJw4D+RlqRCa\n GPN38O/NH3ImGSros1LM1XtTCDoyKVAynVgijl1pkcbe3kpq6kASmNF8vm8Pc8dcIIJifA\n quTkYrnUIGG3BK74fKvYstAoqoUk3I8=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1776350017;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=4CnfRCCEy0xhzJnHxcpUi1PKIHJKu0pjPzdQJSVV44I=;\n b=VoH6SDBTmxh70xOFPnGpfp2IwfrkNXGqxboS7ZT1LppeLjMSvPnWN/rb0hNN5PRK34Xt26\n E0zNvkwLAHLjNgAg=="],"From":"Andrea Cervesato <andrea.cervesato@suse.de>","Date":"Thu, 16 Apr 2026 16:33:38 +0200","MIME-Version":"1.0","Message-Id":"<20260416-stream_refactoring-v2-4-8321b1ec6f68@suse.com>","References":"<20260416-stream_refactoring-v2-0-8321b1ec6f68@suse.com>","In-Reply-To":"<20260416-stream_refactoring-v2-0-8321b1ec6f68@suse.com>","To":"Linux Test Project <ltp@lists.linux.it>","X-Mailer":"b4 0.14.2","X-Developer-Signature":"v=1; a=ed25519-sha256; t=1776350016; l=5091;\n i=andrea.cervesato@suse.com; s=20251210; h=from:subject:message-id;\n bh=JV6fzFwqw9xCYNqt/zP4Fs7qDZBxJdx3Jah1B+rNUT8=;\n b=4AihvCHM+jz5xjxWI4amDeWiWQ6E1rwghoI+EVBWJyVmYXQSgrl40Vk0Ia15GbFM3MF/1192V\n i6FbLrolVI4DZEJQ/j/0O/35dt5bISfWMXsCQJw2uwdJYcT/VBGDu/k","X-Developer-Key":"i=andrea.cervesato@suse.com; a=ed25519;\n pk=zKY+6GCauOiuHNZ//d8PQ/UL4jFCTKbXrzXAOQSLevI=","X-Spamd-Result":"default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n NEURAL_HAM_LONG(-1.00)[-1.000];\n R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain];\n MX_GOOD(-0.01)[]; FUZZY_RATELIMITED(0.00)[rspamd.com];\n RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+];\n ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[];\n SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[];\n DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.com:mid,suse.com:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns];\n TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]","X-Rspamd-Action":"no action","X-Spam-Score":"-4.51","X-Spam-Level":"","X-Rspamd-Server":"rspamd1.dmz-prg2.suse.org","X-Rspamd-Queue-Id":"57C855BD0F","X-Spam-Status":"No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no\n autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on in-3.smtp.seeweb.it","X-Virus-Scanned":"clamav-milter 1.0.9 at in-3.smtp.seeweb.it","X-Virus-Status":"Clean","Subject":"[LTP] [PATCH v2 4/7] fs: rewrite stream02 test using new API","X-BeenThere":"ltp@lists.linux.it","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux Test Project <ltp.lists.linux.it>","List-Unsubscribe":"<https://lists.linux.it/options/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=unsubscribe>","List-Archive":"<http://lists.linux.it/pipermail/ltp/>","List-Post":"<mailto:ltp@lists.linux.it>","List-Help":"<mailto:ltp-request@lists.linux.it?subject=help>","List-Subscribe":"<https://lists.linux.it/listinfo/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it","Sender":"\"ltp\" <ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>"},"content":"From: Andrea Cervesato <andrea.cervesato@suse.com>\n\nOld LTP API is deprecated. Convert stream02 to new tst_test.h-based\nAPI. Use TST_EXP_PASS_PTR_NULL() for fopen() calls so that a failure\nreports TFAIL instead of TBROK.\n\nSigned-off-by: Andrea Cervesato <andrea.cervesato@suse.com>\n---\n testcases/kernel/fs/stream/stream02.c | 134 ++++++++--------------------------\n 1 file changed, 30 insertions(+), 104 deletions(-)","diff":"diff --git a/testcases/kernel/fs/stream/stream02.c b/testcases/kernel/fs/stream/stream02.c\nindex 98473d86aab686eea2212c0e005a46e950f74ae8..9486ce85ac2472803ed873e0d626ac1fd759c674 100644\n--- a/testcases/kernel/fs/stream/stream02.c\n+++ b/testcases/kernel/fs/stream/stream02.c\n@@ -1,119 +1,45 @@\n+// SPDX-License-Identifier: GPL-2.0-or-later\n /*\n+ * Copyright (c) International Business Machines  Corp., 2002\n+ *\tported from SPIE section2/filesuite/stream2.c, by Airong Zhang\n  *\n- *   Copyright (c) International Business Machines  Corp., 2002\n- *\n- *   This program is free software;  you can redistribute it and/or modify\n- *   it under the terms of the GNU General Public License as published by\n- *   the Free Software Foundation; either version 2 of the License, or\n- *   (at your option) any later version.\n- *\n- *   This program is distributed in the hope that it will be useful,\n- *   but WITHOUT ANY WARRANTY;  without even the implied warranty of\n- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See\n- *   the GNU General Public License for more details.\n- *\n- *   You should have received a copy of the GNU General Public License\n- *   along with this program;  if not, write to the Free Software\n- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n+ * Copyright (c) 2026 Andrea Cervesato <andrea.cervesato@suse.com>\n  */\n-/* ported from SPIE section2/filesuite/stream2.c, by Airong Zhang */\n-\n-/*======================================================================\n-\t=================== TESTPLAN SEGMENT ===================\n->KEYS:  < fseek() mknod() fopen()\n->WHAT:  < 1)\n->HOW:   < 1)\n->BUGS:  <\n-======================================================================*/\n-\n-#include <stdio.h>\n-#include <errno.h>\n-#include <fcntl.h>\n-#include <unistd.h>\n-#include <sys/types.h>\n-#include <sys/stat.h>\n-#include \"test.h\"\n \n-char *TCID = \"stream02\";\n-int TST_TOTAL = 1;\n-int local_flag;\n+/*\\\n+ * Verify that it's possible to `fopen()` a file that has been created by\n+ * `mknod()` using different modes.\n+ */\n \n-#define PASSED 1\n-#define FAILED 0\n+#include \"tst_test.h\"\n+#include \"tst_safe_stdio.h\"\n \n-char progname[] = \"stream02()\";\n-char tempfile1[40] = \"\";\n+#define FILENAME \"ltp_file_node\"\n \n-/* XXX: add cleanup + setup. */\n+static const char *const modes[] = {\n+\t\"r+\",\n+\t\"w+\",\n+\t\"a+\",\n+};\n \n-/*--------------------------------------------------------------------*/\n-int main(int ac, char *av[])\n+static void run(void)\n {\n \tFILE *stream;\n-\tint fd;\n-\tint lc;\n-\n-\t/*\n-\t * parse standard options\n-\t */\n-\ttst_parse_opts(ac, av, NULL, NULL);\n \n-\tlocal_flag = PASSED;\n-\ttst_tmpdir();\n+\tSAFE_MKNOD(FILENAME, (S_IFIFO | 0666), 0);\n \n-\tfor (lc = 0; TEST_LOOPING(lc); lc++) {\n+\tfor (size_t i = 0; i < ARRAY_SIZE(modes); i++) {\n+\t\tTST_EXP_PASS_PTR_NULL(fopen(FILENAME, modes[i]),\n+\t\t\t\"fopen(%s, %s)\", FILENAME, modes[i]);\n \n-\t\tsprintf(tempfile1, \"stream1.%d\", getpid());\n-\t/*--------------------------------------------------------------------*/\n-\t\t//block0:\n-\t\tif (mknod(tempfile1, (S_IFIFO | 0666), 0) != 0) {\n-\t\t\ttst_resm(TFAIL, \"mknod failed in block0: %s\",\n-\t\t\t\t strerror(errno));\n-\t\t\tlocal_flag = FAILED;\n-\t\t\tgoto block1;\n-\t\t}\n-\t\tif ((stream = fopen(tempfile1, \"w+\")) == NULL) {\n-\t\t\ttst_resm(TFAIL, \"fopen(%s) w+ failed for pipe file: %s\",\n-\t\t\t\t tempfile1, strerror(errno));\n-\t\t\tlocal_flag = FAILED;\n-\t\t} else {\n-\t\t\tfclose(stream);\n-\t\t}\n-\t\tif ((stream = fopen(tempfile1, \"a+\")) == NULL) {\n-\t\t\ttst_resm(TFAIL, \"fopen(%s) a+ failed: %s\", tempfile1,\n-\t\t\t\t strerror(errno));\n-\t\t\tlocal_flag = FAILED;\n-\t\t} else {\n-\t\t\tfclose(stream);\n-\t\t\tunlink(tempfile1);\n-\t\t}\n-\t\tif (local_flag == PASSED) {\n-\t\t\ttst_resm(TPASS, \"Test passed in block0.\");\n-\t\t} else {\n-\t\t\ttst_resm(TFAIL, \"Test failed in block0.\");\n-\t\t}\n-\t\tlocal_flag = PASSED;\n+\t\tif (TST_PASS)\n+\t\t\tSAFE_FCLOSE(TST_RET_PTR);\n+\t}\n \n-\t/*--------------------------------------------------------------------*/\n-block1:\n-\t\tif ((fd = open(\"/dev/tty\", O_WRONLY)) >= 0) {\n-\t\t\tclose(fd);\n-\t\t\tif ((stream = fopen(\"/dev/tty\", \"w\")) == NULL) {\n-\t\t\t\ttst_resm(TFAIL | TERRNO,\n-\t\t\t\t\t \"fopen(/dev/tty) write failed\");\n-\t\t\t\tlocal_flag = FAILED;\n-\t\t\t} else {\n-\t\t\t\tfclose(stream);\n-\t\t\t}\n-\t\t}\n-\t\tif (local_flag == PASSED) {\n-\t\t\ttst_resm(TPASS, \"Test passed in block1.\");\n-\t\t} else {\n-\t\t\ttst_resm(TFAIL, \"Test failed in block1.\");\n-\t\t}\n-\n-\t/*--------------------------------------------------------------------*/\n-\t}\t\t\t/* end for */\n-\ttst_rmdir();\n-\ttst_exit();\n+\tSAFE_UNLINK(FILENAME);\n }\n+\n+static struct tst_test test = {\n+\t.test_all = run,\n+\t.needs_tmpdir = 1,\n+};\n","prefixes":["v2","4/7"]}