void ValgrindMemcheckParserTest::testMemcheckSample2()
{
    QSKIP("testfile does not exist");

    initTest("memcheck-output-sample2.xml");

    Parser parser;
    Recorder rec(&parser);

    parser.parse(m_socket);

    m_process->waitForFinished();
    QCOMPARE(m_process->exitStatus(), QProcess::NormalExit);
    QCOMPARE(m_process->state(), QProcess::NotRunning);
    QVERIFY2(parser.errorString().isEmpty(), qPrintable(parser.errorString()));

    //tests: multiple stacks with auxwhat == stack count - 1.
    //the first auxwhat should be assigned to the _second_ stack.
    const QList<Error> errors = rec.errors;
    QCOMPARE(errors.size(), 1);
    const QVector<Stack> stacks = errors.first().stacks();
    QCOMPARE(stacks.size(), 2);
    QCOMPARE(stacks.first().auxWhat(), QString());
    QCOMPARE(stacks.last().auxWhat(), "Address 0x11b66c50 is 0 bytes inside a block of size 16 free'd");
}
Esempio n. 2
0
int main (int, char **/*argv*/) try
{
  initTest();

  IOSize	n;
  char		buf [1024];
  Storage	*s = StorageFactory::get ()->open
    ("http://cmsdoc.cern.ch/cms.html", IOFlags::OpenRead);

  assert (s);
  while ((n = s->read (buf, sizeof (buf))))
    std::cout.write (buf, n);

  s->close();
  delete s;

  std::cerr << StorageAccount::summaryXML () << std::endl;
  return EXIT_SUCCESS;
} catch(cms::Exception const& e) {
  std::cerr << e.explainSelf() << std::endl;
  return EXIT_FAILURE;
} catch(std::exception const& e) {
  std::cerr << e.what() << std::endl;
  return EXIT_FAILURE;
}
Esempio n. 3
0
void TestTableLayout::testCellRowSpanningCellHeight()
{
    QList<KoTableColumnStyle *> columnStyles;
    QList<KoTableRowStyle *> rowStyles;
    QMap<QPair<int, int>, KoTableCellStyle *> cellStyles;
    QMap<QPair<int, int>, QString> cellTexts;
    cellTexts.insert(qMakePair(0, 0), "A\nB\nC\nD\nE");

    initTest(2, 2, 0, columnStyles, rowStyles, cellStyles, cellTexts);
    m_table->mergeCells(0, 0, 2, 1);
    m_layout->layout();

    /*
     * Cell 1,1 rules:
     *
     * +-------------------+-------------------+
     * | A                 |                   |
     * |                   +-------------------+
     * | B                 | x = 100 (200/2)   |
     * | C                 | y = 14.4 (1*14.4) |
     * | D                 | w = 100 (200/2)   |
     * | E                 | h = 57.6 (4*14.4) |
     * +-------------------+-------------------+
     */
    QTextTableCell cell4 = m_table->cellAt(1, 1);
    // We have to check the geometries of the rect individually, as there
    // are rounding to consider in the height.
    QCOMPARE(m_textLayout->m_tableLayout.cellBoundingRect(cell4).x(), 100.0);
    QCOMPARE(m_textLayout->m_tableLayout.cellBoundingRect(cell4).y(), 14.4);
    QCOMPARE(m_textLayout->m_tableLayout.cellBoundingRect(cell4).width(), 100.0);
    QVERIFY((m_textLayout->m_tableLayout.cellBoundingRect(cell4).height() - 57.6) < 0.125);

    cleanupTest();
}
Esempio n. 4
0
      /*! \brief Attaches the buffer to a vertex attribute pointer
       * state.
       */
      inline void attachToAttribute(size_t attrnum, size_t components, size_t divisor = 0, bool normalise = false)
      {
	initTest();
	bind(buffer_targets::ARRAY);	
	glVertexAttribPointer(attrnum, components, detail::c_type_to_gl_enum<T>::val,
			      (normalise ? GL_TRUE : GL_FALSE), components * sizeof(T), 0);

	_context->setAttributeDivisor(attrnum, divisor);
	_context->enableAttributeArray(attrnum);
      }
