Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d36105d authored by Michał Narajowski's avatar Michał Narajowski Committed by Gerrit Code Review
Browse files

Merge "device_iot_config: Fix hwasan issues in tests"

parents 825b5535 f1802bbf
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -57,8 +57,8 @@ using bluetooth::common::InitFlags;

static void cleanup() {
  alarm_free(config_timer);
  config.reset();
  config_timer = NULL;
  config.reset();
  config = NULL;
  device_iot_config_source = NOT_LOADED;
}
@@ -69,6 +69,9 @@ future_t* device_iot_config_module_init(void) {

  std::unique_lock<std::mutex> lock(config_lock);

  config_timer = NULL;
  config = NULL;

  if (device_iot_config_is_factory_reset()) {
    device_iot_config_delete_files();
  }
+8 −12
Original line number Diff line number Diff line
@@ -79,6 +79,9 @@ class DeviceIotConfigModuleTest : public testing::Test {
      return &placeholder_alarm;
    };

    test::mock::osi_properties::osi_property_get_bool.body =
        [&](const char* key, bool default_value) -> int { return false; };

    test::mock::osi_alarm::alarm_set.body =
        [&](alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb,
            void* data) { return; };
@@ -205,27 +208,17 @@ TEST_F(DeviceIotConfigModuleTest,

TEST_F(DeviceIotConfigModuleTest,
       test_device_iot_config_module_init_no_config) {
  std::string enable_logging_property_get_value;
  std::string factory_reset_property_get_value;
  config_t* config_new_return_value = NULL;
  config_t* config_new_empty_return_value = NULL;

  test::mock::osi_config::config_new.body = [&](const char* filename) {
    return std::unique_ptr<config_t>(config_new_return_value);
    return std::unique_ptr<config_t>(nullptr);
  };

  test::mock::osi_config::config_new_empty.body = [&](void) {
    return std::unique_ptr<config_t>(config_new_empty_return_value);
    return std::unique_ptr<config_t>(nullptr);
  };

  {
    mock_function_count_map.clear();

    enable_logging_property_get_value = "true";
    factory_reset_property_get_value = "false";
    config_new_return_value = NULL;
    config_new_empty_return_value = NULL;

    device_iot_config_module_init();

    EXPECT_EQ(mock_function_count_map["config_new"], 2);
@@ -828,6 +821,9 @@ class DeviceIotConfigTest : public testing::Test {
      return &placeholder_alarm;
    };

    test::mock::osi_properties::osi_property_get_bool.body =
        [&](const char* key, bool default_value) -> int { return false; };

    test::mock::osi_alarm::alarm_set.body =
        [&](alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb,
            void* data) { return; };