From patchwork Tue Jul 16 15:36:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Hrubis X-Patchwork-Id: 1961133 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=MI4DPJKb; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=N9zQmuaO; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=orFozwKN; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=K9ME+DKg; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WNjlV037bz1xqc for ; Wed, 17 Jul 2024 01:33:41 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 3C4F83D1A81 for ; Tue, 16 Jul 2024 17:33:38 +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 (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 214613D199A for ; Tue, 16 Jul 2024 17:33:35 +0200 (CEST) Authentication-Results: in-5.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.cz (client-ip=2a07:de40:b251:101:10:150:64:2; helo=smtp-out2.suse.de; envelope-from=chrubis@suse.cz; 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-5.smtp.seeweb.it (Postfix) with ESMTPS id 7F40C609A58 for ; Tue, 16 Jul 2024 17:33:34 +0200 (CEST) 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 F21011F8C2 for ; Tue, 16 Jul 2024 15:33:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1721144012; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=OqxNtFkayMGPr5UVor3jNkAnmRAVuZ1ZmMePtsxnb3s=; b=MI4DPJKblomNOLfnnx+PODaR1JIowZi0yRehZNAbAnYn9C4vs6QV3tJ6rB7Ggw3TwBOueO oNS+xLDgj2N1HUGKtjEjHNXSNaXcYZEmNU/mzMp8mOHVXKxCRDK5I6mb4NJV3ys41T8++H aArjUAvnKYmzvgC+uhoC0A3tBaxkpGw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1721144012; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=OqxNtFkayMGPr5UVor3jNkAnmRAVuZ1ZmMePtsxnb3s=; b=N9zQmuaOO8I63AVsn3lFRK3GCK/Zt/lu8JMCcv04qfU3LOE2RdaUIpndXUk22XK6bt6P9T Npg1nmAodiFyDOBw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1721144011; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=OqxNtFkayMGPr5UVor3jNkAnmRAVuZ1ZmMePtsxnb3s=; b=orFozwKNTjRqqVCvYdafTp8xM6D537q8cr8/ylgwvv+pBfzz3UfxoJ/roQNSmpitxsf1Pw Ak45e/moHZYL4gAIPwhIhiBIQp057F7qjny3pD5mlWrrVUJGt67ELIRNAxxytT0NKzjouk tptBIRm91VBRESIKGNe5S9tKhVqFzfs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1721144011; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=OqxNtFkayMGPr5UVor3jNkAnmRAVuZ1ZmMePtsxnb3s=; b=K9ME+DKgzWIm/FDCBxBV7kaVAB7lwNKrPLw/Z3nravi/7OhVHW5o3J5kQjL8G3vGVQHPXb nqk/jrTHejkyjuAg== 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 DEE7513795 for ; Tue, 16 Jul 2024 15:33:30 +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 kk+ZNcqSlmakFAAAD6G6ig (envelope-from ) for ; Tue, 16 Jul 2024 15:33:30 +0000 From: Cyril Hrubis To: ltp@lists.linux.it Date: Tue, 16 Jul 2024 17:36:02 +0200 Message-ID: <20240716153604.22984-1-chrubis@suse.cz> X-Mailer: git-send-email 2.44.2 MIME-Version: 1.0 X-Spam-Score: 1.20 X-Spamd-Result: default: False [1.20 / 50.00]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.997]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[] 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 shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-5.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-5.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [RFC PATCH 0/2] Shell test library v3 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" We have discussed shell and C integration during our LTP montly meeting. I started to dig around after to see how complicated would that task be and it turns out that it's fairly easy. This patchset implements a proof of a concept for two things: - seamless integration of shell with C code - second patch builds on top of that and implements a shell loader that can run shell tests from within the C test library Cyril Hrubis (2): Add support for mixing C and shell code testcaes/lib: Add shell loader include/tst_test.h | 38 +++++++++ lib/tst_test.c | 51 ++++++++++++ testcases/lib/.gitignore | 2 + testcases/lib/Makefile | 5 +- testcases/lib/run_tests.sh | 12 +++ testcases/lib/tests/.gitignore | 6 ++ testcases/lib/tests/Makefile | 11 +++ testcases/lib/tests/shell_loader.sh | 12 +++ .../lib/tests/shell_loader_all_filesystems.sh | 22 ++++++ testcases/lib/tests/shell_test01.c | 17 ++++ testcases/lib/tests/shell_test02.c | 18 +++++ testcases/lib/tests/shell_test03.c | 25 ++++++ testcases/lib/tests/shell_test04.c | 18 +++++ testcases/lib/tests/shell_test05.c | 27 +++++++ testcases/lib/tests/shell_test06.c | 16 ++++ testcases/lib/tests/shell_test_brk.sh | 6 ++ testcases/lib/tests/shell_test_check_argv.sh | 25 ++++++ testcases/lib/tests/shell_test_checkpoint.sh | 7 ++ testcases/lib/tests/shell_test_pass.sh | 6 ++ testcases/lib/tst_env.sh | 16 ++++ testcases/lib/tst_res_.c | 58 ++++++++++++++ testcases/lib/tst_run_shell.c | 78 +++++++++++++++++++ 22 files changed, 474 insertions(+), 2 deletions(-) create mode 100755 testcases/lib/run_tests.sh create mode 100644 testcases/lib/tests/.gitignore create mode 100644 testcases/lib/tests/Makefile create mode 100755 testcases/lib/tests/shell_loader.sh create mode 100755 testcases/lib/tests/shell_loader_all_filesystems.sh create mode 100644 testcases/lib/tests/shell_test01.c create mode 100644 testcases/lib/tests/shell_test02.c create mode 100644 testcases/lib/tests/shell_test03.c create mode 100644 testcases/lib/tests/shell_test04.c create mode 100644 testcases/lib/tests/shell_test05.c create mode 100644 testcases/lib/tests/shell_test06.c create mode 100755 testcases/lib/tests/shell_test_brk.sh create mode 100755 testcases/lib/tests/shell_test_check_argv.sh create mode 100755 testcases/lib/tests/shell_test_checkpoint.sh create mode 100755 testcases/lib/tests/shell_test_pass.sh create mode 100644 testcases/lib/tst_env.sh create mode 100644 testcases/lib/tst_res_.c create mode 100644 testcases/lib/tst_run_shell.c