Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-24262

tst_QDBusAbstractInterface peer autotests are broken

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 4.8.0
    • D-Bus
    • None
    • qt/qt.git 2515d7abb9312ed26a8b6577f63177361e31cf88
      Ubuntu 10.04 32-bit

    Description

      I believe that the tst_QDBusAbstractInterface peer autotests are written wrongly.

      If you run tst_qdbusabstractinterface entirely, it usually seems to pass:

      [rmcgover@bq-menoetius qdbusabstractinterface]$ make check
      cd qpinger/ && /usr/bin/make -f Makefile check
      make[1]: Entering directory `/home/rmcgover/build/qt/4.8/tests/auto/qdbusabstractinterface/qpinger'
      make[1]: Nothing to be done for `check'.
      make[1]: Leaving directory `/home/rmcgover/build/qt/4.8/tests/auto/qdbusabstractinterface/qpinger'
      cd test/ && /usr/bin/make -f Makefile check
      make[1]: Entering directory `/home/rmcgover/build/qt/4.8/tests/auto/qdbusabstractinterface/test'
      cd ../ &&  ./tst_qdbusabstractinterface 
      ********* Start testing of tst_QDBusAbstractInterface *********
      Config: Using QTest library 4.8.0, Qt 4.8.0
      PASS   : tst_QDBusAbstractInterface::initTestCase()
      PASS   : tst_QDBusAbstractInterface::makeVoidCall()
      PASS   : tst_QDBusAbstractInterface::makeStringCall()
      PASS   : tst_QDBusAbstractInterface::makeComplexCall()
      PASS   : tst_QDBusAbstractInterface::makeMultiOutCall()
      PASS   : tst_QDBusAbstractInterface::makeVoidCallPeer()
      PASS   : tst_QDBusAbstractInterface::makeStringCallPeer()
      PASS   : tst_QDBusAbstractInterface::makeComplexCallPeer()
      PASS   : tst_QDBusAbstractInterface::makeMultiOutCallPeer()
      PASS   : tst_QDBusAbstractInterface::makeAsyncVoidCall()
      PASS   : tst_QDBusAbstractInterface::makeAsyncStringCall()
      PASS   : tst_QDBusAbstractInterface::makeAsyncComplexCall()
      PASS   : tst_QDBusAbstractInterface::makeAsyncMultiOutCall()
      PASS   : tst_QDBusAbstractInterface::makeAsyncVoidCallPeer()
      PASS   : tst_QDBusAbstractInterface::makeAsyncStringCallPeer()
      PASS   : tst_QDBusAbstractInterface::makeAsyncComplexCallPeer()
      PASS   : tst_QDBusAbstractInterface::makeAsyncMultiOutCallPeer()
      PASS   : tst_QDBusAbstractInterface::callWithTimeout()
      PASS   : tst_QDBusAbstractInterface::stringPropRead()
      PASS   : tst_QDBusAbstractInterface::stringPropWrite()
      PASS   : tst_QDBusAbstractInterface::variantPropRead()
      PASS   : tst_QDBusAbstractInterface::variantPropWrite()
      PASS   : tst_QDBusAbstractInterface::complexPropRead()
      PASS   : tst_QDBusAbstractInterface::complexPropWrite()
      PASS   : tst_QDBusAbstractInterface::stringPropReadPeer()
      PASS   : tst_QDBusAbstractInterface::stringPropWritePeer()
      PASS   : tst_QDBusAbstractInterface::variantPropReadPeer()
      PASS   : tst_QDBusAbstractInterface::variantPropWritePeer()
      PASS   : tst_QDBusAbstractInterface::complexPropReadPeer()
      PASS   : tst_QDBusAbstractInterface::complexPropWritePeer()
      PASS   : tst_QDBusAbstractInterface::stringPropDirectRead()
      PASS   : tst_QDBusAbstractInterface::stringPropDirectWrite()
      PASS   : tst_QDBusAbstractInterface::variantPropDirectRead()
      PASS   : tst_QDBusAbstractInterface::variantPropDirectWrite()
      PASS   : tst_QDBusAbstractInterface::complexPropDirectRead()
      PASS   : tst_QDBusAbstractInterface::complexPropDirectWrite()
      PASS   : tst_QDBusAbstractInterface::stringPropDirectReadPeer()
      PASS   : tst_QDBusAbstractInterface::stringPropDirectWritePeer()
      PASS   : tst_QDBusAbstractInterface::variantPropDirectReadPeer()
      PASS   : tst_QDBusAbstractInterface::variantPropDirectWritePeer()
      PASS   : tst_QDBusAbstractInterface::complexPropDirectReadPeer()
      PASS   : tst_QDBusAbstractInterface::complexPropDirectWritePeer()
      PASS   : tst_QDBusAbstractInterface::getVoidSignal()
      PASS   : tst_QDBusAbstractInterface::getStringSignal()
      PASS   : tst_QDBusAbstractInterface::getComplexSignal()
      PASS   : tst_QDBusAbstractInterface::getVoidSignalPeer()
      PASS   : tst_QDBusAbstractInterface::getStringSignalPeer()
      PASS   : tst_QDBusAbstractInterface::getComplexSignalPeer()
      PASS   : tst_QDBusAbstractInterface::followSignal()
      PASS   : tst_QDBusAbstractInterface::createErrors()
      PASS   : tst_QDBusAbstractInterface::createErrorsPeer()
      PASS   : tst_QDBusAbstractInterface::callErrors()
      PASS   : tst_QDBusAbstractInterface::asyncCallErrors()
      PASS   : tst_QDBusAbstractInterface::callErrorsPeer()
      PASS   : tst_QDBusAbstractInterface::asyncCallErrorsPeer()
      PASS   : tst_QDBusAbstractInterface::propertyReadErrors()
      PASS   : tst_QDBusAbstractInterface::propertyWriteErrors()
      PASS   : tst_QDBusAbstractInterface::directPropertyReadErrors()
      PASS   : tst_QDBusAbstractInterface::directPropertyWriteErrors()
      PASS   : tst_QDBusAbstractInterface::propertyReadErrorsPeer()
      PASS   : tst_QDBusAbstractInterface::propertyWriteErrorsPeer()
      PASS   : tst_QDBusAbstractInterface::directPropertyReadErrorsPeer()
      PASS   : tst_QDBusAbstractInterface::directPropertyWriteErrorsPeer()
      PASS   : tst_QDBusAbstractInterface::cleanupTestCase()
      Totals: 64 passed, 0 failed, 0 skipped
      ********* Finished testing of tst_QDBusAbstractInterface *********
      make[1]: Leaving directory `/home/rmcgover/build/qt/4.8/tests/auto/qdbusabstractinterface/test'
      

      However, several test functions fail if they are run individually, or run in a different order, e.g.

      [rmcgover@bq-menoetius qdbusabstractinterface]$ make check TESTARGS=stringPropWritePeer
      cd qpinger/ && /usr/bin/make -f Makefile check
      make[1]: Entering directory `/home/rmcgover/build/qt/4.8/tests/auto/qdbusabstractinterface/qpinger'
      make[1]: Nothing to be done for `check'.
      make[1]: Leaving directory `/home/rmcgover/build/qt/4.8/tests/auto/qdbusabstractinterface/qpinger'
      cd test/ && /usr/bin/make -f Makefile check
      make[1]: Entering directory `/home/rmcgover/build/qt/4.8/tests/auto/qdbusabstractinterface/test'
      cd ../ &&  ./tst_qdbusabstractinterface stringPropWritePeer
      ********* Start testing of tst_QDBusAbstractInterface *********
      Config: Using QTest library 4.8.0, Qt 4.8.0
      PASS   : tst_QDBusAbstractInterface::initTestCase()
      FAIL!  : tst_QDBusAbstractInterface::stringPropWritePeer() Compared values are not the same
         Actual (targetObj.m_stringProp): 
         Expected (expectedValue): This is a value
         Loc: [../tst_qdbusabstractinterface.cpp(638)]
      PASS   : tst_QDBusAbstractInterface::cleanupTestCase()
      Totals: 2 passed, 1 failed, 0 skipped
      ********* Finished testing of tst_QDBusAbstractInterface *********
      make[1]: *** [check] Error 1
      make[1]: Leaving directory `/home/rmcgover/build/qt/4.8/tests/auto/qdbusabstractinterface/test'
      make: *** [sub-test-check_ordered] Error 2
      

      The body of the failing testfunction in the above example is:

      void tst_QDBusAbstractInterface::stringPropWritePeer()
      {
          Pinger p = getPingerPeer();
          QVERIFY2(p, "Not connected to D-Bus");
          resetServer();
      
          QString expectedValue = "This is a value";
          QVERIFY(p->setProperty("stringProp", expectedValue));
          QCOMPARE(targetObj.m_stringProp, expectedValue);
      }
      

      The last QCOMPARE is the line which fails.

      If I understand the test correctly, stringPropWritePeer is testing a write to a property exported over dbus from an external process (qpinger).
      But the QCOMPARE is checking the value stored in an object in the current process. There is no reason why these should be expected to be equal at the time of the QCOMPARE.

      The reason why the test seems to pass is that the same test value "This is a value" is used in a previous test function which does write to the object in the current process, and the test makes no attempt to reset the state of the objects between test functions.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            rmcgover Rohan McGovern (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes