Add test that PipeCapture can read embedded NUL character (#777973)
Test currently detects failure thus: $ ./test_PipeCapture ... [ RUN ] PipeCaptureTest.ReadEmbeddedNULCharacter unknown file: Failure C++ exception with description "std::bad_alloc" thrown in the test body. [ FAILED ] PipeCaptureTest.ReadEmbeddedNULCharacter (31917 ms) ... Bug 777973 - Segmentation fault on bad disk
This commit is contained in:
parent
0a3e8487a0
commit
22573b4eed
|
@ -324,6 +324,19 @@ TEST_F( PipeCaptureTest, MinimalBinaryCrash777973 )
|
|||
EXPECT_TRUE( eof_signalled );
|
||||
}
|
||||
|
||||
TEST_F( PipeCaptureTest, ReadEmbeddedNULCharacter )
|
||||
{
|
||||
// Test embedded NUL character in the middle of the input is read correctly.
|
||||
const char * buf = "ABC\0EF";
|
||||
inputstr = std::string( buf, 6 );
|
||||
PipeCapture pc( pipefds[ReaderFD], capturedstr );
|
||||
pc.signal_eof.connect( sigc::mem_fun( *this, &PipeCaptureTest::eof_callback ) );
|
||||
pc.connect_signal();
|
||||
run_writer_thread();
|
||||
EXPECT_BINARYSTRINGEQ( inputstr, capturedstr.raw() );
|
||||
EXPECT_TRUE( eof_signalled );
|
||||
}
|
||||
|
||||
} // namespace GParted
|
||||
|
||||
// Custom Google Test main() which also initialises the Glib threading system for
|
||||
|
|
Loading…
Reference in New Issue