CRASH
};
+class TestPkgmgrInstaller : public ci::PkgmgrInstallerInterface {
+ public:
+ bool CreatePkgMgrInstaller(pkgmgr_installer** installer,
+ ci::InstallationMode* mode) {
+ *installer = pkgmgr_installer_new();
+ if (!*installer)
+ return false;
+ *mode = ci::InstallationMode::ONLINE;
+ return true;
+ }
+
+ bool ShouldCreateSignal() const {
+ return false;
+ }
+};
+
class StepCrash : public ci::Step {
public:
using Step::Step;
ci::AppInstaller::Result Install(const bf::path& path,
RequestResult mode = RequestResult::NORMAL) {
const char* argv[] = {"", "-i", path.c_str()};
+ TestPkgmgrInstaller pkgmgr_installer;
std::unique_ptr<ci::AppQueryInterface> query_interface =
CreateQueryInterface();
auto pkgmgr =
ci::PkgMgrInterface::Create(SIZEOFARRAY(argv), const_cast<char**>(argv),
+ &pkgmgr_installer,
query_interface.get());
if (!pkgmgr) {
LOG(ERROR) << "Failed to initialize pkgmgr interface";
ci::AppInstaller::Result Uninstall(const std::string& pkgid,
RequestResult mode = RequestResult::NORMAL) {
const char* argv[] = {"", "-d", pkgid.c_str()};
+ TestPkgmgrInstaller pkgmgr_installer;
std::unique_ptr<ci::AppQueryInterface> query_interface =
CreateQueryInterface();
auto pkgmgr =
ci::PkgMgrInterface::Create(SIZEOFARRAY(argv), const_cast<char**>(argv),
- query_interface.get());
+ &pkgmgr_installer, query_interface.get());
if (!pkgmgr) {
LOG(ERROR) << "Failed to initialize pkgmgr interface";
return ci::AppInstaller::Result::UNKNOWN;
return ci::AppInstaller::Result::UNKNOWN;
}
const char* argv[] = {"", "-r", delta_dir.c_str()};
+ TestPkgmgrInstaller pkgmgr_installer;
std::unique_ptr<ci::AppQueryInterface> query_interface =
CreateQueryInterface();
auto pkgmgr =
ci::PkgMgrInterface::Create(SIZEOFARRAY(argv), const_cast<char**>(argv),
- query_interface.get());
+ &pkgmgr_installer, query_interface.get());
if (!pkgmgr) {
LOG(ERROR) << "Failed to initialize pkgmgr interface";
return ci::AppInstaller::Result::UNKNOWN;
ci::AppInstaller::Result Recover(const bf::path& recovery_file,
RequestResult mode = RequestResult::NORMAL) {
const char* argv[] = {"", "-b", recovery_file.c_str()};
+ TestPkgmgrInstaller pkgmgr_installer;
std::unique_ptr<ci::AppQueryInterface> query_interface =
CreateQueryInterface();
auto pkgmgr =
ci::PkgMgrInterface::Create(SIZEOFARRAY(argv), const_cast<char**>(argv),
- query_interface.get());
+ &pkgmgr_installer, query_interface.get());
if (!pkgmgr) {
LOG(ERROR) << "Failed to initialize pkgmgr interface";
return ci::AppInstaller::Result::UNKNOWN;
bf::remove_all(home_ / KUserAppsDirBackup, error);
if (bf::exists(home_ / KUserAppsDir)) {
bf::rename(home_ / KUserAppsDir, home_ / KUserAppsDirBackup, error);
+ if (error)
+ LOG(ERROR) << "Failed to setup test environment. Does some previous"
+ << " test crashed? Directory: "
+ << (home_ / KUserAppsDirBackup) << " should not exist.";
assert(!error);
}
if (bf::exists(home_ / kApplicationDir)) {
bf::rename(home_ / kApplicationDir, home_ / kApplicationDirBackup, error);
+ if (error)
+ LOG(ERROR) << "Failed to setup test environment. Does some previous"
+ << " test crashed? Directory: "
+ << (home_ / kApplicationDirBackup) << " should not exist.";
assert(!error);
}
}