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

tst_qstandardpaths::testCustomRuntimeDirectory_data doesn't check for failures

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8
    • Core: I/O
    • None
    • 60f15da3c (dev), 9fd895e3c (dev)

    Description

      tst_qstandardpaths::testCustomRuntimeDirectory_data contains test "rows" like

          addRow("environment:file", [](QDir &d) {
              QString p = d.filePath("file");
              QFile f(p);
              f.open(QIODevice::WriteOnly);
              f.setPermissions(QFile::ReadOwner | QFile::WriteOwner);
      
              updateRuntimeDir(p);
              QTest::ignoreMessage(QtWarningMsg,
                                   QString("QStandardPaths: runtime directory '%1' is not a directory, "
                                           "but a regular file permissions 0600 owned by UID %2 GID %3")
                                   .arg(p).arg(getuid()).arg(getgid()).toLatin1());
              return fallbackXdgRuntimeDir();
          });
      
      

      open, setPermissions etc. are fallible operations. They ought to fail the autotest if they fail. However, due to the way this is coded ("data-function-driven"), we can't just wrap them in QVERIFY.

      This testcase should be refactored.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            peppe Giuseppe D'Angelo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes