Lotta of small dumpstate fixes...

- Fixed RunCommandToFd() so it respects DROP_ROOT.
- Renamed enums to be more consistent with fd model.
- Added tests to RunCommandToFd() and DumpFileToFd().
- Fixed RunCommandToFd() and DumpFileToFd(), which were rushed in.
- Disable tests that fail when running as suite.

BUG: 31982882
Test: manual verification
Test: dumpstate_tests pass

Change-Id: I1d8352a17be10a707a101fc1ac9c7d735e38f9fe
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index 969348f..9f56fce 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -63,18 +63,15 @@
  */
 class DurationReporter {
   public:
-    DurationReporter(const std::string& title);
-    DurationReporter(const std::string& title, FILE* out);
+    DurationReporter(const std::string& title, bool log_only = false);
 
     ~DurationReporter();
 
     static uint64_t Nanotime();
 
   private:
-    // TODO: use std::string for title, once dump_files() and other places that pass a char* are
-    // refactored as well.
     std::string title_;
-    FILE* out_;
+    bool log_only_;
     uint64_t started_;
 
     DISALLOW_COPY_AND_ASSIGN(DurationReporter);
@@ -167,6 +164,7 @@
  */
 class Dumpstate {
     friend class DumpstateTest;
+    friend class DumpstateUtilTest;
 
   public:
     static CommandOptions DEFAULT_DUMPSYS;