From 1ea47ede63330c44292424df70dfb0ee44d2110f Mon Sep 17 00:00:00 2001 From: Willian Rampazzo Date: Tue, 31 Aug 2021 12:29:39 -0300 Subject: docs: add definitions of terms for CI/testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To understand the current state of QEMU CI/testing and have a base to discuss the plans for the future, it is important to define some usual terms. This patch defines the terms for "Automated tests", "Unit testing", "Functional testing", "System testing", "Flaky tests", "Gating", and "Continuous Integration". Signed-off-by: Willian Rampazzo Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210831152939.97570-2-willianr@redhat.com> Signed-off-by: Thomas Huth --- docs/devel/ci-definitions.rst | 121 ++++++++++++++++++++++++++++++++++++++++++ docs/devel/ci.rst | 1 + 2 files changed, 122 insertions(+) create mode 100644 docs/devel/ci-definitions.rst diff --git a/docs/devel/ci-definitions.rst b/docs/devel/ci-definitions.rst new file mode 100644 index 0000000..32e22ff --- /dev/null +++ b/docs/devel/ci-definitions.rst @@ -0,0 +1,121 @@ +Definition of terms +=================== + +This section defines the terms used in this document and correlates them with +what is currently used on QEMU. + +Automated tests +--------------- + +An automated test is written on a test framework using its generic test +functions/classes. The test framework can run the tests and report their +success or failure [1]_. + +An automated test has essentially three parts: + +1. The test initialization of the parameters, where the expected parameters, + like inputs and expected results, are set up; +2. The call to the code that should be tested; +3. An assertion, comparing the result from the previous call with the expected + result set during the initialization of the parameters. If the result + matches the expected result, the test has been successful; otherwise, it has + failed. + +Unit testing +------------ + +A unit test is responsible for exercising individual software components as a +unit, like interfaces, data structures, and functionality, uncovering errors +within the boundaries of a component. The verification effort is in the +smallest software unit and focuses on the internal processing logic and data +structures. A test case of unit tests should be designed to uncover errors due +to erroneous computations, incorrect comparisons, or improper control flow [2]_. + +On QEMU, unit testing is represented by the 'check-unit' target from 'make'. + +Functional testing +------------------ + +A functional test focuses on the functional requirement of the software. +Deriving sets of input conditions, the functional tests should fully exercise +all the functional requirements for a program. Functional testing is +complementary to other testing techniques, attempting to find errors like +incorrect or missing functions, interface errors, behavior errors, and +initialization and termination errors [3]_. + +On QEMU, functional testing is represented by the 'check-qtest' target from +'make'. + +System testing +-------------- + +System tests ensure all application elements mesh properly while the overall +functionality and performance are achieved [4]_. Some or all system components +are integrated to create a complete system to be tested as a whole. System +testing ensures that components are compatible, interact correctly, and +transfer the right data at the right time across their interfaces. As system +testing focuses on interactions, use case-based testing is a practical approach +to system testing [5]_. Note that, in some cases, system testing may require +interaction with third-party software, like operating system images, databases, +networks, and so on. + +On QEMU, system testing is represented by the 'check-acceptance' target from +'make'. + +Flaky tests +----------- + +A flaky test is defined as a test that exhibits both a passing and a failing +result with the same code on different runs. Some usual reasons for an +intermittent/flaky test are async wait, concurrency, and test order dependency +[6]_. + +Gating +------ + +A gate restricts the move of code from one stage to another on a +test/deployment pipeline. The step move is granted with approval. The approval +can be a manual intervention or a set of tests succeeding [7]_. + +On QEMU, the gating process happens during the pull request. The approval is +done by the project leader running its own set of tests. The pull request gets +merged when the tests succeed. + +Continuous Integration (CI) +--------------------------- + +Continuous integration (CI) requires the builds of the entire application and +the execution of a comprehensive set of automated tests every time there is a +need to commit any set of changes [8]_. The automated tests can be composed of +the unit, functional, system, and other tests. + +Keynotes about continuous integration (CI) [9]_: + +1. System tests may depend on external software (operating system images, + firmware, database, network). +2. It may take a long time to build and test. It may be impractical to build + the system being developed several times per day. +3. If the development platform is different from the target platform, it may + not be possible to run system tests in the developer’s private workspace. + There may be differences in hardware, operating system, or installed + software. Therefore, more time is required for testing the system. + +References +---------- + +.. [1] Sommerville, Ian (2016). Software Engineering. p. 233. +.. [2] Pressman, Roger S. & Maxim, Bruce R. (2020). Software Engineering, + A Practitioner’s Approach. p. 48, 376, 378, 381. +.. [3] Pressman, Roger S. & Maxim, Bruce R. (2020). Software Engineering, + A Practitioner’s Approach. p. 388. +.. [4] Pressman, Roger S. & Maxim, Bruce R. (2020). Software Engineering, + A Practitioner’s Approach. Software Engineering, p. 377. +.. [5] Sommerville, Ian (2016). Software Engineering. p. 59, 232, 240. +.. [6] Luo, Qingzhou, et al. An empirical analysis of flaky tests. + Proceedings of the 22nd ACM SIGSOFT International Symposium on + Foundations of Software Engineering. 2014. +.. [7] Humble, Jez & Farley, David (2010). Continuous Delivery: + Reliable Software Releases Through Build, Test, and Deployment, p. 122. +.. [8] Humble, Jez & Farley, David (2010). Continuous Delivery: + Reliable Software Releases Through Build, Test, and Deployment, p. 55. +.. [9] Sommerville, Ian (2016). Software Engineering. p. 743. diff --git a/docs/devel/ci.rst b/docs/devel/ci.rst index a6a6509..8d95247 100644 --- a/docs/devel/ci.rst +++ b/docs/devel/ci.rst @@ -8,5 +8,6 @@ found at:: https://wiki.qemu.org/Testing/CI +.. include:: ci-definitions.rst .. include:: ci-jobs.rst .. include:: ci-runners.rst -- cgit v1.1 From aca68d95c51513ace81394dc0974a67b99abb234 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 20 Aug 2021 17:37:50 +0100 Subject: libqtest: check for g_setenv() failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit g_setenv() can fail; check for it when starting a QEMU process when we set the QEMU_AUDIO_DRV environment variable. Because this happens after fork() reporting an exact message via printf() is a bad idea; just exit(1), as we already do for the case of execlp() failure. Fixes: Coverity CID 1460117 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210820163750.9106-1-peter.maydell@linaro.org> Signed-off-by: Thomas Huth --- tests/qtest/libqtest.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 825b13a..73f6b97 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -301,7 +301,9 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) s->expected_status = 0; s->qemu_pid = fork(); if (s->qemu_pid == 0) { - g_setenv("QEMU_AUDIO_DRV", "none", true); + if (!g_setenv("QEMU_AUDIO_DRV", "none", true)) { + exit(1); + } execlp("/bin/sh", "sh", "-c", command, NULL); exit(1); } -- cgit v1.1 From 2ffd4d815e705bdf75563821762da958f49a2b8d Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Fri, 27 Aug 2021 17:17:18 +0200 Subject: gitlab-ci: Don't try to use the system libfdt in the debian job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libfdt in Debian is too old to be usable for QEMU. So far we were silently falling back to the internal dtc submodule, but since this is wrong, let's remove the --enable-fdt=system switch here now. Message-Id: <20210827151718.178988-1-thuth@redhat.com> Reviewed-by: Daniel P. Berrangé Acked-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Huth --- .gitlab-ci.d/buildtest.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index be4d90c..5c378e3 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -74,7 +74,6 @@ build-system-debian: job: amd64-debian-container variables: IMAGE: debian-amd64 - CONFIGURE_ARGS: --enable-fdt=system TARGETS: arm-softmmu avr-softmmu i386-softmmu mipsel-softmmu riscv64-softmmu sh4eb-softmmu sparc-softmmu xtensaeb-softmmu MAKE_CHECK_ARGS: check-build -- cgit v1.1 From 87daf898c7bd67ea205516b53302927a0da70902 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Fri, 27 Aug 2021 14:08:59 +0200 Subject: meson.build: Fix the check for a usable libfdt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The check for libfdt currently has a flaw: If there is a system libfdt, the meson.build code initialized the fdt variable with fdt = cc.find_library(...). However, if this libfdt is too old and there is no internal dtc module available, it continues with "fdt" pointing to the old and unusable version. The check later in the file that tries to detect whether libfdt is necessary then fails to trigger: if not fdt.found() and fdt_required.length() > 0 error('fdt not available but required by targets ' + ', '.join(fdt_required)) endif The build fails then during compilation instead, which is of course bad since this is quite confusing and already wasted quite some time of the user. Thus if libfdt is not usable, we should unset the "fdt" variable immediately again, so that the build already fails during the configuration phase. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/255 Message-Id: <20210827120901.150276-2-thuth@redhat.com> Reviewed-by: Marc-André Lureau Signed-off-by: Thomas Huth --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index bf63784..6f71774 100644 --- a/meson.build +++ b/meson.build @@ -1916,6 +1916,7 @@ if have_system fdt_opt = 'internal' else fdt_opt = 'disabled' + fdt = not_found endif endif if fdt_opt == 'internal' -- cgit v1.1 From 6c22853c733efd0a3d243bab48f8af66588f4a7a Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Fri, 27 Aug 2021 14:09:00 +0200 Subject: meson.build: Don't use internal libfdt if the user requested the system libfdt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the users ran configure with --enable-libfdt=system, they likely did that on purpose. We should not silently fall back to the internal libfdt if the system libfdt is not usable, but report the problem with a proper message instead. Message-Id: <20210827120901.150276-3-thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Marc-André Lureau Signed-off-by: Thomas Huth --- meson.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meson.build b/meson.build index 6f71774..ecfdce9 100644 --- a/meson.build +++ b/meson.build @@ -1912,6 +1912,8 @@ if have_system int main(void) { fdt_check_full(NULL, 0); return 0; }''', dependencies: fdt) fdt_opt = 'system' + elif fdt_opt == 'system' + error('system libfdt requested, but it is too old (1.5.1 or newer required)') elif have_internal fdt_opt = 'internal' else -- cgit v1.1 From 8bc5184d23c2f95727021844895a24c0579928b2 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Tue, 13 Jul 2021 13:09:02 +0200 Subject: configure / meson: Move the GBM handling to meson.build The GBM library detection does not need to be in the configure script, since it does not have any user-facing options (there are no --enable-gbm or --disable-gbm switches). Let's move it to meson.build instead, so we don't have to clutter config-host.mak with the related switches. Additionally, only check for GBM if it is really required, i.e. if we either compile with OpenGL or with virglrenderer support. Message-Id: <20210714085045.797168-1-thuth@redhat.com> Signed-off-by: Thomas Huth --- configure | 14 -------------- contrib/vhost-user-gpu/meson.build | 5 ++--- meson.build | 14 ++++++++------ 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/configure b/configure index bd82330..8adf212 100755 --- a/configure +++ b/configure @@ -3451,13 +3451,6 @@ esac ########################################## # opengl probe (for sdl2, gtk) -gbm="no" -if $pkg_config gbm; then - gbm_cflags="$($pkg_config --cflags gbm)" - gbm_libs="$($pkg_config --libs gbm)" - gbm="yes" -fi - if test "$opengl" != "no" ; then epoxy=no if $pkg_config epoxy; then @@ -4688,13 +4681,6 @@ if test "$opengl" = "yes" ; then echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak fi -if test "$gbm" = "yes" ; then - echo "CONFIG_GBM=y" >> $config_host_mak - echo "GBM_LIBS=$gbm_libs" >> $config_host_mak - echo "GBM_CFLAGS=$gbm_cflags" >> $config_host_mak -fi - - if test "$avx2_opt" = "yes" ; then echo "CONFIG_AVX2_OPT=y" >> $config_host_mak fi diff --git a/contrib/vhost-user-gpu/meson.build b/contrib/vhost-user-gpu/meson.build index 4cb52a9..92c8f3a 100644 --- a/contrib/vhost-user-gpu/meson.build +++ b/contrib/vhost-user-gpu/meson.build @@ -1,6 +1,5 @@ -if 'CONFIG_TOOLS' in config_host and virgl.found() \ - and 'CONFIG_GBM' in config_host and 'CONFIG_LINUX' in config_host \ - and pixman.found() +if 'CONFIG_TOOLS' in config_host and virgl.found() and gbm.found() \ + and 'CONFIG_LINUX' in config_host and pixman.found() executable('vhost-user-gpu', files('vhost-user-gpu.c', 'virgl.c', 'vugbm.c'), dependencies: [qemuutil, pixman, gbm, virgl, vhost_user, opengl], install: true, diff --git a/meson.build b/meson.build index ecfdce9..7e58e62 100644 --- a/meson.build +++ b/meson.build @@ -472,11 +472,6 @@ if not get_option('zstd').auto() or have_block required: get_option('zstd'), method: 'pkg-config', kwargs: static_kwargs) endif -gbm = not_found -if 'CONFIG_GBM' in config_host - gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(), - link_args: config_host['GBM_LIBS'].split()) -endif virgl = not_found if not get_option('virglrenderer').auto() or have_system virgl = dependency('virglrenderer', @@ -816,11 +811,17 @@ coreaudio = not_found if 'CONFIG_AUDIO_COREAUDIO' in config_host coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split()) endif + opengl = not_found if 'CONFIG_OPENGL' in config_host opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(), link_args: config_host['OPENGL_LIBS'].split()) endif +gbm = not_found +if (have_system or have_tools) and (virgl.found() or opengl.found()) + gbm = dependency('gbm', method: 'pkg-config', required: false, + kwargs: static_kwargs) +endif gnutls = not_found gnutls_crypto = not_found @@ -1244,6 +1245,7 @@ config_host_data.set('CONFIG_MPATH', mpathpersist.found()) config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api) config_host_data.set('CONFIG_CURL', curl.found()) config_host_data.set('CONFIG_CURSES', curses.found()) +config_host_data.set('CONFIG_GBM', gbm.found()) config_host_data.set('CONFIG_GLUSTERFS', glusterfs.found()) if glusterfs.found() config_host_data.set('CONFIG_GLUSTERFS_XLATOR_OPT', glusterfs.version().version_compare('>=4')) @@ -3086,7 +3088,7 @@ summary_info += {'U2F support': u2f.found()} summary_info += {'libusb': libusb.found()} summary_info += {'usb net redir': usbredir.found()} summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')} -summary_info += {'GBM': config_host.has_key('CONFIG_GBM')} +summary_info += {'GBM': gbm.found()} summary_info += {'libiscsi support': libiscsi.found()} summary_info += {'libnfs support': libnfs.found()} if targetos == 'windows' -- cgit v1.1 From bf6a61855654a306d6256d9fd55813ae1ee914cc Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 25 Aug 2021 16:21:43 +0200 Subject: scripts: Remove the "show-fixed-bugs.sh" file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we are not using Launchpad anymore, there is no more need for this script. Message-Id: <20210825142143.142037-1-thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Signed-off-by: Thomas Huth --- scripts/show-fixed-bugs.sh | 91 ---------------------------------------------- 1 file changed, 91 deletions(-) delete mode 100755 scripts/show-fixed-bugs.sh diff --git a/scripts/show-fixed-bugs.sh b/scripts/show-fixed-bugs.sh deleted file mode 100755 index a095a4d..0000000 --- a/scripts/show-fixed-bugs.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/sh - -# This script checks the git log for URLs to the QEMU launchpad bugtracker -# and optionally checks whether the corresponding bugs are not closed yet. - -show_help () { - echo "Usage:" - echo " -s : Start searching at this commit" - echo " -e : End searching at this commit" - echo " -c : Check if bugs are still open" - echo " -b : Open bugs in browser" -} - -while getopts "s:e:cbh" opt; do - case "$opt" in - s) start="$OPTARG" ;; - e) end="$OPTARG" ;; - c) check_if_open=1 ;; - b) show_in_browser=1 ;; - h) show_help ; exit 0 ;; - *) echo "Use -h for help." ; exit 1 ;; - esac -done - -if [ "x$start" = "x" ]; then - start=$(git tag -l 'v[0-9]*\.[0-9]*\.0' | tail -n 2 | head -n 1) -fi -if [ "x$end" = "x" ]; then - end=$(git tag -l 'v[0-9]*\.[0-9]*\.0' | tail -n 1) -fi - -if [ "x$start" = "x" ] || [ "x$end" = "x" ]; then - echo "Could not determine start or end revision ... Please note that this" - echo "script must be run from a checked out git repository of QEMU." - exit 1 -fi - -echo "Searching git log for bugs in the range $start..$end" - -urlstr='https://bugs.launchpad.net/\(bugs\|qemu/+bug\)/' -bug_urls=$(git log $start..$end \ - | sed -n '\,'"$urlstr"', s,\(.*\)\('"$urlstr"'\)\([0-9]*\).*,\2\4,p' \ - | sort -u) - -echo Found bug URLs: -for i in $bug_urls ; do echo " $i" ; done - -if [ "x$check_if_open" = "x1" ]; then - echo - echo "Checking which ones are still open..." - for i in $bug_urls ; do - if ! curl -s -L "$i" | grep "value status" | grep -q "Fix Released" ; then - echo " $i" - final_bug_urls="$final_bug_urls $i" - fi - done -else - final_bug_urls=$bug_urls -fi - -if [ "x$final_bug_urls" = "x" ]; then - echo "No open bugs found." -elif [ "x$show_in_browser" = "x1" ]; then - # Try to determine which browser we should use - if [ "x$BROWSER" != "x" ]; then - bugbrowser="$BROWSER" - elif command -v xdg-open >/dev/null 2>&1; then - bugbrowser=xdg-open - elif command -v gnome-open >/dev/null 2>&1; then - bugbrowser=gnome-open - elif [ "$(uname)" = "Darwin" ]; then - bugbrowser=open - elif command -v sensible-browser >/dev/null 2>&1; then - bugbrowser=sensible-browser - else - echo "Please set the BROWSER variable to the browser of your choice." - exit 1 - fi - # Now show the bugs in the browser - first=1 - for i in $final_bug_urls; do - "$bugbrowser" "$i" - if [ $first = 1 ]; then - # if it is the first entry, give the browser some time to start - # (to avoid messages like "Firefox is already running, but is - # not responding...") - sleep 4 - first=0 - fi - done -fi -- cgit v1.1 From 8e8e844be48d6e367e523ac418a83a3046cdebfa Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 25 Aug 2021 11:20:21 +0200 Subject: softmmu/vl: Add a "grab-mod" parameter to the -display sdl option The -display sdl option is not using QAPI internally yet, and uses hand- crafted parsing instead (see parse_display() in vl.c), which is quite ugly, since most of the other code is using the QAPIfied DisplayOption already. Unfortunately, the "alt_grab" and "ctrl_grab" use underscores in their names which has recently been forbidden in new QAPI code, so a straight conversion is not possible. While we could add some exceptions to the QAPI schema parser for this, the way these parameters have been designed was maybe a bad idea anyway: First, it's not possible to enable both parameters at the same time, thus instead of two boolean parameters it would be better to have only one multi-choice parameter instead. Second, the naming is also somewhat unfortunate since the "alt_grab" parameter is not about the ALT key, but rather about the left SHIFT key that has to be used additionally when the parameter is enabled. So instead of trying to QAPIfy "alt_grab" and "ctrl_grab", let's rather introduce an alternative to these parameters instead, a new parameter called "grab-mod" which can either be set to "lshift-lctrl-lalt" or to "rctrl". In case we ever want to support additional modes later, we can then also simply extend the list of supported strings here. Message-Id: <20210825092023.81396-2-thuth@redhat.com> Reviewed-by: Gerd Hoffmann Signed-off-by: Thomas Huth --- qemu-options.hx | 6 +++++- softmmu/vl.c | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 4a9ee72..124ed51 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1834,7 +1834,7 @@ DEF("display", HAS_ARG, QEMU_OPTION_display, #endif #if defined(CONFIG_SDL) "-display sdl[,alt_grab=on|off][,ctrl_grab=on|off][,gl=on|core|es|off]\n" - " [,show-cursor=on|off][,window-close=on|off]\n" + " [,grab-mod=][,show-cursor=on|off][,window-close=on|off]\n" #endif #if defined(CONFIG_GTK) "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off]\n" @@ -1880,6 +1880,10 @@ SRST window; see the SDL documentation for other possibilities). Valid parameters are: + ``grab-mod=`` : Used to select the modifier keys for toggling + the mouse grabbing in conjunction with the "g" key. `` can be + either `lshift-lctrl-lalt` or `rctrl`. + ``alt_grab=on|off`` : Use Control+Alt+Shift-g to toggle mouse grabbing ``ctrl_grab=on|off`` : Use Right-Control-g to toggle mouse grabbing diff --git a/softmmu/vl.c b/softmmu/vl.c index ea05bb3..2176e3c 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -1017,15 +1017,24 @@ static void parse_display(const char *p) * parse_display_qapi() due to some options not in * DisplayOptions, specifically: * - ctrl_grab + alt_grab - * Not clear yet what happens to them long-term. Should - * replaced by something better or deprecated and dropped. + * They can't be moved into the QAPI since they use underscores, + * thus they will get replaced by "grab-mod" in the long term */ #if defined(CONFIG_SDL) dpy.type = DISPLAY_TYPE_SDL; while (*opts) { const char *nextopt; - if (strstart(opts, ",alt_grab=", &nextopt)) { + if (strstart(opts, ",grab-mod=", &nextopt)) { + opts = nextopt; + if (strstart(opts, "lshift-lctrl-lalt", &nextopt)) { + alt_grab = 1; + } else if (strstart(opts, "rctrl", &nextopt)) { + ctrl_grab = 1; + } else { + goto invalid_sdl_args; + } + } else if (strstart(opts, ",alt_grab=", &nextopt)) { opts = nextopt; if (strstart(opts, "on", &nextopt)) { alt_grab = 1; -- cgit v1.1 From d46156fdcc60e788dea3bba407d67c950e3de3b5 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 25 Aug 2021 11:20:22 +0200 Subject: softmmu/vl: Deprecate the old grab options The alt_grab and ctrl_grab parameter of the -display sdl option prevent the QAPIfication of the "sdl" part of the -display option, so we should eventually remove them. And since this feature is also rather niche anyway, we should not clutter the top-level option list with these, so let's also deprecate the "-alt-grab" and the "-ctrl-grab" options while we're at it. Once the deprecation period of "alt_grab" and "ctrl_grab" is over, we then can finally switch the -display sdl option to use QAPI internally, too. Message-Id: <20210825092023.81396-3-thuth@redhat.com> Reviewed-by: Gerd Hoffmann Acked-by: Peter Krempa Signed-off-by: Thomas Huth --- docs/about/deprecated.rst | 10 ++++++++++ qemu-options.hx | 12 ++++++++---- softmmu/vl.c | 6 ++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 6e88a84..e7f8d6f 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -138,6 +138,16 @@ an underscore between "window" and "close"). The ``-no-quit`` is a synonym for ``-display ...,window-close=off`` which should be used instead. +``-alt-grab`` and ``-display sdl,alt_grab=on`` (since 6.2) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +Use ``-display sdl,grab-mod=lshift-lctrl-lalt`` instead. + +``-ctrl-grab`` and ``-display sdl,ctrl_grab=on`` (since 6.2) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +Use ``-display sdl,grab-mod=rctrl`` instead. + Plugin argument passing through ``arg=`` (since 6.1) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' diff --git a/qemu-options.hx b/qemu-options.hx index 124ed51..8f603cc 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1884,9 +1884,11 @@ SRST the mouse grabbing in conjunction with the "g" key. `` can be either `lshift-lctrl-lalt` or `rctrl`. - ``alt_grab=on|off`` : Use Control+Alt+Shift-g to toggle mouse grabbing + ``alt_grab=on|off`` : Use Control+Alt+Shift-g to toggle mouse grabbing. + This parameter is deprecated - use ``grab-mod`` instead. - ``ctrl_grab=on|off`` : Use Right-Control-g to toggle mouse grabbing + ``ctrl_grab=on|off`` : Use Right-Control-g to toggle mouse grabbing. + This parameter is deprecated - use ``grab-mod`` instead. ``gl=on|off|core|es`` : Use OpenGL for displaying @@ -1971,7 +1973,8 @@ SRST ``-alt-grab`` Use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt). Note that this also affects the special keys (for fullscreen, monitor-mode - switching, etc). + switching, etc). This option is deprecated - please use + ``-display sdl,grab-mod=lshift-lctrl-lalt`` instead. ERST DEF("ctrl-grab", 0, QEMU_OPTION_ctrl_grab, @@ -1981,7 +1984,8 @@ SRST ``-ctrl-grab`` Use Right-Ctrl to grab mouse (instead of Ctrl-Alt). Note that this also affects the special keys (for fullscreen, monitor-mode - switching, etc). + switching, etc). This option is deprecated - please use + ``-display sdl,grab-mod=rctrl`` instead. ERST DEF("no-quit", 0, QEMU_OPTION_no_quit, diff --git a/softmmu/vl.c b/softmmu/vl.c index 2176e3c..e9346b4 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -1043,6 +1043,7 @@ static void parse_display(const char *p) } else { goto invalid_sdl_args; } + warn_report("alt_grab is deprecated, use grab-mod instead."); } else if (strstart(opts, ",ctrl_grab=", &nextopt)) { opts = nextopt; if (strstart(opts, "on", &nextopt)) { @@ -1052,6 +1053,7 @@ static void parse_display(const char *p) } else { goto invalid_sdl_args; } + warn_report("ctrl_grab is deprecated, use grab-mod instead."); } else if (strstart(opts, ",window_close=", &nextopt) || strstart(opts, ",window-close=", &nextopt)) { if (strstart(opts, ",window_close=", NULL)) { @@ -3245,9 +3247,13 @@ void qemu_init(int argc, char **argv, char **envp) break; case QEMU_OPTION_alt_grab: alt_grab = 1; + warn_report("-alt-grab is deprecated, please use " + "-display sdl,grab-mod=lshift-lctrl-lalt instead."); break; case QEMU_OPTION_ctrl_grab: ctrl_grab = 1; + warn_report("-ctrl-grab is deprecated, please use " + "-display sdl,grab-mod=rctrl instead."); break; case QEMU_OPTION_no_quit: dpy.has_window_close = true; -- cgit v1.1 From 6695e4c0fd9ef05bf6ab8e3402d5bc95b39c4cf3 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 25 Aug 2021 11:20:23 +0200 Subject: softmmu/vl: Deprecate the -sdl and -curses option It's not that much complicated to type "-display sdl" or "-display curses", so we should not clutter our main option name space with such simple wrapper options and rather present the users with a concise interface instead. Thus let's deprecate the "-sdl" and "-curses" wrapper options now. Message-Id: <20210825092023.81396-4-thuth@redhat.com> Reviewed-by: Gerd Hoffmann Acked-by: Peter Krempa Signed-off-by: Thomas Huth --- docs/about/deprecated.rst | 10 ++++++++++ softmmu/vl.c | 3 +++ 2 files changed, 13 insertions(+) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index e7f8d6f..9ee355e 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -148,6 +148,16 @@ Use ``-display sdl,grab-mod=lshift-lctrl-lalt`` instead. Use ``-display sdl,grab-mod=rctrl`` instead. +``-sdl`` (since 6.2) +'''''''''''''''''''' + +Use ``-display sdl`` instead. + +``-curses`` (since 6.2) +''''''''''''''''''''''' + +Use ``-display curses`` instead. + Plugin argument passing through ``arg=`` (since 6.1) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' diff --git a/softmmu/vl.c b/softmmu/vl.c index e9346b4..55ab70e 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2889,6 +2889,8 @@ void qemu_init(int argc, char **argv, char **envp) dpy.type = DISPLAY_TYPE_NONE; break; case QEMU_OPTION_curses: + warn_report("-curses is deprecated, " + "use -display curses instead."); #ifdef CONFIG_CURSES dpy.type = DISPLAY_TYPE_CURSES; #else @@ -3262,6 +3264,7 @@ void qemu_init(int argc, char **argv, char **envp) "-display ...,window-close=off instead."); break; case QEMU_OPTION_sdl: + warn_report("-sdl is deprecated, use -display sdl instead."); #ifdef CONFIG_SDL dpy.type = DISPLAY_TYPE_SDL; break; -- cgit v1.1