[gparted] Update PipeCaptureTest.MinimalBinaryCrash777973 expected string (#777973)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Update PipeCaptureTest.MinimalBinaryCrash777973 expected string (#777973)
- Date: Sat, 3 Jun 2017 15:42:57 +0000 (UTC)
commit 0a3e8487a07243528219dc8b79be561cc7f845c7
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Thu May 25 19:52:24 2017 +0100
Update PipeCaptureTest.MinimalBinaryCrash777973 expected string (#777973)
PipeCapture::OnReadable() has been almost completely re-written but this
test is still failing thus:
$ ./test_PipeCapture
...
[ RUN ] PipeCaptureTest.MinimalBinaryCrash777973
test_PipeCapture.cc:313: Failure
Expected: inputstr
Of length: 27
To be equal to: capturedstr.raw()
Of length: 26
With first binary difference:
< 0x00000010 "...!......." A9 C2 A0 21 E2 95 9F E2 88 A9 C2
--
> 0x00000010 "...!......" A9 C2 A0 21 E2 95 9F E2 88 A9
[ FAILED ] PipeCaptureTest.MinimalBinaryCrash777973 (0 ms)
...
The OnReadable() code specifically skips invalid bytes which aren't part
of valid UTF-8 characters, because they can't be displayed to the user.
The final C2 byte is the start of a multi-byte UTF-8 character, so on
it's own is invalid. Therefore PipeCapture skips it. Update expected
string accordingly. Now the test passes.
Bug 777973 - Segmentation fault on bad disk
tests/test_PipeCapture.cc | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/tests/test_PipeCapture.cc b/tests/test_PipeCapture.cc
index 332b38d..3808e28 100644
--- a/tests/test_PipeCapture.cc
+++ b/tests/test_PipeCapture.cc
@@ -18,7 +18,8 @@
*
* All the tests work by creating a pipe(3) and using a separate thread to write data into
* the pipe with PipeCapture running in the initial thread. Captured data is then checked
- * that it matches the input.
+ * that it either matches the input or different expected output depending on the features
+ * being tested.
*/
#include "PipeCapture.h"
@@ -156,6 +157,7 @@ protected:
static const size_t WriterFD = 1;
std::string inputstr;
+ std::string expectedstr;
Glib::ustring capturedstr;
bool eof_signalled;
unsigned update_signalled;
@@ -315,7 +317,10 @@ TEST_F( PipeCaptureTest, MinimalBinaryCrash777973 )
pc.signal_eof.connect( sigc::mem_fun( *this, &PipeCaptureTest::eof_callback ) );
pc.connect_signal();
run_writer_thread();
- EXPECT_BINARYSTRINGEQ( inputstr, capturedstr.raw() );
+ // Final \xC2 byte is part of an incomplete UTF-8 character so will be skipped by
+ // PipeCapture.
+ expectedstr = "/LOST.DIR/!\xE2\x95\x9F\xE2\x88\xA9\xC2\xA0!\xE2\x95\x9F\xE2\x88\xA9";
+ EXPECT_BINARYSTRINGEQ( expectedstr, capturedstr.raw() );
EXPECT_TRUE( eof_signalled );
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]