Fixed tst_QFile when redirecting stdin/stdout/stderr to/from files.
openStandardStreamsBufferedStreams would fail if standard streams were redirected to a file (e.g. ./tst_qfile > testlog.txt). openStandardStreamsFileDescriptors already has a workaround, so apply it here too. Change-Id: Iffe9d7864909e489e77c1114e80c4e3bc70a8722 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>bb10
parent
e0d26ebe2e
commit
7a5bb18dc6
|
|
@ -3028,25 +3028,28 @@ void tst_QFile::openStandardStreamsBufferedStreams()
|
|||
{
|
||||
QFile in;
|
||||
in.open(stdin, QIODevice::ReadOnly);
|
||||
if (!in.isSequential())
|
||||
QSKIP("Standard input redirected.");
|
||||
QCOMPARE( in.pos(), (qint64)0 );
|
||||
QCOMPARE( in.size(), (qint64)0 );
|
||||
QVERIFY( in.isSequential() );
|
||||
}
|
||||
|
||||
{
|
||||
QFile out;
|
||||
out.open(stdout, QIODevice::WriteOnly);
|
||||
if (!out.isSequential())
|
||||
QSKIP("Standard output redirected.");
|
||||
QCOMPARE( out.pos(), (qint64)0 );
|
||||
QCOMPARE( out.size(), (qint64)0 );
|
||||
QVERIFY( out.isSequential() );
|
||||
}
|
||||
|
||||
{
|
||||
QFile err;
|
||||
err.open(stderr, QIODevice::WriteOnly);
|
||||
if (!err.isSequential())
|
||||
QSKIP("Standard error redirected.");
|
||||
QCOMPARE( err.pos(), (qint64)0 );
|
||||
QCOMPARE( err.size(), (qint64)0 );
|
||||
QVERIFY( err.isSequential() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue