1 #include <gtest/gtest.h>
3 #include "bootloader.h"
4 #include "storage/invstorage.h"
7 TEST(bootloader, detectReboot) {
10 storage_config.path = temp_dir.Path();
11 std::shared_ptr<INvStorage> storage = INvStorage::newStorage(storage_config);
14 boot_config.reboot_sentinel_dir = temp_dir.Path();
17 ASSERT_TRUE(bootloader.supportRebootDetection());
20 ASSERT_FALSE(bootloader.rebootDetected());
23 bootloader.rebootFlagSet();
24 ASSERT_FALSE(bootloader.rebootDetected());
27 boost::filesystem::remove(boot_config.reboot_sentinel_dir / boot_config.reboot_sentinel_name);
28 ASSERT_TRUE(bootloader.rebootDetected());
31 ASSERT_TRUE(bootloader.rebootDetected());
34 bootloader.rebootFlagClear();
35 ASSERT_FALSE(bootloader.rebootDetected());
39 int main(
int argc,
char **argv) {
40 ::testing::InitGoogleTest(&argc, argv);
41 return RUN_ALL_TESTS();