我正在尝试将Jenkins xUnit插件用于我的Qt单元测试项目,但我无法使其工作......
这是我到目前为止所做的:
首先,我使用qmakebuilder插件构建我的单元测试项目(将.pro提供给qmakebuilder插件),然后我添加一个Execute Shell构建部分,我首先rm -f使用testResult xml文件,然后运行测试带有-xunitxml标志的二进制文件让它为我生成xml文件我用xml文件命名testResult.xml,换句话说:
rm -f /home/guest/QT/unitTest/testResult.xml
cd /home/guest/QT/unitTest
./tst_unittesttest -xunitxml > testResult.xml
Run Code Online (Sandbox Code Playgroud)
最后在Post Build Action中,我选择Publish xUnit test result并指定模式为*.xml.
但是构建作业会失败,这是我使用Jenkins构建作业时获得的输出:
[xUnit] [INFO] - Starting to record.
[xUnit] [INFO] - Processing QTestlib-Version N/A
[xUnit] [INFO] - [QTestlib-Version N/A] - 1 test report file(s) were found with
the pattern '*.xml' relative to '/home/guest/QT/unitTest' for the testing framework
'QTestlib-Version N/A'.
[xUnit] [ERROR] - The converted file for the …Run Code Online (Sandbox Code Playgroud) 我有一个类,我想在Qvariant中使用它,因此我需要声明并注册Meta类型.这就是我所做的:
class blabla: public QThread
{
Q_OBJECT
.
.
.
};
Q_DECLARE_METATYPE(blabla)
Run Code Online (Sandbox Code Playgroud)
但是这段代码给了我错误:
In copy constructor ‘QThread::QThread(const QThread&)’:
instantiated from ‘void* qMetaTypeConstructHelper(const T*) [with T = blabla]’
instantiated from ‘int qRegisterMetaType(const char*, T*) [with T = blabla]’
instantiated from here
‘QObject::QObject(const QObject&)’ is private
within this context
In file included from UnitTest.cpp:16:0:
blabla.h: In copy constructor ‘blabla::blabla(const blabla&)’:
note: synthesized method ‘QThread::QThread(const QThread&)’ first required here
In file included from /usr/include/QtCore/qvariant.h:48:0,
from /usr/include/QtCore/qabstractitemmodel.h:45,
from /usr/include/QtCore/QtCore:7,
from /usr/include/QtTest/QtTest:3,
from UnitTest.h:16,
from …Run Code Online (Sandbox Code Playgroud) 我正在使用线程处理壁纸并使用表面视图.我收到以下错误,无法解决它.有一个在他们告诉记者,有锁的顺序问题的答案surfaceHolder.lockcanvas()和surfaceHolder.unlockCanvasAndPost(canvas).但我检查,这是对的.请帮助某人.. LogCat如下:
07-06 12:58:24.459: E/SurfaceTextureClient(719): queueBuffer: error queuing buffer to SurfaceTexture, -19
07-06 12:58:24.459: E/SurfaceTextureClient(719): queueBuffer (handle=0x2a185508) failed (No such device)
07-06 12:58:24.470: W/System.err(719): java.lang.IllegalArgumentException
07-06 12:58:24.479: W/System.err(719): at android.view.Surface.nativeUnlockCanvasAndPost(Native Method)
07-06 12:58:24.489: W/System.err(719): at android.view.Surface.unlockCanvasAndPost(Surface.java:457)
07-06 12:58:24.489: W/System.err(719): at com.android.internal.view.BaseSurfaceHolder.unlockCanvasAndPost(BaseSurfaceHolder.java:215)
07-06 12:58:24.489: W/System.err(719): at com.shagun.sunsetlivewallpaper.BackgroundSelector$LeafThread.run(BackgroundSelector.java:160)
07-06 12:58:24.630: E/SurfaceTextureClient(719): dequeueBuffer failed (No such device)
07-06 12:58:24.649: E/InputEventReceiver(719): channel '40ee2318 com.shagun.sunsetlivewallpaper.WallpaperService (client)' ~ Publisher closed input channel or an error occurred. events=0x9
07-06 12:58:24.690: E/BaseSurfaceHolder(719): Exception locking …Run Code Online (Sandbox Code Playgroud) 我想.axml在另一个.axml使用xamarin android 包含一个文件的布局但是,当我使用<include> 它时不显示任何东西.有什么相当于<include>android在单声道android中,就像下面的链接:
我正在考虑将c ++用于性能关键应用程序.我认为C和C++都有相似的运行时间.但是我发现c ++函数需要运行4倍于可比较的C片段.
当我进行反汇编时,我看到end(),++,!=都是作为函数调用实现的.是否有可能使它们(至少其中一些)内联?
这是C++代码:
typedef struct pfx_s {
unsigned int start;
unsigned int end;
unsigned int count;
} pfx_t;
typedef std::list<pfx_t *> pfx_list_t;
int
eval_one_pkt (pfx_list_t *cfg, unsigned int ip_addr)
{
const_list_iter_t iter;
for (iter = cfg->begin(); iter != cfg->end(); iter++) {
if (((*iter)->start <= ip_addr) &&
((*iter)->end >= ip_addr)) {
(*iter)->count++;
return 1;
}
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这是等效的C代码:
int
eval_one_pkt (cfg_t *cfg, unsigned int ip_addr)
{
pfx_t *pfx;
TAILQ_FOREACH (pfx, &cfg->pfx_head, next) {
if ((pfx->start <= ip_addr) …Run Code Online (Sandbox Code Playgroud)