#!/bin/bash # SPDX-License-Identifier: GPL-2.0-only */ # # Wrapper script which performs setup and cleanup for nx_huge_pages_test. # Makes use of root privileges to set up huge pages and KVM module parameters. # # Copyright (C) 2022, Google LLC.
# If we're already root, the host might not have sudo. if [ $(whoami) == "root" ]; then function do_sudo () { "$@"
} else function do_sudo () {
sudo "$@"
} fi
set +e
function sudo_echo () { echo"$1" | do_sudo tee -a "$2" > /dev/null
}
# Test with reboot permissions if [ $(whoami) == "root" ] || sudo setcap cap_sys_boot+ep $NXECUTABLE 2> /dev/null; then echo Running test with CAP_SYS_BOOT enabled
$NXECUTABLE -t 887563923 -p 100 -r
test $(whoami) == "root" || sudo setcap cap_sys_boot-ep $NXECUTABLE else echo setcap failed, skipping nx_huge_pages_test with CAP_SYS_BOOT enabled fi
# Test without reboot permissions if [ $(whoami) != "root" ] ; then echo Running test with CAP_SYS_BOOT disabled
$NXECUTABLE -t 887563923 -p 100 else echo Running as root, skipping nx_huge_pages_test with CAP_SYS_BOOT disabled fi
)
RET=$?
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.