Esempio n. 5
0
void setup_test()
{
   initTest( &context );
   InitMem( &context );

   psonLinkNodeInit( &node, &context );
   psonLinkedListInit( &list, &context );
   
   psonLinkedListPutLast( &list, &node, &context );
}
Esempio n. 6
0
void TestTableLayout::initTestSimple(int rows, int columns, KoTableStyle *tableStyle)
{
    // initTest() will use default ones for these.
    QList<KoTableColumnStyle *> columnStyles;
    QList<KoTableRowStyle *> rowStyles;
    QMap<QPair<int, int>, KoTableCellStyle *> cellStyles;
    QMap<QPair<int, int>, QString> cellTexts;

    initTest(rows, columns, tableStyle, columnStyles, rowStyles, cellStyles, cellTexts);
}
Esempio n. 7
0
      /*! \brief Draw all the elements in the current buffer multiple
       * times using instancing.
       */
      inline void drawInstancedElements(element_type::Enum type, size_t instances)
      { 
	initTest();
	bind(buffer_targets::ELEMENT_ARRAY);
	if (GLEW_EXT_draw_instanced)
	  glDrawElementsInstancedEXT(type, size(), detail::c_type_to_gl_enum<T>::val, 0, instances);
	else if (GLEW_ARB_draw_instanced)
	  glDrawElementsInstancedEXT(type, size(), detail::c_type_to_gl_enum<T>::val, 0, instances);
	else
	  M_throw() << "Cannot perform instanced drawing, GL_ARB_draw_instanced/GL_EXT_draw_instanced extensions are missing.";
      }
