1 #include <gtest/gtest.h>
3 #include <boost/filesystem.hpp>
6 #include "config/config.h"
7 #include "package_manager/packagemanagerfactory.h"
8 #include "package_manager/packagemanagerinterface.h"
9 #include "storage/invstorage.h"
10 #include "utilities/utils.h"
12 boost::filesystem::path sysroot;
17 config.pacman.type = PackageManager::kOstree;
18 config.pacman.sysroot = sysroot;
20 config.storage.path = dir.Path();
21 std::shared_ptr<INvStorage> storage = INvStorage::newStorage(config.storage);
23 std::shared_ptr<PackageManagerInterface> pacman =
24 PackageManagerFactory::makePackageManager(config.pacman, config.bootloader, storage,
nullptr);
27 EXPECT_THROW(std::shared_ptr<PackageManagerInterface> pacman =
28 PackageManagerFactory::makePackageManager(config.pacman, config.bootloader, storage,
nullptr),
35 config.pacman.type = PackageManager::kDebian;
37 config.storage.path = dir.Path();
38 std::shared_ptr<INvStorage> storage = INvStorage::newStorage(config.storage);
40 std::shared_ptr<PackageManagerInterface> pacman =
41 PackageManagerFactory::makePackageManager(config.pacman, config.bootloader, storage,
nullptr);
44 EXPECT_THROW(std::shared_ptr<PackageManagerInterface> pacman =
45 PackageManagerFactory::makePackageManager(config.pacman, config.bootloader, storage,
nullptr),
53 config.storage.path = dir.Path();
54 std::shared_ptr<INvStorage> storage = INvStorage::newStorage(config.storage);
55 config.pacman.type = PackageManager::kNone;
56 std::shared_ptr<PackageManagerInterface> pacman =
57 PackageManagerFactory::makePackageManager(config.pacman, config.bootloader, storage,
nullptr);
64 config.storage.path = dir.Path();
65 config.pacman.type = (PackageManager)-1;
66 std::shared_ptr<INvStorage> storage = INvStorage::newStorage(config.storage);
67 std::shared_ptr<PackageManagerInterface> pacman =
68 PackageManagerFactory::makePackageManager(config.pacman, config.bootloader, storage,
nullptr);
73 int main(
int argc,
char **argv) {
74 ::testing::InitGoogleTest(&argc, argv);
77 std::cerr <<
"Error: " << argv[0] <<
" requires the path to an OSTree sysroot as an input argument.\n";
81 return RUN_ALL_TESTS();