From patchwork Wed Feb 7 16:06:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1896195 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TVQ4N4bNWz23hb for ; Thu, 8 Feb 2024 03:07:32 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id ABD363CF5B6 for ; Wed, 7 Feb 2024 17:07:30 +0100 (CET) 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 [217.194.8.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 14D6A3CDEAE for ; Wed, 7 Feb 2024 17:06:36 +0100 (CET) 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=pvorel@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 40EF96096BA for ; Wed, 7 Feb 2024 17:06:34 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 5261E1F7FF; Wed, 7 Feb 2024 16:06:34 +0000 (UTC) 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 0E9E4139D8; Wed, 7 Feb 2024 16:06:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id aPHCAYqqw2WRSAAAD6G6ig (envelope-from ); Wed, 07 Feb 2024 16:06:34 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 7 Feb 2024 17:06:25 +0100 Message-ID: <20240207160628.125908-2-pvorel@suse.cz> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207160628.125908-1-pvorel@suse.cz> References: <20240207160628.125908-1-pvorel@suse.cz> MIME-Version: 1.0 X-Spam-Level: Authentication-Results: smtp-out2.suse.de; none X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Score: -4.00 X-Rspamd-Queue-Id: 5261E1F7FF X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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] [PATCH 1/4] lib/tst_tmpdir: Normalize user defined TMPDIR 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" Follow the changes to shell API 273c49793 ("tst_test.sh: Remove possible double/trailing slashes from TMPDIR") and remove: 1) trailing slash 2) double slashes. This is needed, because some tests compare file path of files which are in TMPDIR with strcmp() or and extra slashes break it (e.g. chdir01A, ioctl_loop0[12], mount0[67]). Signed-off-by: Petr Vorel --- lib/tst_tmpdir.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/tst_tmpdir.c b/lib/tst_tmpdir.c index b73b5c66f..bc9351251 100644 --- a/lib/tst_tmpdir.c +++ b/lib/tst_tmpdir.c @@ -124,7 +124,8 @@ char *tst_get_tmpdir(void) const char *tst_get_tmpdir_root(void) { - const char *env_tmpdir = getenv("TMPDIR"); + char *p, *env_tmpdir = getenv("TMPDIR"); + int fixed = 0; if (!env_tmpdir) env_tmpdir = TEMPDIR; @@ -134,6 +135,23 @@ const char *tst_get_tmpdir_root(void) "pathname for environment variable TMPDIR"); return NULL; } + + if (env_tmpdir[strlen(env_tmpdir)-1] == '/') { + env_tmpdir[strlen(env_tmpdir)-1] = '\0'; + fixed = 1; + } + + while ((p = strstr(env_tmpdir, "//")) != NULL) { + memmove(p, p + 1, strlen(env_tmpdir) - (p - env_tmpdir)); + fixed = 1; + } + + if (fixed) { + tst_resm(TINFO, "WARNING: Remove double or trailing slashes from TMPDIR," + " please fix your setup to: TMPDIR='%s'", + env_tmpdir); + } + return env_tmpdir; } From patchwork Wed Feb 7 16:06:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1896194 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TVQ456Jtyz23hb for ; Thu, 8 Feb 2024 03:07:17 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id D26423CF5B1 for ; Wed, 7 Feb 2024 17:07:15 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) (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 113253CC54A for ; Wed, 7 Feb 2024 17:06:36 +0100 (CET) Authentication-Results: in-3.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.cz (client-ip=195.135.223.130; helo=smtp-out1.suse.de; envelope-from=pvorel@suse.cz; receiver=lists.linux.it) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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-3.smtp.seeweb.it (Postfix) with ESMTPS id 3EB521BBCF00 for ; Wed, 7 Feb 2024 17:06:35 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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-out1.suse.de (Postfix) with ESMTPS id 962B82230D; Wed, 7 Feb 2024 16:06:34 +0000 (UTC) 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 5B7C713931; Wed, 7 Feb 2024 16:06:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id UFwlFYqqw2WRSAAAD6G6ig (envelope-from ); Wed, 07 Feb 2024 16:06:34 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 7 Feb 2024 17:06:26 +0100 Message-ID: <20240207160628.125908-3-pvorel@suse.cz> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207160628.125908-1-pvorel@suse.cz> References: <20240207160628.125908-1-pvorel@suse.cz> MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 962B82230D X-Spam-Level: X-Spam-Score: -4.00 X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-3.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-3.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 2/4] lib: Add test for tst_tmpdir 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" Signed-off-by: Petr Vorel --- lib/newlib_tests/runtest.sh | 2 +- lib/newlib_tests/tst_tmpdir.c | 48 +++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 lib/newlib_tests/tst_tmpdir.c diff --git a/lib/newlib_tests/runtest.sh b/lib/newlib_tests/runtest.sh index be707fe63..6c69e448d 100755 --- a/lib/newlib_tests/runtest.sh +++ b/lib/newlib_tests/runtest.sh @@ -5,7 +5,7 @@ LTP_C_API_TESTS="${LTP_C_API_TESTS:-test05 test07 test09 test15 test_runtime01 tst_needs_cmds01 tst_needs_cmds02 tst_needs_cmds03 tst_needs_cmds06 tst_needs_cmds07 tst_bool_expr test_exec test_timer tst_res_hexd tst_strstatus tst_fuzzy_sync03 test_zero_hugepage.sh test_kconfig.sh -test_children_cleanup.sh}" +test_children_cleanup.sh tst_tmpdir}" LTP_SHELL_API_TESTS="${LTP_SHELL_API_TESTS:-shell/tst_check_driver.sh shell/tst_check_kconfig0[1-5].sh shell/tst_errexit.sh shell/net/*.sh}" diff --git a/lib/newlib_tests/tst_tmpdir.c b/lib/newlib_tests/tst_tmpdir.c new file mode 100644 index 000000000..008542808 --- /dev/null +++ b/lib/newlib_tests/tst_tmpdir.c @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2024 Petr Vorel + */ + +/* + * Tests TMPDIR variable cleanup. + */ + +#include +#include "tst_defaults.h" +#include "tst_test.h" + +static struct tcase { + const char *orig; + const char *fixed; + const char *desc; +} tcases[] = { + {NULL, TEMPDIR, "default value"}, + {"/tmp/", "/tmp", "removing trailing slash"}, + {"//var///tmp", "/var/tmp", "removing duplicate slashes"}, +}; + +static void do_test(unsigned int nr) +{ + struct tcase *tc = &tcases[nr]; + const char *env_tmpdir; + + tst_res(TINFO, "Testing TMPDIR='%s' (%s)", tc->orig, tc->desc); + + if (tc->orig) + SAFE_SETENV("TMPDIR", tc->orig, 1); + + env_tmpdir = tst_get_tmpdir_root(); + + if (!env_tmpdir) + tst_brk(TBROK, "Failed to get TMPDIR"); + + if (!strcmp(tc->fixed, env_tmpdir)) + tst_res(TPASS, "TMPDIR '%s' is '%s'", env_tmpdir, tc->fixed); + else + tst_res(TFAIL, "TMPDIR '%s' should be '%s'", env_tmpdir, tc->fixed); +} + +static struct tst_test test = { + .test = do_test, + .tcnt = ARRAY_SIZE(tcases), +}; From patchwork Wed Feb 7 16:06:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1896192 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TVQ3R16kcz23hb for ; Thu, 8 Feb 2024 03:06:42 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 1D41E3CF581 for ; Wed, 7 Feb 2024 17:06:38 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) (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 C21C63CC516 for ; Wed, 7 Feb 2024 17:06:35 +0100 (CET) Authentication-Results: in-3.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=pvorel@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-3.smtp.seeweb.it (Postfix) with ESMTPS id 41BA71BBCF1F for ; Wed, 7 Feb 2024 17:06:35 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 DBD8C1FBF9; Wed, 7 Feb 2024 16:06:34 +0000 (UTC) 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 9E2C013931; Wed, 7 Feb 2024 16:06:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id oB5YJYqqw2WRSAAAD6G6ig (envelope-from ); Wed, 07 Feb 2024 16:06:34 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 7 Feb 2024 17:06:27 +0100 Message-ID: <20240207160628.125908-4-pvorel@suse.cz> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207160628.125908-1-pvorel@suse.cz> References: <20240207160628.125908-1-pvorel@suse.cz> MIME-Version: 1.0 X-Spam-Level: Authentication-Results: smtp-out2.suse.de; none X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Score: -4.00 X-Rspamd-Queue-Id: DBD8C1FBF9 X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-3.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-3.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 3/4] tst_test.sh: Print warning if slashes in $TMPDIR 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" Further improve changes in 273c49793 to print warning, because C API started to print warning as well. Previous requirement to not actually modify $TMPDIR (just to cleanup $TST_TMPDIR) required to rewrite the code). Signed-off-by: Petr Vorel --- testcases/lib/tst_test.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index 0d2fccb95..20bf21660 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -666,6 +666,7 @@ tst_run() local _tst_data local _tst_max local _tst_name + local _tst_tmpdir local _tst_pattern='[='\''"} \t\/:`$\;|].*' local ret @@ -734,12 +735,18 @@ tst_run() if [ "$TST_NEEDS_TMPDIR" = 1 ]; then if [ -z "$TMPDIR" ]; then - export TMPDIR="/tmp" + _tst_tmpdir="/tmp" + export TMPDIR="$_tst_tmpdir" + else + # remove possible double slashes or trailing slash from TMPDIR + _tst_tmpdir=$(echo "$TMPDIR" | sed 's~/\+~/~g; s~/$~~') + if [ "$_tst_tmpdir" != "$TMPDIR" ]; then + tst_res TINFO "WARNING: Remove double or trailing slashes from TMPDIR," \ + "please fix your setup to: TMPDIR='$_tst_tmpdir'" + fi fi - TST_TMPDIR=$(mktemp -d "$TMPDIR/LTP_$TST_ID.XXXXXXXXXX") - # remove possible trailing slash or double slashes from TMPDIR - TST_TMPDIR=$(echo "$TST_TMPDIR" | sed 's~/\+~/~g') + TST_TMPDIR=$(mktemp -d "$_tst_tmpdir/LTP_$TST_ID.XXXXXXXXXX") chmod 777 "$TST_TMPDIR" From patchwork Wed Feb 7 16:06:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1896196 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TVQ4h0mrTz23hb for ; Thu, 8 Feb 2024 03:07:48 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 29AC23CF5BA for ; Wed, 7 Feb 2024 17:07:46 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.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 picard.linux.it (Postfix) with ESMTPS id 964103CC54A for ; Wed, 7 Feb 2024 17:06:36 +0100 (CET) Authentication-Results: in-2.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.cz (client-ip=195.135.223.131; helo=smtp-out2.suse.de; envelope-from=pvorel@suse.cz; receiver=lists.linux.it) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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-2.smtp.seeweb.it (Postfix) with ESMTPS id B947D60072B for ; Wed, 7 Feb 2024 17:06:35 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 5BA461FBFA; Wed, 7 Feb 2024 16:06:35 +0000 (UTC) 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 E408513931; Wed, 7 Feb 2024 16:06:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id UKeLNoqqw2WRSAAAD6G6ig (envelope-from ); Wed, 07 Feb 2024 16:06:34 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 7 Feb 2024 17:06:28 +0100 Message-ID: <20240207160628.125908-5-pvorel@suse.cz> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207160628.125908-1-pvorel@suse.cz> References: <20240207160628.125908-1-pvorel@suse.cz> MIME-Version: 1.0 Authentication-Results: smtp-out2.suse.de; none X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 5BA461FBFA X-Spam-Level: X-Spam-Score: -4.00 X-Spam-Status: No, score=-0.0 required=7.0 tests=DMARC_MISSING, SPF_HELO_NONE, SPF_PASS, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-2.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-2.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 4/4] lib: Improve doc related to $TMPDIR default value 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" Link C and shell API related parts to $TMPDIR. Signed-off-by: Petr Vorel --- include/tst_defaults.h | 5 +++-- testcases/lib/tst_test.sh | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/tst_defaults.h b/include/tst_defaults.h index 083427b7e..e3eb6f587 100644 --- a/include/tst_defaults.h +++ b/include/tst_defaults.h @@ -7,9 +7,10 @@ #define TST_DEFAULTS_H_ /* - * This is the default temporary directory used by tst_tmpdir(). + * This is the default temporary directory used by tst_tmpdir(), + * used when TMPDIR env variable is not set. * - * This is used when TMPDIR env variable is not set. + * If changed, update also shell API in tst_test.sh. */ #define TEMPDIR "/tmp" diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index 20bf21660..760a49061 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -735,6 +735,8 @@ tst_run() if [ "$TST_NEEDS_TMPDIR" = 1 ]; then if [ -z "$TMPDIR" ]; then + # default value if TMPDIR not set. + # If changed, update also C API in tst_defaults.h. _tst_tmpdir="/tmp" export TMPDIR="$_tst_tmpdir" else