Changeset View
Changeset View
Standalone View
Standalone View
src/tests/crashtest/crashtest.cpp
Show All 25 Lines | |||||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | *****************************************************************/ | 27 | *****************************************************************/ | ||
28 | 28 | | |||
29 | // Let's crash. | 29 | // Let's crash. | ||
30 | #include <kcrash.h> | 30 | #include <kcrash.h> | ||
31 | #include <kaboutdata.h> | 31 | #include <kaboutdata.h> | ||
32 | #include <assert.h> | 32 | #include <assert.h> | ||
33 | #include <QtConcurrentMap> | 33 | #include <QtConcurrentMap> | ||
34 | #include <KLocalizedString> | | |||
35 | #include <QCommandLineParser> | 34 | #include <QCommandLineParser> | ||
36 | #include <QApplication> | 35 | #include <QGuiApplication> | ||
37 | #include <KAboutData> | 36 | #include <KAboutData> | ||
38 | 37 | | |||
39 | enum CrashType { Crash, Malloc, Div0, Assert, QAssert, Threads, FatalErrorMessage }; | 38 | enum CrashType { Crash, Malloc, Div0, Assert, QAssert, Threads, FatalErrorMessage }; | ||
40 | 39 | | |||
41 | struct SomeStruct | 40 | struct SomeStruct | ||
42 | { | 41 | { | ||
43 | int foo() { return ret; } | 42 | int foo() { return ret; } | ||
44 | int ret; | 43 | int ret; | ||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | |||||
124 | 123 | | |||
125 | void level1(int t) | 124 | void level1(int t) | ||
126 | { | 125 | { | ||
127 | level2(t); | 126 | level2(t); | ||
128 | } | 127 | } | ||
129 | 128 | | |||
130 | int main(int argc, char *argv[]) | 129 | int main(int argc, char *argv[]) | ||
131 | { | 130 | { | ||
132 | QApplication app(argc, argv); | 131 | QGuiApplication app(argc, argv); | ||
133 | KAboutData aboutData(QStringLiteral("crashtext"), i18n("Crash Test for DrKonqi"), | 132 | KAboutData aboutData(QStringLiteral("crashtest"), QStringLiteral("Crash Test for DrKonqi"), | ||
134 | QStringLiteral("1.1"), | 133 | QStringLiteral("1.1"), | ||
135 | i18n("Crash Test for DrKonqi"), | 134 | QStringLiteral("Crash Test for DrKonqi"), | ||
136 | KAboutLicense::GPL, | 135 | KAboutLicense::GPL, | ||
137 | i18n("(c) 2000-2002 David Faure, Waldo Bastian")); | 136 | QStringLiteral("(c) 2000-2002 David Faure, Waldo Bastian")); | ||
138 | 137 | | |||
139 | QCommandLineParser parser; | 138 | QCommandLineParser parser; | ||
140 | parser.addOption(QCommandLineOption(QStringLiteral("autorestart"), i18n("Automatically restart"))); | 139 | parser.addOption(QCommandLineOption(QStringLiteral("autorestart"), QStringLiteral("Automatically restart"))); | ||
141 | parser.addOption(QCommandLineOption(QStringLiteral("kdeinit"), i18n("Start DrKonqi using kdeinit"))); | 140 | parser.addOption(QCommandLineOption(QStringLiteral("kdeinit"), QStringLiteral("Start DrKonqi using kdeinit"))); | ||
142 | parser.addPositionalArgument(QStringLiteral("type"), i18n("Type of crash."), QStringLiteral("crash|malloc|div0|assert|threads|fatal")); | 141 | parser.addPositionalArgument(QStringLiteral("type"), QStringLiteral("Type of crash."), QStringLiteral("crash|malloc|div0|assert|threads|fatal")); | ||
143 | aboutData.setupCommandLine(&parser); | 142 | aboutData.setupCommandLine(&parser); | ||
144 | parser.process(app); | 143 | parser.process(app); | ||
145 | aboutData.processCommandLine(&parser); | 144 | aboutData.processCommandLine(&parser); | ||
146 | 145 | | |||
147 | // Start drkonqi directly by default so that drkonqi's output goes to the console. | 146 | // Start drkonqi directly by default so that drkonqi's output goes to the console. | ||
148 | KCrash::CrashFlags flags = KCrash::AlwaysDirectly; | 147 | KCrash::CrashFlags flags = KCrash::AlwaysDirectly; | ||
149 | // This can be disabled to be able to test kcrash's real default behavior. | 148 | // This can be disabled to be able to test kcrash's real default behavior. | ||
150 | if (parser.isSet(QStringLiteral("kdeinit"))) | 149 | if (parser.isSet(QStringLiteral("kdeinit"))) | ||
Show All 22 Lines |