Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions case-lib/hijack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,25 @@ SUDO_LEVEL=""
# overwrite the sudo command, sudo in the script can direct using sudo command
sudo()
{
local cmd=( "$@" )

func_hijack_setup_sudo_level || true
local cmd
case $SUDO_LEVEL in
'0') cmd="$*" # as root
'0') "${cmd[@]}" # as root
return $?
;;
'1') cmd="$SUDO_CMD env 'PATH=$PATH' $*" # sudo without passwd
'1') "$SUDO_CMD" env PATH="$PATH" "${cmd[@]}" # sudo without passwd
return $?
;;
'2') cmd="echo '$SUDO_PASSWD' | $SUDO_CMD -S env 'PATH=$PATH' $*" # sudo need passwd
# sudo need passwd
'2') echo "$SUDO_PASSWD" | "$SUDO_CMD" --stdin env PATH="$PATH" "${cmd[@]}"
return $?
;;
*) # without sudo permission
dlogw "Need root privilege to run $*"
return 2
return 1
esac
eval "$cmd"
}

func_hijack_setup_sudo_level()
Expand Down
2 changes: 1 addition & 1 deletion test-case/check-ipc-flood.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ do
setup_kernel_check_point
dlogi "===== [$i/$loop_cnt] loop Begin ====="
dlogc "sudo bash -c 'echo $lpc_loop_cnt > $ipc_flood_dfs'"
sudo bash -c "'echo $lpc_loop_cnt > $ipc_flood_dfs'"
sudo bash -c "echo $lpc_loop_cnt > $ipc_flood_dfs"

# check kernel log for each iteration to catch issues
sof-kernel-log-check.sh "$KERNEL_CHECKPOINT" || die "Caught error in kernel log"
Expand Down
5 changes: 5 additions & 0 deletions tools/sof-kernel-dump.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

# FIXME: replace calls to this complex and buggy script with much
# simpler calls to `journalctl -k` which has a slightly different (but
# customizable) format; a few extra messages and most importantly: never
# rotates and never loses the first 'Linux version' line.

# dump the kernel information from target
last_order=${1:-0}
# check whether parameter 1 has the Non-Number
Expand Down