Uploaded image for project: 'Qt Visual Studio Tools'
  1. Qt Visual Studio Tools
  2. QTVSADDINBUG-762

QtTest Project with corrupt QT_TESTCASE_BUILDDIR define

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: P1: Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.4.3
    • Fix Version/s: None
    • Component/s: Qt/MSBuild
    • Labels:
      None
    • Environment:
      Visual Studio 2017 15.9.21

      Description

      Qt projects which use the testlib module cannot be compiled, because of the following compiler error:

      error C2664: "void QTest::setMainSourcePath(const char *,const char *)" : Conversion of argument 2 from "int" to "const char *" not possible

       

      This is caused by the following section inside the qtest.h

      #ifdef QT_TESTCASE_BUILDDIR
      #  define QTEST_SET_MAIN_SOURCE_PATH  QTest::setMainSourcePath(__FILE__, QT_TESTCASE_BUILDDIR);
      #else
      #  define QTEST_SET_MAIN_SOURCE_PATH  QTest::setMainSourcePath(__FILE__);
      #endif

      Since the QT_TESTCASE_BUILDDIR is defined by the mkspecs\features\testlib_defines.prf but the RegEx in QMake_DEFINES_ extracts only the key without the value, the above if branch is executed but the define is empty.
      To avoid that I've included also the values by using DEFINES=/-D(\S+)/$1/, which extracts correctly, but the value is incompatible with MSVC.

      The mentioned testlib_defines.prf contains the following content, but since apparently none of the vc templates is used, the alternative (incompatible) value is set.

      contains(TEMPLATE, vc.*): DEFINES += QT_TESTCASE_BUILDDIR=\"$$OUT_PWD\"
      else: DEFINES += QT_TESTCASE_BUILDDIR=$$shell_quote(\"$$OUT_PWD\")

      As a workaround I've now excluded the define which works at the moment. DEFINES=/-D((?!QT_TESTCASE_BUILDDIR)\S+)/$1/

        Attachments

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

          Activity

            People

            Assignee:
            mecfc Miguel Costa
            Reporter:
            anoymouserver anoymouserver
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes