[LTP] shell: add optional OOM protection

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Mon Jul 13 16:12:52 CEST 2026


Hi Andrea,

On Mon, Jul 13 2026, Andrea Cervesato <andrea.cervesato@suse.com> wrote:
> shell: add optional OOM protection

--- [PATCH 1/2] ---

> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2026 Linux Test Project
> +
> +TST_TESTFUNC=test
> +TST_OOM_PROTECTION=1

The new test is missing both the mandatory doc block and the mandatory env
block. All other tests in testcases/lib/tests/ carry them (e.g.
shell_loader.sh, shell_loader_cleanup.sh). Add at minimum:

  # ---
  # doc
  # Verify that TST_OOM_PROTECTION shields the shell harness from the OOM
  # killer and resets the test process oom_score_adj to 0.
  # ---
  #
  # ---
  # env
  # {
  # }
  # ---

> +TST_TESTFUNC=test

Is naming the test function "test" intentional? "test" is a POSIX shell
builtin and a standalone utility; shell-tests.md forbids naming functions
after common shell commands. Rename to e.g. "do_test" and update
TST_TESTFUNC accordingly.

> +. tst_test.sh
> +tst_run

Every other test in testcases/lib/tests/ uses the ". tst_loader.sh" /
". tst_run.sh" pattern. This test uses the pure-shell harness directly.
Is that because tst_loader.sh goes through the C binary (tst_run_shell)
and therefore never exercises the OOM protection that lives in tst_test.sh?

If so, can the test still be brought into the standard structure, or does
this require the OOM protection to be moved into the C backend first?

Verdict - Needs revision

Pre-existing issues:
  testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh uses
  TST_TESTFUNC=test (function named after shell builtin); it also lacks
  doc/env blocks. These pre-date this series.

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list