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

Commit 6592c3cc authored by Joe Onorato's avatar Joe Onorato
Browse files

Add an option to bit to not restart.

Test: build & restart
Change-Id: Ia925053f04046d7fb91a47cfd5fd17a5d4fecf10
parent 43518242
Loading
Loading
Loading
Loading
+36 −26
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ struct Options {
    string tabPattern;

    // For build/install/test
    bool noRestart;
    bool reboot;
    vector<Target*> targets;

@@ -89,6 +90,7 @@ struct Options {
Options::Options()
    :runHelp(false),
     runTab(false),
     noRestart(false),
     reboot(false),
     targets()
{
@@ -285,6 +287,7 @@ print_usage(FILE* out) {
    fprintf(out, "  -i     Install the targets\n");
    fprintf(out, "  -t     Run the tests\n");
    fprintf(out, "\n");
    fprintf(out, "  -n     Don't reboot or restart\n");
    fprintf(out, "  -r     If the runtime needs to be restarted, do a full reboot\n");
    fprintf(out, "         instead\n");
    fprintf(out, "\n");
@@ -431,6 +434,9 @@ parse_args(Options* options, int argc, const char** argv)
                        flagTest = true;
                        anyPhases = true;
                        break;
                    case 'n':
                        options->noRestart = true;
                        break;
                    case 'r':
                        options->reboot = true;
                        break;
@@ -558,7 +564,7 @@ check_device_property(const string& property, const string& expected)
 * Run the build, install, and test actions.
 */
void
run_phases(vector<Target*> targets, bool reboot)
run_phases(vector<Target*> targets, const Options& options)
{
    int err = 0;

@@ -676,14 +682,17 @@ run_phases(vector<Target*> targets, bool reboot)
            check_device_property("ro.build.id", buildId);

            // Stop & Sync
            if (!options.noRestart) {
                err = run_adb("shell", "stop", NULL);
                check_error(err);
            }
            err = run_adb("remount", NULL);
            check_error(err);
            err = run_adb("sync", "system", NULL);
            check_error(err);

            if (reboot) {
            if (!options.noRestart) {
                if (options.reboot) {
                    print_status("Rebooting");

                    err = run_adb("reboot", NULL);
@@ -712,6 +721,7 @@ run_phases(vector<Target*> targets, bool reboot)
                check_error(err);
            }
        }
    }

    // Install APKs
    if (installApks.size() > 0) {
@@ -976,7 +986,7 @@ main(int argc, const char** argv)
        exit(0);
    } else {
        // Normal run
        run_phases(options.targets, options.reboot);
        run_phases(options.targets, options);
    }

    return 0;