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

test_QT_TESTCASE_BUILDDIR fails when built with CMake 3.21

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.2.0 Beta1
    • Build System: CMake
    • None

    Description

      https://testresults.qt.io/coin/logview/qt/qtbase/9787857f63ca34ee4121a52cb07f3b4dd2678797/MacOSMacOS_11_00x86_64MacOSMacOS_11_00x86_64Clangqtci-macos-11.0-x86_64-102-a4fd15Sccache_TestOnly/c306b022e732454290e9e6b132e7ff4f9b5dccbb/test_1626696363

      agent:2021/07/19 10:42:24 build.go:391: 237: Running test command: "/Users/qt/work/qt/qtbase_standalone_tests/tests/auto/cmake/in_source/test_QT_TESTCASE_BUILDDIR/build/test_qt_testcase_builddir"
      agent:2021/07/19 10:42:24 build.go:391: 237: Test command failed: /Users/qt/work/qt/qtbase_standalone_tests/tests/auto/cmake/in_source/test_QT_TESTCASE_BUILDDIR/build/test_qt_testcase_builddir
      agent:2021/07/19 10:42:24 build.go:391: 237: ********* Start testing of TestClass *********
      agent:2021/07/19 10:42:24 build.go:391: 237: Config: Using QtTest library 6.2.0, Qt 6.2.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 12.0.0 (clang-1200.0.32.29) (Apple)), macos 11.0
      agent:2021/07/19 10:42:24 build.go:391: 237: PASS   : TestClass::initTestCase()
      agent:2021/07/19 10:42:24 build.go:391: 237: WARNING: TestClass::doTest() testdata level2/testdata_build.txt could not be located!
      agent:2021/07/19 10:42:24 build.go:391: 237:    Loc: [/Users/qt/work/qt/qtbase_standalone_tests/tests/auto/cmake/in_source/test_QT_TESTCASE_BUILDDIR/main.cpp(50)]
      agent:2021/07/19 10:42:24 build.go:391: 237: QWARN  : TestClass::doTest() QFSFileEngine::open: No file name specified
      agent:2021/07/19 10:42:24 build.go:391: 237: FAIL!  : TestClass::doTest() 'fbuild.open(QFile::ReadOnly)' returned FALSE. ()
      agent:2021/07/19 10:42:24 build.go:391: 237:    Loc: [/Users/qt/work/qt/qtbase_standalone_tests/tests/auto/cmake/in_source/test_QT_TESTCASE_BUILDDIR/main.cpp(51)]
      agent:2021/07/19 10:42:24 build.go:391: 237: PASS   : TestClass::cleanupTestCase()
      agent:2021/07/19 10:42:24 build.go:391: 237: Totals: 2 passed, 1 failed, 0 skipped, 0 blacklisted, 1ms
      agent:2021/07/19 10:42:24 build.go:391: 237: ********* Finished testing of TestClass *********
      

      Precheck done using https://codereview.qt-project.org/c/qt/qtbase/+/360455 + https://codereview.qt-project.org/c/qt/qt5/+/360035

      Issue seems to be related to a CMake 3.21.0 behavior change when using Ninja.
      https://gitlab.kitware.com/cmake/cmake/-/issues/13894

      Ninja will now pass absolute paths to the compiler when compiling the cpp source file. i.e.

      # worked
      -c
      ../main.cpp
      
      # doesn't work
      -c
      /Users/qt/work/qt/st_cmake/tests/auto/cmake/in_source/test_QT_TESTCASE_BUILDDIR/main.cpp
      

      This causes the test's QFINDTESTDATA not to find the testdata despite having an explicit QT_TESTCASE_BUILDDIR and QT_TESTCASE_SOURCEDIR being passed when compiling the test sources.

      Test worked fine when built in-source with CMake 3.20.

      Related issues and changes:
      QTBUG-82820
      https://gitlab.kitware.com/cmake/cmake/-/issues/13894
      https://codereview.qt-project.org/c/qt/qtbase/+/263785
      https://codereview.qt-project.org/c/qt/qtbase/+/293480
      https://codereview.qt-project.org/c/qt/qtbase/+/340549

      Attachments

        Issue Links

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

          Activity

            People

              qtbuildsystem Qt Build System Team
              alexandru.croitor Alexandru Croitor
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes