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>
This commit is contained in:
parent
36ccbee34e
commit
928b51704a
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user