OSDN Git Service

simpleperf: fix cmd_debug_unwind tests.
authorYabin Cui <yabinc@google.com>
Wed, 14 Feb 2018 23:28:59 +0000 (15:28 -0800)
committerYabin Cui <yabinc@google.com>
Wed, 14 Feb 2018 23:28:59 +0000 (15:28 -0800)
Without flushing stdout, the tests may fail when
running `adb shell simpleperf_unit_test`.

Bug: none
Test: run `adb shell simpleperf_unit_test`.
Change-Id: I8bcf739e7672e8affc71df0a3f11264c0bd7f745

simpleperf/cmd_debug_unwind_test.cpp

index 8bf93d3..153adb7 100644 (file)
@@ -45,6 +45,7 @@ class CaptureStdout {
   }
 
   bool Start() {
+    fflush(stdout);
     old_stdout_ = dup(STDOUT_FILENO);
     if (old_stdout_ == -1) {
       return false;
@@ -58,6 +59,7 @@ class CaptureStdout {
   }
 
   std::string Finish() {
+    fflush(stdout);
     started_ = false;
     dup2(old_stdout_, STDOUT_FILENO);
     close(old_stdout_);