linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Leonardo Felipe Takao Hirata <leo.fthirata@gmail.com>
To: david@redhat.com, osalvador@suse.de, shuah@kernel.org
Cc: Leonardo Felipe Takao Hirata <leofthirata@gmail.com>,
	linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: [PATCH] selftests/memory-hotplug: debugging improvement
Date: Mon, 24 Feb 2025 10:03:00 -0300	[thread overview]
Message-ID: <20250224130341.10613-1-leofthirata@gmail.com> (raw)

Formats testing messages to improve debugging:
- Inserts alignment tabs with printf for testing results
- Changes messages to improve readability and understanding

Signed-off-by: Leonardo Felipe Takao Hirata <leofthirata@gmail.com>
---
 .../memory-hotplug/mem-on-off-test.sh         | 21 ++++++++++++-------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
index 611be86eaf3d..7a2eea366c1b 100755
--- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
+++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
@@ -143,6 +143,11 @@ online_all_offline_memory()
 	done
 }
 
+print_status()
+{
+	printf '\t\t%-37s   %12s\n' "$1" "$2"
+}
+
 error=-12
 priority=0
 # Run with default of ratio=2 for Kselftest run
@@ -184,16 +189,16 @@ echo "Test scope: $ratio% hotplug memory"
 # Online all hot-pluggable memory
 #
 hotpluggable_num=`hotpluggable_offline_memory | wc -l`
-echo -e "\t online all hot-pluggable memory in offline state:"
+echo -e "Changing all OFFLINE hot-pluggable memory blocks to ONLINE:\n"
 if [ "$hotpluggable_num" -gt 0 ]; then
 	for memory in `hotpluggable_offline_memory`; do
-		echo "offline->online memory$memory"
+		echo -e "\t\tOFFLINE -> ONLINE memory block ($memory)"
 		if ! online_memory_expect_success $memory; then
 			retval=1
 		fi
 	done
 else
-	echo -e "\t\t SKIPPED - no hot-pluggable memory in offline state"
+	echo -e "\t\t SKIPPED - no hot-pluggable memory in OFFLINE state"
 fi
 
 #
@@ -201,16 +206,16 @@ fi
 #
 hotpluggable_num=`hotpluggable_online_memory | wc -l`
 target=`echo "a=$hotpluggable_num*$ratio; if ( a%100 ) a/100+1 else a/100" | bc`
-echo -e "\t offline $ratio% hot-pluggable memory in online state"
-echo -e "\t trying to offline $target out of $hotpluggable_num memory block(s):"
+echo -e "\nOFFLINE $ratio% hot-pluggable memory in ONLINE state ($target memory block(s))"
+echo -e "Changing $target out of $hotpluggable_num OFFLINE memory block(s) to ONLINE:\n"
 for memory in `hotpluggable_online_memory`; do
 	if [ "$target" -gt 0 ]; then
-		echo "online->offline memory$memory"
+		tmp="ONLINE -> OFFLINE memory block (${memory})"
 		if offline_memory_expect_success $memory &>/dev/null; then
 			target=$(($target - 1))
-			echo "-> Success"
+			print_status "$tmp" "[SUCCESS]"
 		else
-			echo "-> Failure"
+			print_status "$tmp" "[FAILURE]"
 		fi
 	fi
 done
-- 
2.43.0



                 reply	other threads:[~2025-02-24 13:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250224130341.10613-1-leofthirata@gmail.com \
    --to=leo.fthirata@gmail.com \
    --cc=david@redhat.com \
    --cc=leofthirata@gmail.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --cc=shuah@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