Esempio n. 8
0
int main()
{
#if defined(USE_DBC)
   psonSessionContext context;

   initTest( expectedToPass, &context );
   InitMem();
   
   psonLinkedListInit( NULL );
   
   ERROR_EXIT( expectedToPass, NULL, ; );
Esempio n. 9
0
int main()
{
   psonMemAlloc*     pAlloc;
   unsigned char* ptr;
   size_t allocatedLength = PSON_BLOCK_SIZE*10;
   psonSessionContext context;
   
   initTest( expectedToPass, &context );
   
   ptr = malloc( allocatedLength );
   if ( ptr == NULL ) {
      ERROR_EXIT( expectedToPass, NULL, ; );
Esempio n. 10
0
int main()
{
#if defined(USE_DBC)
   psonMemBitmap *pBitmap;
   unsigned char* ptr;
   psonSessionContext context;
   
   initTest( expectedToPass, &context );

   ptr = malloc( PSON_BLOCK_SIZE*10 );
   if (ptr == NULL ) {
      ERROR_EXIT( expectedToPass, NULL, ; );
void ValgrindMemcheckParserTest::testValgrindGarbage()
{
    initTest("memcheck-output-sample1.xml", QStringList("--garbage"));

    Parser parser;
    parser.parse(m_socket);
    m_process->waitForFinished();
    QCOMPARE(m_process->state(), QProcess::NotRunning);
    QCOMPARE(m_process->exitStatus(), QProcess::NormalExit);

    QVERIFY(!parser.errorString().isEmpty());
    qDebug() << parser.errorString();
}
void ValgrindMemcheckParserTest::testMemcheckSample3()
{
    QSKIP("testfile does not exist");

    initTest("memcheck-output-sample3.xml");

    Parser parser;
    Recorder rec(&parser);

    parser.parse(m_socket);

    m_process->waitForFinished();
    QCOMPARE(m_process->exitStatus(), QProcess::NormalExit);
    QCOMPARE(m_process->state(), QProcess::NotRunning);
    QVERIFY2(parser.errorString().isEmpty(), qPrintable(parser.errorString()));

    const QList<Error> errors = rec.errors;
    QCOMPARE(errors.size(), 6);

    {
        const Error error = errors.at(0);
        const QVector<Stack> stacks = error.stacks();

        QCOMPARE(error.unique(), 0x1ll);
        QCOMPARE(error.what(), "Conditional jump or move depends on uninitialised value(s)");
        QCOMPARE(error.kind(), UninitCondition);
        QCOMPARE(stacks.size(), 1);
        QCOMPARE(stacks.first().frames().size(), 12);
        QVERIFY(!error.suppression().isNull());
        QCOMPARE(error.suppression().frames().count(), stacks.first().frames().size());
        QCOMPARE(error.suppression().kind(), "Memcheck:Cond");
        QVERIFY(!error.suppression().rawText().trimmed().isEmpty());

        // rawtext contains <...> while <name></name> does not
        QCOMPARE(error.suppression().name(), "insert_a_suppression_name_here");
        Suppression sup = error.suppression();
        sup.setName("<insert_a_suppression_name_here>");
        QCOMPARE(sup.toString().trimmed(), sup.rawText().trimmed());

        QCOMPARE(error.suppression().frames().first().object(),
                 "/usr/lib/kde4/plugins/styles/qtcurve.so");
        QVERIFY(error.suppression().frames().first().function().isEmpty());
        QCOMPARE(error.suppression().frames().last().function(), "main");
        QVERIFY(error.suppression().frames().last().object().isEmpty());
    }

    QCOMPARE(rec.suppcounts.count(), 3);
    QCOMPARE(rec.suppcounts.at(0).second, qint64(1));
    QCOMPARE(rec.suppcounts.at(1).second, qint64(2));
    QCOMPARE(rec.suppcounts.at(2).second, qint64(3));
}
Esempio n. 13
0
DEF_TEST(SkpSkGrOneOff, reporter) {
    if (!initTest()) {
        return;
    }
    int testIndex = 166;
    int dirIndex = skipOverSkGr[testIndex - 166].directory;
    SkString pictDir = make_in_dir_name(dirIndex);
    if (pictDir.size() == 0) {
        return;
    }
    SkString filename(skipOverSkGr[testIndex - 166].filename);
    TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose());
    TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose());
}
Esempio n. 14
0
int main()
{
   psonLinkedList list;
   psonSessionContext context;
   
   initTest( expectedToPass, &context );
   InitMem();
   
   psonLinkedListInit( &list );
   
   psonLinkedListFini( &list );
   
   return 0;
}
void ValgrindMemcheckParserTest::testValgrindCrash()
{
    initTest("memcheck-output-sample1.xml", QStringList("--crash"));

    Parser parser;
    parser.parse(m_socket);
    m_process->waitForFinished();
    QCOMPARE(m_process->state(), QProcess::NotRunning);
    QCOMPARE(m_process->exitStatus(), QProcess::CrashExit);

    QVERIFY(!parser.errorString().isEmpty());
    QCOMPARE(m_socket->error(), QAbstractSocket::RemoteHostClosedError);
    QCOMPARE(parser.errorString(), m_socket->errorString());
}
Esempio n. 16
0
void setup_test()
{
   
   initTest( &context );

   ptr = malloc( PSON_BLOCK_SIZE*10 );
   assert( ptr != NULL );
   context.pBaseAddress = ptr;
   
   /* This "100" (non-zero) offset should mark this block group 
    * as the first block group of a MemObject.
    */
   pGroup = (psonBlockGroup*) (ptr + 100);
   
}
Esempio n. 17
0
int main()
{
   psonLinkedList list;
   psonLinkNode node;
   psonSessionContext context;
   
   initTest( expectedToPass, &context );
   InitMem();
   
   psonLinkNodeInit( &node );
   psonLinkedListInit( &list );

   psonLinkedListPutLast( &list, &node );
   if ( list.currentSize != 1 ) {
      ERROR_EXIT( expectedToPass, NULL, ; );
Esempio n. 18
0
int main (int, char **/*argv*/) try
{
  initTest();

  bool exists = StorageFactory::get ()->check ("/etc/passwdx");
  std::cout << "exists = " << exists << "\n";
  std::cout << "stats:\n" << StorageAccount::summaryText () << std::endl;
  return EXIT_SUCCESS;
} catch(cms::Exception const& e) {
  std::cerr << e.explainSelf() << std::endl;
  return EXIT_FAILURE;
} catch(std::exception const& e) {
  std::cerr << e.what() << std::endl;
  return EXIT_FAILURE;
}
	bool begin()
	{
		bool Validated = true;

		if(Validated)
			Validated = initTest();
		if(Validated)
			Validated = initProgram();
		if(Validated)
			Validated = initBuffer();
		if(Validated)
			Validated = initVertexArray();

		return Validated && this->checkError("begin");
	}
Esempio n. 20
0
      /*! \brief Releases the OpenCL representation of this GL buffer.
       *
       * This only releases the OpenCL representation if the \ref
       * releaseCLObject() calls match the number of \ref
       * acquireCLObject() calls.
       */
      inline void releaseCLObject()
      { 
	initTest(); 
#ifdef MAGNET_DEBUG
	if (!_cl_handle_init)
	  M_throw() << "Cannot release CL Object, its not initialised!";
	if (_cl_buffer_acquired == 0)
	  M_throw() << "Trying to release an already released object!";
#endif
	if (--_cl_buffer_acquired == 0)
	  {
	    std::vector<cl::Memory> buffers;
	    buffers.push_back(_cl_handle);
	    _context->getCLCommandQueue().enqueueReleaseGLObjects(&buffers);
	  }
      }
Esempio n. 21
0
int main()
{
   psonSessionContext context;
   psonMemAlloc*     pAlloc;
   unsigned char* ptr;
   size_t allocatedLength, i;
   unsigned char* buffer[8*PSON_BLOCK_SIZE-2];
   psonMemBitmap* pBitmap;

   initTest( expectedToPass, &context );
   
   allocatedLength = 8*PSON_BLOCK_SIZE*PSON_BLOCK_SIZE;

   ptr = malloc( allocatedLength );
   if ( ptr == NULL ) {
      ERROR_EXIT( expectedToPass, NULL, ; );
Esempio n. 22
0
int main()
{
#if defined(USE_DBC)
   psonLinkedList list;
   psonLinkNode node;
   psonSessionContext context;
   
   initTest( expectedToPass, &context );
   InitMem();
   
   psonLinkNodeInit( &node );
   psonLinkedListInit( &list );
   
   psonLinkedListPutLast( NULL, &node );

   ERROR_EXIT( expectedToPass, NULL, ; );
Esempio n. 23
0
int main()
{
#if defined(USE_DBC)
   psonLinkedList list;
   psonLinkNode* pNode;
   psonSessionContext context;
   
   initTest( expectedToPass, &context );
   InitMem();
   
   psonLinkedListInit( &list );
   list.initialized = 0;
   
   psonLinkedListGetLast( &list, &pNode );
   
   ERROR_EXIT( expectedToPass, NULL, ; );
Esempio n. 24
0
int main(int, char** /*argv*/) try {
  initTest();

  IOOffset size = -1;
  bool exists = StorageFactory::get()->check("ftp://cmsdoc.cern.ch/WELCOME", &size);

  std::cout << "exists = " << exists << ", size = " << size << "\n";
  std::cout << StorageAccount::summaryText(true) << std::endl;
  return EXIT_SUCCESS;
} catch (cms::Exception const& e) {
  std::cerr << e.explainSelf() << std::endl;
  return EXIT_FAILURE;
} catch (std::exception const& e) {
  std::cerr << e.what() << std::endl;
  return EXIT_FAILURE;
}
Esempio n. 25
0
int main()
{
   psonLinkedList list;
   psonLinkNode* pNode = NULL;
   bool ok;
   psonSessionContext context;
  
   initTest( expectedToPass, &context );
   InitMem();
   
   psonLinkedListInit( &list );
   
   psonLinkedListReset( &list );

   if ( list.initialized != PSON_LIST_SIGNATURE ) {
      ERROR_EXIT( expectedToPass, NULL, ; );
Esempio n. 26
0
void TestTableLayout::testCellStyles()
{
    QList<KoTableColumnStyle *> columnStyles;
    QList<KoTableRowStyle *> rowStyles;
    QMap<QPair<int, int>, KoTableCellStyle *> cellStyles;
    /*
     * Set a style for cell 0, 0:
     * - 8 pt padding.
     * - 7 pt double black border (4 pt inner, 2 pt spacing, 1 pt inner)
     */
    KoTableCellStyle *cell1Style = new KoTableCellStyle();
    Q_ASSERT(cell1Style);
    cell1Style->setPadding(8.0);
    cell1Style->setEdge(KoTableCellStyle::Left, KoTableCellStyle::BorderSolid, 7.0, Qt::black);
    cell1Style->setEdgeDoubleBorderValues(KoTableCellStyle::Left, 1.0, 2.0);
    cell1Style->setEdge(KoTableCellStyle::Right, KoTableCellStyle::BorderSolid, 7.0, Qt::black);
    cell1Style->setEdgeDoubleBorderValues(KoTableCellStyle::Right, 1.0, 2.0);
    cell1Style->setEdge(KoTableCellStyle::Top, KoTableCellStyle::BorderSolid, 7.0, Qt::black);
    cell1Style->setEdgeDoubleBorderValues(KoTableCellStyle::Top, 1.0, 2.0);
    cell1Style->setEdge(KoTableCellStyle::Bottom, KoTableCellStyle::BorderSolid, 7.0, Qt::black);
    cell1Style->setEdgeDoubleBorderValues(KoTableCellStyle::Bottom, 1.0, 2.0);
    cellStyles.insert(qMakePair(0, 0), cell1Style);
    QMap<QPair<int, int>, QString> cellTexts;

    initTest(2, 2, 0, columnStyles, rowStyles, cellStyles, cellTexts);

    m_layout->layout();

    /*
     * Cell 0, 0 rules:
     *   x = 1 + 2 + 4 (border) + 8 (padding) = 15
     *   y = 1 + 2 + 4 (border) + 8 (padding) = 15
     *   width = 100 - (2 * 7) (border) - (2 * 8) (padding) = 70
     *   height = 14.4 (one line)
     */
    QTextTableCell cell1 = m_table->cellAt(0, 0);
    QTextTableCellFormat cell1Format = cell1.format().toTableCellFormat();
    QCOMPARE(m_textLayout->m_tableLayout.cellContentRect(cell1), QRectF(15, 15, 70, 14.4));

    /*
     * TODO:
     * - Test actual block positions too.
     * - Fix the compare above once we support min row height.
     */

    cleanupTest();
}
Esempio n. 27
0
int main(int, char** /*argv*/) try {
  initTest();

  bool exists = StorageFactory::get()->check(
      "rfio:/castor/cern.ch/cms/reconstruction/datafiles/"
      "ORCA_7_5_2/PoolFileCatalog.xmlx");

  std::cout << "exists = " << exists << "\n";
  std::cout << StorageAccount::summaryText(true) << std::endl;
  return EXIT_SUCCESS;
} catch (cms::Exception const& e) {
  std::cerr << e.explainSelf() << std::endl;
  return EXIT_FAILURE;
} catch (std::exception const& e) {
  std::cerr << e.what() << std::endl;
  return EXIT_FAILURE;
}
Esempio n. 28
0
bool begin()
{
	bool Validated = glf::checkGLVersion(SAMPLE_MAJOR_VERSION, SAMPLE_MINOR_VERSION);

	if(Validated)
		Validated = initTest();
	if(Validated)
		Validated = initProgram();
	if(Validated)
		Validated = initTextureBuffer();
	if(Validated)
		Validated = initArrayBuffer();
	if(Validated)
		Validated = initVertexArray();

	return Validated && glf::checkError("begin");
}
	bool begin()
	{
		bool Validated(true);
		Validated = Validated && this->checkExtension("GL_ARB_explicit_uniform_location");

		if(Validated)
			Validated = initTest();
		if(Validated)
			Validated = initProgram();
		if(Validated)
			Validated = initBuffer();
		if(Validated)
			Validated = initVertexArray();
		if(Validated)
			Validated = initTexture();

		return Validated;
	}
Esempio n. 30
0
int main()
{
   psonLinkedList list;
   psonLinkNode node, *pNode;
   bool ok;
   psonSessionContext context;
   
   initTest( expectedToPass, &context );
   InitMem();
   
   psonLinkNodeInit( &node );
   psonLinkedListInit( &list );
   
   psonLinkedListPutLast( &list, &node );
   
   ok = psonLinkedListGetFirst( &list, &pNode );
   if ( ! ok ) {
      ERROR_EXIT( expectedToPass, NULL, ; );