netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Haller <thaller@redhat.com>
To: NetFilter <netfilter-devel@vger.kernel.org>
Cc: Thomas Haller <thaller@redhat.com>
Subject: [PATCH nft 1/3] tests/shell: set C locale in "run-tests.sh"
Date: Mon, 18 Sep 2023 20:45:19 +0200	[thread overview]
Message-ID: <20230918184634.3471832-2-thaller@redhat.com> (raw)
In-Reply-To: <20230918184634.3471832-1-thaller@redhat.com>

The tests should run always the same, regardless of the user's language
settings. Set LANG=C and LC_ALL=C and unset LANGUAGE. If some part wants
to test a different language, it would set it explicitly. They anyway
wouldn't want to depend on something from the user's environment.

Signed-off-by: Thomas Haller <thaller@redhat.com>
---
 tests/shell/run-tests.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh
index 528646f57eca..79c818cb0f11 100755
--- a/tests/shell/run-tests.sh
+++ b/tests/shell/run-tests.sh
@@ -1,5 +1,9 @@
 #!/bin/bash
 
+unset LANGUAGE
+export LANG=C
+export LC_ALL=C
+
 GREEN=""
 YELLOW=""
 RED=""
@@ -235,7 +239,7 @@ for file in "${F[@]}"; do
 		msg_warn "Ignore feature file \"$file\""
 	fi
 done
-_HAVE_OPTS=( $(printf '%s\n' "${_HAVE_OPTS[@]}" | LANG=C sort) )
+_HAVE_OPTS=( $(printf '%s\n' "${_HAVE_OPTS[@]}" | sort) )
 
 for KEY in $(compgen -v | grep '^NFT_TEST_HAVE_' | sort) ; do
 	if ! array_contains "${KEY#NFT_TEST_HAVE_}" "${_HAVE_OPTS[@]}" ; then
@@ -336,7 +340,7 @@ while [ $# -gt 0 ] ; do
 done
 
 find_tests() {
-	find "$1" -type f -executable | LANG=C sort
+	find "$1" -type f -executable | sort
 }
 
 if [ "${#TESTS[@]}" -eq 0 ] ; then
-- 
2.41.0


  reply	other threads:[~2023-09-18 18:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-18 18:45 [PATCH nft 0/3] tests/shell: minor improvements to "run-tests.sh" Thomas Haller
2023-09-18 18:45 ` Thomas Haller [this message]
2023-09-18 18:45 ` [PATCH nft 2/3] tests/shell: don't show the exit status for failed tests Thomas Haller
2023-09-18 18:45 ` [PATCH nft 3/3] tests/shell: colorize NFT_TEST_HAS_SOCKET_LIMITS Thomas Haller
2023-09-27 20:27 ` [PATCH nft 0/3] tests/shell: minor improvements to "run-tests.sh" Pablo Neira Ayuso
2023-09-27 20:47   ` Thomas Haller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230918184634.3471832-2-thaller@redhat.com \
    --to=thaller@redhat.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).