summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2019-03-16 17:46:08 +0100
committerFrantisek Sumsal <frantisek@sumsal.cz>2019-03-16 18:59:01 +0100
commitc81a46b90465e087c38bbaf7fc9d91855a057a93 (patch)
treec00f50c39aa41c4616bb50fe8d2c7df0a6d0f5ce /test
parent6d67286fc3f4dd4e78aeb3b113d07e0d2dabfe60 (diff)
downloadsystemd-c81a46b90465e087c38bbaf7fc9d91855a057a93.tar.gz
test: introduce INTERACTIVE_DEBUG
Make the interactive debugging of (particularly QEMU) machines less painful, by replacing the default vt220 TERM with linux one, and by not shutting down the machine after running the test itself.
Diffstat (limited to 'test')
-rw-r--r--test/test-functions20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/test-functions b/test/test-functions
index c98f58b278..9eafd769cc 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -25,7 +25,7 @@ fi
PATH_TO_INIT=$ROOTLIBDIR/systemd
BASICTOOLS="test sh bash setsid loadkeys setfont login sulogin gzip sleep echo head tail cat mount umount cryptsetup date dmsetup modprobe sed cmp tee rm true false chmod chown ln xargs"
-DEBUGTOOLS="df free ls stty ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort hostname find"
+DEBUGTOOLS="df free ls stty ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort hostname find vi mv"
STATEDIR="${BUILD_DIR:-.}/test/$(basename $(dirname $(realpath $0)))"
STATEFILE="$STATEDIR/.testdir"
@@ -655,6 +655,21 @@ install_basic_tools() {
install_debug_tools() {
[[ $DEBUGTOOLS ]] && dracut_install $DEBUGTOOLS
+
+ if [[ $INTERACTIVE_DEBUG ]]; then
+ # Set default TERM from vt220 to linux, so at least basic key shortcuts work
+ local _getty_override="$initdir/etc/systemd/system/serial-getty@.service.d"
+ mkdir -p "$_getty_override"
+ echo -e "[Service]\nEnvironment=TERM=linux" > "$_getty_override/default-TERM.conf"
+
+ cat > "$initdir/etc/motd" << EOF
+To adjust the terminal size use:
+ export COLUMNS=xx
+ export LINES=yy
+or
+ stty cols xx rows yy
+EOF
+ fi
}
install_libnss() {
@@ -761,7 +776,8 @@ setup_testsuite() {
mkdir -p $initdir/etc/systemd/system/testsuite.target.wants
ln -fs $TEST_BASE_DIR/testsuite.service $initdir/etc/systemd/system/testsuite.target.wants/testsuite.service
- ln -fs $TEST_BASE_DIR/end.service $initdir/etc/systemd/system/testsuite.target.wants/end.service
+ # Don't shutdown the machine after running the test when INTERACTIVE_DEBUG is set
+ [[ -z $INTERACTIVE_DEBUG ]] && ln -fs $TEST_BASE_DIR/end.service $initdir/etc/systemd/system/testsuite.target.wants/end.service
# make the testsuite the default target
ln -fs testsuite.target $initdir/etc/systemd/system/default.target