Changeset View
Changeset View
Standalone View
Standalone View
src/tests/crashtest/crashtest.cpp
Show First 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | 123 | { | |||
---|---|---|---|---|---|
125 | KAboutData aboutData(QStringLiteral("crashtext"), i18n("Crash Test for DrKonqi"), | 125 | KAboutData aboutData(QStringLiteral("crashtext"), i18n("Crash Test for DrKonqi"), | ||
126 | QStringLiteral("1.1"), | 126 | QStringLiteral("1.1"), | ||
127 | i18n("Crash Test for DrKonqi"), | 127 | i18n("Crash Test for DrKonqi"), | ||
128 | KAboutLicense::GPL, | 128 | KAboutLicense::GPL, | ||
129 | i18n("(c) 2000-2002 David Faure, Waldo Bastian")); | 129 | i18n("(c) 2000-2002 David Faure, Waldo Bastian")); | ||
130 | 130 | | |||
131 | QCommandLineParser parser; | 131 | QCommandLineParser parser; | ||
132 | parser.addOption(QCommandLineOption(QStringLiteral("autorestart"), i18n("Automatically restart"))); | 132 | parser.addOption(QCommandLineOption(QStringLiteral("autorestart"), i18n("Automatically restart"))); | ||
133 | parser.addOption(QCommandLineOption(QStringLiteral("kdeinit"), i18n("Start DrKonqi using kdeinit"))); | ||||
ossi: this addition isn't used or explained anywhere for all i can tell. | |||||
It's used to unset the AlwaysDirectly flag. It allows testing using with direct start and kdeinit start. croick: It's used to unset the `AlwaysDirectly` flag. It allows testing using with direct start and… | |||||
133 | parser.addPositionalArgument(QStringLiteral("type"), i18n("Type of crash."), QStringLiteral("crash|malloc|div0|assert|threads")); | 134 | parser.addPositionalArgument(QStringLiteral("type"), i18n("Type of crash."), QStringLiteral("crash|malloc|div0|assert|threads")); | ||
134 | aboutData.setupCommandLine(&parser); | 135 | aboutData.setupCommandLine(&parser); | ||
135 | parser.process(app); | 136 | parser.process(app); | ||
136 | aboutData.processCommandLine(&parser); | 137 | aboutData.processCommandLine(&parser); | ||
137 | 138 | | |||
138 | //start drkonqi directly so that drkonqi's output goes to the console | 139 | // Start drkonqi directly by default so that drkonqi's output goes to the console. | ||
That reasoning does not seem to be true. The output can still be read when started "normally". croick: That reasoning does not seem to be true. The output can still be read when started "normally". | |||||
only if kdeinit was started from the same console, which you cannot assume. also, this change wouldn't belong into this patch anyway. ossi: only if kdeinit was started from the same console, which you cannot assume.
also, this change… | |||||
croick: Agreed, I added an option instead and would commit that separately. | |||||
add comment: this can be disabled to be able to test kcrash's real default behavior. ossi: add comment: this can be disabled to be able to test kcrash's real default behavior. | |||||
139 | KCrash::CrashFlags flags = KCrash::AlwaysDirectly; | 140 | KCrash::CrashFlags flags = KCrash::AlwaysDirectly; | ||
141 | // This can be disabled to be able to test kcrash's real default behavior. | ||||
142 | if (parser.isSet(QStringLiteral("kdeinit"))) | ||||
143 | flags &= ~KCrash::AlwaysDirectly; | ||||
140 | if (parser.isSet(QStringLiteral("autorestart"))) | 144 | if (parser.isSet(QStringLiteral("autorestart"))) | ||
141 | flags |= KCrash::AutoRestart; | 145 | flags |= KCrash::AutoRestart; | ||
142 | KCrash::setFlags(flags); | 146 | KCrash::setFlags(flags); | ||
ossi: move that up, so the AlwaysDirectly stuff is in one block. | |||||
143 | 147 | | |||
144 | QByteArray type = parser.positionalArguments().isEmpty() ? QByteArray() : parser.positionalArguments().first().toUtf8(); | 148 | QByteArray type = parser.positionalArguments().isEmpty() ? QByteArray() : parser.positionalArguments().first().toUtf8(); | ||
145 | int crashtype = Crash; | 149 | int crashtype = Crash; | ||
146 | if (type == "malloc") | 150 | if (type == "malloc") | ||
147 | crashtype = Malloc; | 151 | crashtype = Malloc; | ||
148 | else if (type == "div0") | 152 | else if (type == "div0") | ||
149 | crashtype = Div0; | 153 | crashtype = Div0; | ||
150 | else if (type == "assert") | 154 | else if (type == "assert") | ||
151 | crashtype = Assert; | 155 | crashtype = Assert; | ||
152 | else if (type == "qassert") | 156 | else if (type == "qassert") | ||
153 | crashtype = QAssert; | 157 | crashtype = QAssert; | ||
154 | else if (type == "threads") | 158 | else if (type == "threads") | ||
155 | crashtype = Threads; | 159 | crashtype = Threads; | ||
156 | level1(crashtype); | 160 | level1(crashtype); | ||
157 | return app.exec(); | 161 | return app.exec(); | ||
158 | } | 162 | } |
this addition isn't used or explained anywhere for all i can tell.