Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a4cfb4f authored by mhasank's avatar mhasank
Browse files

arc: Rename use_outfile to out_dir + use as is

Bug: 142684959
Bug: 136273873
Bug: 139379357
Bug: 138805202
Bug: 142685922
Test: adb shell bugreport
Test: atest dumpstate_test
Test: flash android to dut, android-sh, setenforce 1, arc-bugreport
Change-Id: Ia2bb2d4609467d902ce7424d882ed88422867d0b
parent a9ef659a
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -2296,8 +2296,7 @@ static void FinalizeFile() {

    std::string final_path = ds.path_;
    if (ds.options_->OutputToCustomFile()) {
        std::string bugreport_dir = dirname(ds.options_->use_outfile.c_str());
        final_path = ds.GetPath(bugreport_dir, ".zip");
        final_path = ds.GetPath(ds.options_->out_dir, ".zip");
        android::os::CopyFileToFile(ds.path_, final_path);
    }

@@ -2418,7 +2417,7 @@ Dumpstate::RunStatus Dumpstate::DumpOptions::Initialize(int argc, char* argv[])
            // clang-format off
            case 'd': do_add_date = true;            break;
            case 'z': do_zip_file = true;            break;
            case 'o': use_outfile = optarg;          break;
            case 'o': out_dir = optarg;              break;
            case 's': use_socket = true;             break;
            case 'S': use_control_socket = true;     break;
            case 'v': show_header_only = true;       break;
+4 −4
Original line number Diff line number Diff line
@@ -386,12 +386,12 @@ class Dumpstate {
        // The HAL is actually an API surface that can be validated, while the AIDL is not (@hide).
        ::android::hardware::dumpstate::V1_1::DumpstateMode dumpstate_hal_mode =
            ::android::hardware::dumpstate::V1_1::DumpstateMode::DEFAULT;
        // File descriptor to output zip file. Takes precedence over use_outfile..
        // File descriptor to output zip file. Takes precedence over out_dir.
        android::base::unique_fd bugreport_fd;
        // File descriptor to screenshot file.
        android::base::unique_fd screenshot_fd;
        // Partial path to output file.
        std::string use_outfile;
        // Custom output directory.
        std::string out_dir;
        // Bugreport mode of the bugreport.
        std::string bugreport_mode;
        // Command-line arguments as string
@@ -421,7 +421,7 @@ class Dumpstate {
        /* Returns if options specified require writing to custom file location */
        bool OutputToCustomFile() {
            // Custom location is only honored in limited mode.
            return limited_only && !use_outfile.empty() && bugreport_fd.get() == -1;
            return limited_only && !out_dir.empty() && bugreport_fd.get() == -1;
        }
    };

+2 −2
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ TEST_F(DumpOptionsTest, InitializeNone) {

    EXPECT_FALSE(options_.do_add_date);
    EXPECT_FALSE(options_.do_zip_file);
    EXPECT_EQ("", options_.use_outfile);
    EXPECT_EQ("", options_.out_dir);
    EXPECT_FALSE(options_.use_socket);
    EXPECT_FALSE(options_.use_control_socket);
    EXPECT_FALSE(options_.show_header_only);
@@ -366,7 +366,7 @@ TEST_F(DumpOptionsTest, InitializeLimitedOnlyBugreport) {
    EXPECT_TRUE(options_.use_control_socket);
    EXPECT_FALSE(options_.do_vibrate);
    EXPECT_TRUE(options_.limited_only);
    EXPECT_EQ(" abc", std::string(options_.use_outfile));
    EXPECT_EQ(" abc", std::string(options_.out_dir));

    // Other options retain default values
    EXPECT_FALSE(options_.show_header_only);