linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: mm: capture write_hugetlb_memory.sh exit status
@ 2026-04-05 19:46 CaoRuichuang
  2026-04-05 20:20 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: CaoRuichuang @ 2026-04-05 19:46 UTC (permalink / raw)
  To: akpm, david
  Cc: ljs, Liam.Howlett, vbabka, rppt, surenb, mhocko, shuah, linux-mm,
	linux-kselftest, linux-kernel, CaoRuichuang

charge_reserved_hugetlb.sh backgrounds write_hugetlb_memory.sh and immediately stores $? in write_result.

That only records whether the background job was started successfully, not whether write_hugetlb_memory.sh itself later failed. As a result, the test can miss reservation failure and OOM-kill outcomes that are inferred from the writer exit status.

Redirect the writer output straight to the temporary log file and wait for the background process before inspecting write_result, so the test records the actual exit status.

Signed-off-by: CaoRuichuang <create0818@163.com>
---
 tools/testing/selftests/mm/charge_reserved_hugetlb.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
index 447769657..2f52ad7c8 100755
--- a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
+++ b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
@@ -193,9 +193,9 @@ function write_hugetlbfs_and_get_usage() {
     [[ "$private" == "-r" ]] && [[ "$expect_failure" != 1 ]]; then
 
     bash write_hugetlb_memory.sh "$size" "$populate" "$write" \
-      "$cgroup" "$path" "$method" "$private" "-l" "$reserve" 2>&1 | tee $output &
+      "$cgroup" "$path" "$method" "$private" "-l" "$reserve" \
+      >"$output" 2>&1 &
 
-    local write_result=$?
     local write_pid=$!
 
     until grep -q -i "DONE" $output; do
@@ -223,6 +223,8 @@ function write_hugetlbfs_and_get_usage() {
       sleep 0.5
     fi
 
+    wait "$write_pid"
+    local write_result=$?
     echo write_result is $write_result
   else
     bash write_hugetlb_memory.sh "$size" "$populate" "$write" \
-- 
2.39.5 (Apple Git-154)



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-05 21:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-05 19:46 [PATCH] selftests: mm: capture write_hugetlb_memory.sh exit status CaoRuichuang
2026-04-05 20:20 ` Andrew Morton
2026-04-05 21:35   ` CaoRuichuang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox