summaryrefslogtreecommitdiff
path: root/tests/shunloadtest.c
Commit message (Collapse)AuthorAgeFilesLines
* syntax-check: sc_avoid_write: Don't use blanket file exceptionsPeter Krempa2022-02-151-1/+1
| | | | | | | | | | | | | | | | | | Adding an exception for the whole file usually defeats the purpose of a syntax check and is also likely to get forgotten once the file is removed. In case of the suggestion of using 'safewrite' instead of write even the comment for safewrite states that the function needs to be used only in certain cases. Remove the blanket exceptions for files and use an exclude string instead. The only instance where we keep the full file exception is for src/libvirt-stream.c as there are multiple uses in example code in comments where I couldn't find a nicer targetted wapproach. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* meson: remove '.libs' from all relevant pathsPavel Hrdina2020-08-031-2/+2
| | | | | | | | | | | | | Meson doesn't use .libs directory, everything is placed directly into directories where meson.build file is used. In order to have working tests and running libvirt directly from GIT we need to fix all the paths pointing '.libs' directory. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Neal Gompa <ngompa13@gmail.com>
* src: remove virFilePrintf in favour of g_fprintfDaniel P. Berrangé2020-02-041-1/+1
| | | | | | | | | | The virFilePrintf function was a wrapper for fprintf() to provide Windows portability, since gnulib's fprintf() replacement was license restricted. This is no longer needed now we have the g_fprintf function available. Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* tests: use G_GNUC_UNUSEDJán Tomko2019-10-151-1/+1
| | | | | | | Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* src: More cleanup of some system headers already contained in internal.hErik Skultety2018-09-201-1/+0
| | | | | | | | | | | All of the ones being removed are pulled in by internal.h. The only exception is sanlock which expects the application to include <stdint.h> before sanlock's headers, because sanlock prototypes use fixed width int, but they don't include stdint.h themselves, so we have to leave that one in place. Signed-off-by: Erik Skultety <eskultet@redhat.com> Acked-by: Michal Privoznik <mprivozn@redhat.com>
* internal: Move <stdio.h> include to internal.hErik Skultety2018-09-201-1/+0
| | | | | | | | It doesn't really make sense for us to have stdlib.h and string.h but not stdio.h in the internal.h header. Signed-off-by: Erik Skultety <eskultet@redhat.com> Acked-by: Michal Privoznik <mprivozn@redhat.com>
* Remove unnecessary curly brackets in tests/Martin Kletzander2014-11-141-4/+2
| | | | Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
* tests: Resolve Coverity RESOURCE_LEAKWang Rui2014-08-281-0/+1
| | | | | | | The 'lib' handle will be leaked if 'dlsym' condition fails. So close the handle before return. Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
* build: fix shunloadtest breakageEric Blake2013-07-291-1/+2
| | | | | | | | | | | | | | | | | | Commit 93ec384 was tested on mingw, but broke the build on Linux: CCLD shunloadtest shunloadtest.o: In function `main': /home/eblake/libvirt/tests/shunloadtest.c:106: undefined reference to `virFilePrintf' ... ssh.o: In function `main': /home/eblake/libvirt/tests/ssh.c:43: undefined reference to `virFilePrintf' /home/eblake/libvirt/tests/ssh.c:49: undefined reference to `virFilePrintf' * tests/testutils.h (fprintf): Provide escape hatch. * tests/shunloadtest.c: Use it. * tests/ssh.c: Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
* shunloadtest: Resolve Coverity CHECKED_RETURN errorJohn Ferlan2013-05-211-9/+17
| | | | | | The shunloadStart function didn't check the status of virInitialize which was flagged by Coverity. Adjust the function and shunloadtest in order to handle the situation.
* cleanup: Only include testutils.h onceOsier Yang2013-04-171-2/+2
| | | | No reason to include it in both "if" and "else" branches.
* maint: fix up copyright notice inconsistenciesEric Blake2012-09-201-1/+1
| | | | | | | | | https://www.gnu.org/licenses/gpl-howto.html recommends that the 'If not, see <url>.' phrase be a separate sentence. * tests/securityselinuxhelper.c: Remove doubled line. * tests/securityselinuxtest.c: Likewise. * globally: s/; If/. If/
* Desert the FSF address in copyrightOsier Yang2012-07-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | Per the FSF address could be changed from time to time, and GNU recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html) You should have received a copy of the GNU General Public License along with Foobar. If not, see <http://www.gnu.org/licenses/>. This patch removes the explicit FSF address, and uses above instead (of course, with inserting 'Lesser' before 'General'). Except a bunch of files for security driver, all others are changed automatically, the copyright for securify files are not complete, that's why to do it manually: src/security/security_selinux.h src/security/security_driver.h src/security/security_selinux.c src/security/security_apparmor.h src/security/security_apparmor.c src/security/security_driver.c
* maint: include ignore-value in internal.hPeter Krempa2012-06-281-1/+0
| | | | | The ignore_value macro is used across libvirt. This patch includes it in the internal header and cleans all other includes.
* build: properly skip testsEric Blake2011-12-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | I got this failure on FreeBSD: shunloadtest.c: In function 'main': shunloadtest.c:150: error: 'EXIT_AM_SKIP' undeclared (first use in this function) but inspection showed several other problems, all fixed here. * tests/domainsnapshotxml2xmltest.c [!WITH_QEMU]: Ensure EXIT_AM_SKIP is defined. * tests/esxutilstest.c [!WITH_ESX]: Likewise. * tests/openvzutilstest.c [!WITH_OPENVZ]: Likewise. * tests/qemuargv2xmltest.c [!WITH_QEMU]: Likewise. * tests/qemuhelptest.c [!WITH_QEMU]: Likewise. * tests/qemuxml2argvtest.c [!WITH_QEMU]: Likewise. * tests/qemuxml2xmltest.c [!WITH_QEMU]: Likewise. * tests/qemuxmlnstest.c [!WITH_QEMU]: Likewise. * tests/shunloadtest.c [!linux]: Likewise. * tests/vmx2xmltest.c [!WITH_VMX]: Likewise. * tests/xml2vmxtest.c [!WITH_VMX]: Likewise.
* Avoid crash in shunloadtestDaniel P. Berrange2011-12-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | For unknown reasons, the shunloadtest will crash on Fedora 16 inside dlopen() (gdb) bt #0 0x00000000000050e6 in ?? () #1 0x00007ff61a77b9d5 in floor () from /lib64/libm.so.6 #2 0x00007ff61e522963 in _dl_relocate_object () from /lib64/ld-linux-x86-64.so.2 #3 0x00007ff61e5297e6 in dl_open_worker () from /lib64/ld-linux-x86-64.so.2 #4 0x00007ff61e525006 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2 #5 0x00007ff61e52917a in _dl_open () from /lib64/ld-linux-x86-64.so.2 #6 0x00007ff61e0f6f26 in dlopen_doit () from /lib64/libdl.so.2 #7 0x00007ff61e525006 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2 #8 0x00007ff61e0f752f in _dlerror_run () from /lib64/libdl.so.2 #9 0x00007ff61e0f6fc1 in dlopen@@GLIBC_2.2.5 () from /lib64/libdl.so.2 #10 0x0000000000400a15 in main (argc=<optimized out>, argv=<optimized out>) at shunloadtest.c:105 Changing from RTLD_NOW to RTLD_LAZY avoids this problem, but quite possibly does not fix the root cause. * shunloadtest.c: s/NOW/LAZY/
* Prevent crash from dlclose() of libvirt.soDaniel P. Berrange2011-09-161-0/+153
When libvirt calls virInitialize it creates a thread local for the virErrorPtr storage, and registers a callback to cleanup memory when a thread exits. When libvirt is dlclose()d or otherwise made non-resident, the callback function is removed from memory, but the thread local may still exist and if a thread later exists, it will invoke the callback and SEGV. There may also be other thread locals with callbacks pointing to libvirt code, so it is in general never safe to unload libvirt.so from memory once initialized. To allow dlclose() to succeed, but keep libvirt.so resident in memory, link with '-z nodelete'. This issue was first found with the libvirt CIM provider, but can potentially hit many of the dynamic language bindings which all ultimately involve dlopen() in some way, either on libvirt.so itself, or on the glue code for the binding which in turns links to libvirt * configure.ac, src/Makefile.am: Ensure libvirt.so is linked with -z nodelete * cfg.mk, .gitignore, tests/Makefile.am, tests/shunloadhelper.c, tests/shunloadtest.c: A test case to unload libvirt while a thread is still running.