Rework postinstall unittests to pass on Android.
Postinstall unittests were creating and mounting an image on each test
run. This patch adds several test scripts to one of the pre-generated
images and uses that image during postinstall testing instead.
To workaround problems with mount/umount of loop devices on Android,
this patch rewrites the `losetup` logic to make the appropriate
syscalls and create the loop device with mknod if it doesn't exists.
The tests require some extra SELinux policies to run in enforcing mode.
Bug: 26955860
TEST=Ran all Postinstall unittests.
Change-Id: I47a56b80b97596bc65ffe30cbc8118f05faff0ae
diff --git a/payload_consumer/postinstall_runner_action.h b/payload_consumer/postinstall_runner_action.h
index b4defae..08dedd2 100644
--- a/payload_consumer/postinstall_runner_action.h
+++ b/payload_consumer/postinstall_runner_action.h
@@ -34,14 +34,14 @@
explicit PostinstallRunnerAction(BootControlInterface* boot_control)
: PostinstallRunnerAction(boot_control, nullptr) {}
- void PerformAction();
+ void PerformAction() override;
// Note that there's no support for terminating this action currently.
- void TerminateProcessing() { CHECK(false); }
+ void TerminateProcessing() override { CHECK(false); }
// Debugging/logging
static std::string StaticType() { return "PostinstallRunnerAction"; }
- std::string Type() const { return StaticType(); }
+ std::string Type() const override { return StaticType(); }
private:
friend class PostinstallRunnerActionTest;