From: Yabin Cui Date: Wed, 14 Feb 2018 23:28:59 +0000 (-0800) Subject: simpleperf: fix cmd_debug_unwind tests. X-Git-Tag: android-x86-9.0-r1~53^2^2^2^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=877fdab084de2d62ca6169060d61465dbcaf1a28;p=android-x86%2Fsystem-extras.git simpleperf: fix cmd_debug_unwind tests. 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 --- diff --git a/simpleperf/cmd_debug_unwind_test.cpp b/simpleperf/cmd_debug_unwind_test.cpp index 8bf93d32..153adb75 100644 --- a/simpleperf/cmd_debug_unwind_test.cpp +++ b/simpleperf/cmd_debug_unwind_test.cpp @@ -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_);