Merge changes from topic "fuzz_gatekeeperd"
* changes:
Adding fuzzer for gatekeeperd
Separating GateKeeperProxy declaration in header
diff --git a/fastboot/task.cpp b/fastboot/task.cpp
index 054c1ed..ce46e91 100644
--- a/fastboot/task.cpp
+++ b/fastboot/task.cpp
@@ -65,7 +65,7 @@
: reboot_target_(reboot_target), fp_(fp){};
void RebootTask::Run() {
- if ((reboot_target_ == "userspace" || reboot_target_ == "fastboot")) {
+ if (reboot_target_ == "fastboot") {
if (!is_userspace_fastboot()) {
reboot_to_userspace_fastboot();
fp_->fb->WaitForDisconnect();
diff --git a/fastboot/task_test.cpp b/fastboot/task_test.cpp
index 145b4d7..125226c 100644
--- a/fastboot/task_test.cpp
+++ b/fastboot/task_test.cpp
@@ -16,6 +16,7 @@
#include "task.h"
#include "fastboot.h"
+#include "fastboot_driver_mock.h"
#include <gtest/gtest.h>
#include <fstream>
@@ -24,6 +25,7 @@
#include <unordered_map>
#include "android-base/strings.h"
using android::base::Split;
+using testing::_;
class ParseTest : public ::testing ::Test {
protected:
@@ -58,7 +60,7 @@
return ParseFastbootInfoLine(fp, vec_command);
}
-TEST_F(ParseTest, CORRECT_FlASH_TASK_FORMED) {
+TEST_F(ParseTest, CorrectFlashTaskFormed) {
std::vector<std::string> commands = {"flash dtbo", "flash --slot-other system system_other.img",
"flash system", "flash --apply-vbmeta vbmeta"};
@@ -86,7 +88,7 @@
}
}
-TEST_F(ParseTest, VERSION_CHECK_CORRRECT) {
+TEST_F(ParseTest, VersionCheckCorrect) {
std::vector<std::string> correct_versions = {
"version 1.0",
"version 22.00",
@@ -104,7 +106,7 @@
}
}
-TEST_F(ParseTest, BAD_FASTBOOT_INFO_INPUT) {
+TEST_F(ParseTest, BadFastbootInput) {
ASSERT_EQ(ParseCommand(fp.get(), "flash"), nullptr);
ASSERT_EQ(ParseCommand(fp.get(), "flash --slot-other --apply-vbmeta"), nullptr);
ASSERT_EQ(ParseCommand(fp.get(), "flash --apply-vbmeta"), nullptr);
@@ -121,3 +123,16 @@
ASSERT_EQ(ParseCommand(fp.get(), "erase dtbo dtbo"), nullptr);
ASSERT_EQ(ParseCommand(fp.get(), "wipe this"), nullptr);
}
+
+TEST_F(ParseTest, CorrectTaskFormed) {
+ std::vector<std::string> commands = {"flash dtbo", "flash --slot-other system system_other.img",
+ "reboot bootloader", "update-super", "erase cache"};
+ std::vector<std::unique_ptr<Task>> tasks = collectTasks(fp.get(), commands);
+
+ ASSERT_TRUE(tasks[0]->AsFlashTask());
+ ASSERT_TRUE(tasks[0]->AsFlashTask());
+ ASSERT_TRUE(tasks[1]->AsFlashTask());
+ ASSERT_TRUE(tasks[2]->AsRebootTask());
+ ASSERT_TRUE(tasks[3]->AsUpdateSuperTask());
+ ASSERT_TRUE(tasks[4]->AsWipeTask());
+}
diff --git a/libprocessgroup/processgroup.cpp b/libprocessgroup/processgroup.cpp
index a021594..e294260 100644
--- a/libprocessgroup/processgroup.cpp
+++ b/libprocessgroup/processgroup.cpp
@@ -216,7 +216,6 @@
static int RemoveProcessGroup(const char* cgroup, uid_t uid, int pid, unsigned int retries) {
int ret = 0;
auto uid_pid_path = ConvertUidPidToPath(cgroup, uid, pid);
- auto uid_path = ConvertUidToPath(cgroup, uid);
while (retries--) {
ret = rmdir(uid_pid_path.c_str());