summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2019-11-18 16:33:29 +0100
committerThiago Macieira <thiago.macieira@intel.com>2020-12-10 15:20:33 +0100
commit928b51704a14d038f940759830579e82899ae8e5 (patch)
tree4bcb0dc2903524455af9c48349a8594627fc2d27 /tests/auto/corelib/io
parent36ccbee34e89d185918a2925444dac11211e5c60 (diff)
tst_QFile: add a couple more sequential Unix device files
/dev/zero and /dev/null are expected to always be present in any system (even containers). Unlike /dev/null, you *can* read from /dev/zero so test that QIODevice doesn't think it is random-access because of that. /dev/tty is also always present but has an interesting semantic. Could also try /dev/full, /dev/random and /dev/urandom. Change-Id: Ia2aa807ffa8a4c798425fffd15d84b60573f2c26 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'tests/auto/corelib/io')
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index e408cd3e48..a0c1078d0c 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -1825,9 +1825,18 @@ void tst_QFile::bufferedRead()
#ifdef Q_OS_UNIX
void tst_QFile::isSequential()
{
- QFile zero("/dev/null");
+ QFile zero("/dev/zero");
QVERIFY2(zero.open(QFile::ReadOnly), msgOpenFailed(zero).constData());
QVERIFY(zero.isSequential());
+
+ QFile null("/dev/null");
+ QVERIFY(null.open(QFile::ReadOnly));
+ QVERIFY(null.isSequential());
+
+ // /dev/tty will fail to open if we don't have a controlling TTY
+ QFile tty("/dev/tty");
+ if (tty.open(QFile::ReadOnly))
+ QVERIFY(tty.isSequential());
}
#endif