Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
898179f8
Commit
898179f8
authored
Apr 06, 2009
by
hjk
Browse files
debugger: work on auto test
parent
ad8eec7e
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/debuggermanager.cpp
View file @
898179f8
...
...
@@ -1172,7 +1172,7 @@ void DebuggerManager::setStatus(int status)
if
(
status
==
m_status
)
return
;
if
(
!
isAllowedTransition
(
m_status
,
status
))
{
if
(
0
&&
!
isAllowedTransition
(
m_status
,
status
))
{
const
QString
msg
=
QString
::
fromLatin1
(
"%1: UNEXPECTED TRANSITION: %2 -> %3"
).
arg
(
QLatin1String
(
Q_FUNC_INFO
),
QLatin1String
(
stateName
(
m_status
)),
QLatin1String
(
stateName
(
status
)));
qWarning
(
"%s"
,
qPrintable
(
msg
));
...
...
@@ -1449,4 +1449,27 @@ void DebuggerManager::reloadRegisters()
}
//////////////////////////////////////////////////////////////////////
//
// Testing
//
//////////////////////////////////////////////////////////////////////
void
DebuggerManager
::
runTest
(
const
QString
&
fileName
)
{
m_executable
=
fileName
;
m_processArgs
=
QStringList
()
<<
"--run-debuggee"
;
m_workingDir
=
QString
();
qDebug
()
<<
"TESTING: "
<<
fileName
;
//QFile file(fileName);
//file.open(QIODevice::ReadOnly);
//QTextStream ts(&file);
//foreach (QString line, ts.readAll().split('\n')) {
// qDebug() << "TESTING: " << line;
// if (line.startsWith("Executable="))
//}
startNewDebugger
(
StartInternal
);
}
#include "debuggermanager.moc"
src/plugins/debugger/debuggermanager.h
View file @
898179f8
...
...
@@ -341,6 +341,7 @@ public:
private:
void
init
();
void
setDebuggerType
(
DebuggerType
type
);
void
runTest
(
const
QString
&
fileName
);
QDockWidget
*
createDockForWidget
(
QWidget
*
widget
);
Q_SLOT
void
createNewDock
(
QWidget
*
widget
);
...
...
src/plugins/debugger/debuggerplugin.cpp
View file @
898179f8
...
...
@@ -797,6 +797,10 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
void
DebuggerPlugin
::
extensionsInitialized
()
{
// time gdb -i mi -ex 'debuggerplugin.cpp:800' -ex r -ex q bin/qtcreator.bin
qDebug
()
<<
"EXTENSIONS INITIALIZED"
;
QByteArray
env
=
qgetenv
(
"QTC_DEBUGGER_TEST"
);
if
(
!
env
.
isEmpty
())
m_manager
->
runTest
(
QString
::
fromLocal8Bit
(
env
));
}
/*! Activates the previous mode when the current mode is the debug mode. */
...
...
tests/auto/debugger/debugger.pro
View file @
898179f8
QT
+
=
testlib
QT
=
core
testlib
DEBUGGERDIR
=
..
/../../
src
/
plugins
/
debugger
UTILSDIR
=
..
/../../
src
/
libs
...
...
tests/auto/debugger/main.cpp
View file @
898179f8
...
...
@@ -2,7 +2,10 @@
#include "gdbmi.h"
#include <QtCore/QObject>
#include <QtCore/QProcess>
#include <QtCore/QFileInfo>
#include <QtTest/QtTest>
//#include <QtTest/qtest_gui.h>
using
namespace
Debugger
;
using
namespace
Debugger
::
Internal
;
...
...
@@ -35,7 +38,6 @@ static const char test5[] =
"file=
\"
test1.cpp
\"
,fullname=
\"
/home/apoenitz/work/test1/test1.cpp
\"
,"
"line=
\"
209
\"
}]"
;
static
const
char
test8
[]
=
"[data={locals={{name=
\"
a
\"
},{name=
\"
w
\"
}}}]"
;
...
...
@@ -77,9 +79,48 @@ private slots:
void
mi10
()
{
testMi
(
test10
);
}
void
mi11
()
{
testMi
(
test11
);
}
void
mi12
()
{
testMi
(
test12
);
}
void
runQtc
();
};
QTEST_MAIN
(
tst_Debugger
)
void
tst_Debugger
::
runQtc
()
{
QString
test
=
QFileInfo
(
qApp
->
arguments
().
at
(
0
)).
absoluteFilePath
();
//QString qtc = QFileInfo(test + "../../bin/qtcreator.bin").absoluteFilePath();
QString
qtc
=
QFileInfo
(
test
).
absolutePath
()
+
"/../../../bin/qtcreator.bin"
;
qtc
=
QFileInfo
(
qtc
).
absoluteFilePath
();
QProcess
proc
;
QStringList
env
=
QProcess
::
systemEnvironment
();
env
.
append
(
"QTC_DEBUGGER_TEST="
+
test
);
proc
.
setEnvironment
(
env
);
qDebug
()
<<
"APP: "
<<
test
<<
qtc
;
foreach
(
QString
item
,
env
)
qDebug
()
<<
item
;
proc
.
start
(
qtc
);
proc
.
waitForStarted
();
QCOMPARE
(
proc
.
state
(),
QProcess
::
Running
);
proc
.
waitForFinished
();
QCOMPARE
(
proc
.
state
(),
QProcess
::
NotRunning
);
}
void
runDebuggee
()
{
qDebug
()
<<
"RUNNING DEBUGGEE"
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
QCoreApplication
app
(
argc
,
argv
);
QStringList
args
=
app
.
arguments
();
if
(
args
.
size
()
==
2
&&
args
.
at
(
1
)
==
"--run-debuggee"
)
{
runDebuggee
();
return
0
;
}
tst_Debugger
test
;
return
QTest
::
qExec
(
&
test
,
argc
,
argv
);
}
#include "main.moc"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment