Reviewing only the shell language part, not the CXL logic.
On 2025-08-04 02:01, [email protected] wrote:
> +# Allow what shellcheck suspects are unused - the arrays
> +# shellcheck disable=SC2034
That's very indiscriminate and shellcheck -x is usually pretty good
there... did you use -x?
Alternatively, could you place this only before the arrays that
shellcheck gets wrong for some reason? (which reason?)
> +
> +check_dmesg_results() {
> + local nr_entries=$1
> + local expect_failures=${2:-false} # Optional param
> + local log nr_pass nr_fail
> +
> + log=$(journalctl -r -k --since "$log_start_time")
-r is IMHO not a very common option:
log=$(journalctl --reverse -k --since "$NDTEST_START")
> + nr_pass=$(echo "$log" | grep -c "CXL Translate Test.*PASS") || nr_pass=0
> + nr_fail=$(echo "$log" | grep -c "CXL Translate Test.*FAIL") ||
> nr_fail=0
Not sure about reading the entire log in memory. Also not sure about
size limit with variables... How about something like this instead:
local jnl_cmd='journalctl --reverse -k --grep="CXL Translate Test" --since
'"$NDTEST_START"
local nr_pass; nr_pass=$($jnl_cmd | grep 'PASS' | wc -l)
local nr_fail; nr_pass=$($jnl_cmd | grep 'FAIL' | wc -l)
> + if [ "$expect_failures" = "false" ]; then
if "$expect_failures"; then