diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-09-29 21:42:21 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-10-08 06:41:05 +0000 |
commit | f27e029ef2e8400b803cec1b17ffd4e244d8610a (patch) | |
tree | 1c9dc915bf6336e747badedeba7a4a9563f723ab /tests/auto/corelib/io/qlockfile/qlockfiletesthelper | |
parent | f0096a2bd329249528ffb21599c3378ecd3d856e (diff) |
Autotest: use _exit() instead of exit() to simulate an unclean exit
We're not going to crash to avoid core dumps getting recorded by
systemd, filling up filesystems or showing dialog boxes. We just need to
exit without running destructors. Now, exit() isn't supposed to run
function-scope destructors, so just in case we use _exit().
Change-Id: I0b48fc8e90304e0dacc3fffd14e909ff248ce1a1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'tests/auto/corelib/io/qlockfile/qlockfiletesthelper')
-rw-r--r-- | tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp index f10c2a7c98..e086bf1904 100644 --- a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp +++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp @@ -31,6 +31,12 @@ #include <QLockFile> #include <QThread> +#ifdef Q_OS_UNIX +# include <unistd.h> +#else +# include <stdlib.h> +#endif + int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); @@ -44,11 +50,11 @@ int main(int argc, char *argv[]) if (argc > 2) option = QString::fromLocal8Bit(argv[2]); - if (option == "-crash") { + if (option == "-uncleanexit") { QLockFile lockFile(lockName); lockFile.lock(); // exit on purpose, so that the lock remains! - exit(0); + _exit(0); } else if (option == "-busy") { QLockFile lockFile(lockName); lockFile.lock(); |