* Add definitions of terms for CI/testing

* Fix g_setenv problem discovered by Coverity
 * Gitlab CI improvements
 * Build system improvements (configure script + meson.build)
 * Removal of the show-fixed-bugs.sh script
 * Clean up of the sdl and curses options
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmE15LURHHRodXRoQHJl
 ZGhhdC5jb20ACgkQLtnXdP5wLbWeIA//fJB7Tnj3YzUizED6cSwtT5NoxWHQw9Cn
 uEhEWJj6Ng5sQ6SYHJ43kPqBkscHo+eK9ayt8mfFPTzz2NTE51aBqGsA0ZGXGNjH
 3ORqx12cVthOD6GU/wY12nAF8efHwum/II507kH1GdZpO6CK3dPBNvFl/qhPtjIb
 srzxCJCFwgipsH4CI5YWxOLueAsMPZ6d8b9TGmobRi26ASg2dVCk2yB6l8VO0Fbe
 ydWDKnz9tnHz4r1sbfWjDwD72rFpPngYAaI7lc0n6b9Q1ilkhjwIieTEZhl+jpH8
 Be3YtIorzvI/rti+vwAGMcLt4xLy9qJb8a8dxHbpJAvxQSvNsjK2wYZVAqe6xCuj
 65+39cqRtB3VS69GI/Y/fsBj+dCCIeLXDiTsOyrs/JaBkvulhRdekGiI5l42QgAD
 xdZyciwsTc+NpsldoxOP4mg5mLXu8rxwrJV93j0V3Cdnfjz0jPsXHSt52AIM2iiW
 TCrs2z+wRbjHU7FMdbOOkDTeBn1rBq4dzxkVpdL8+9SA8TG+FWz2F+1hsWWDtnI7
 DFlWAC7jeLiW4+sDXIpcPBZ6mpbK7xefZBa8/l3DSkD1cl5/JOc21g6OzSBJQfb0
 x9icJXBhIhTI1yrmmUlO5SOlqnfXxSY9IVvuWnO0FKvUe8tVSNZ9T2MPtTy9zIep
 8ohIcOsBIJ0=
 =t3uT
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/thuth-gitlab/tags/pull-request-2021-09-06' into staging

* Add definitions of terms for CI/testing
* Fix g_setenv problem discovered by Coverity
* Gitlab CI improvements
* Build system improvements (configure script + meson.build)
* Removal of the show-fixed-bugs.sh script
* Clean up of the sdl and curses options

# gpg: Signature made Mon 06 Sep 2021 10:51:49 BST
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/thuth-gitlab/tags/pull-request-2021-09-06:
  softmmu/vl: Deprecate the -sdl and -curses option
  softmmu/vl: Deprecate the old grab options
  softmmu/vl: Add a "grab-mod" parameter to the -display sdl option
  scripts: Remove the "show-fixed-bugs.sh" file
  configure / meson: Move the GBM handling to meson.build
  meson.build: Don't use internal libfdt if the user requested the system libfdt
  meson.build: Fix the check for a usable libfdt
  gitlab-ci: Don't try to use the system libfdt in the debian job
  libqtest: check for g_setenv() failure
  docs: add definitions of terms for CI/testing

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2021-09-06 12:38:07 +01:00
commit 935efca6c2
11 changed files with 192 additions and 124 deletions

View File

@ -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

14
configure vendored
View File

@ -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

View File

@ -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,

View File

@ -138,6 +138,26 @@ 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.
``-sdl`` (since 6.2)
''''''''''''''''''''
Use ``-display sdl`` instead.
``-curses`` (since 6.2)
'''''''''''''''''''''''
Use ``-display curses`` instead.
Plugin argument passing through ``arg=<string>`` (since 6.1)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

View File

@ -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 developers 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 Practitioners Approach. p. 48, 376, 378, 381.
.. [3] Pressman, Roger S. & Maxim, Bruce R. (2020). Software Engineering,
A Practitioners Approach. p. 388.
.. [4] Pressman, Roger S. & Maxim, Bruce R. (2020). Software Engineering,
A Practitioners 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.

View File

@ -8,5 +8,6 @@ found at::
https://wiki.qemu.org/Testing/CI
.. include:: ci-definitions.rst
.. include:: ci-jobs.rst
.. include:: ci-runners.rst

View File

@ -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'))
@ -1912,10 +1914,13 @@ 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
fdt_opt = 'disabled'
fdt = not_found
endif
endif
if fdt_opt == 'internal'
@ -3083,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'

View File

@ -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=<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,9 +1880,15 @@ SRST
window; see the SDL documentation for other possibilities).
Valid parameters are:
``alt_grab=on|off`` : Use Control+Alt+Shift-g to toggle mouse grabbing
``grab-mod=<mods>`` : Used to select the modifier keys for toggling
the mouse grabbing in conjunction with the "g" key. `<mods>` can be
either `lshift-lctrl-lalt` or `rctrl`.
``ctrl_grab=on|off`` : Use Right-Control-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.
This parameter is deprecated - use ``grab-mod`` instead.
``gl=on|off|core|es`` : Use OpenGL for displaying
@ -1967,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,
@ -1977,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,

View File

@ -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 <commit> : Start searching at this commit"
echo " -e <commit> : 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

View File

@ -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;
@ -1034,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)) {
@ -1043,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)) {
@ -2878,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
@ -3236,9 +3249,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;
@ -3247,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;

View File

@ -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);
}