unittest: Add testcase to check backend abi version 14/252814/6
authorSeungha Son <seungha.son@samsung.com>
Tue, 2 Feb 2021 11:25:34 +0000 (20:25 +0900)
committerSeungha Son <seungha.son@samsung.com>
Thu, 4 Feb 2021 03:29:16 +0000 (03:29 +0000)
Change-Id: Ic740ea639e738dcbd8514497e0f02bd0e1080bd5
Signed-off-by: Seungha Son <seungha.son@samsung.com>
haltests/src/test_hal.cc

index 1042adb..a73e484 100644 (file)
@@ -82,12 +82,15 @@ public:
   const char *library_name_;
   const char *library_name_64bit_;
   const char *symbol_name_;
+  vector<struct hal_abi_version_match> versions_;
 
   HalInfo(enum hal_module module, enum hal_group group, enum hal_license license,
-    const char *module_name, const char *library_name, const char *library_name_64bit, const char *symbol_name) :
+    const char *module_name, const char *library_name, const char *library_name_64bit,
+    const char *symbol_name, vector<struct hal_abi_version_match> versions) :
     module_(module), group_(group), license_(license),
     module_name_(module_name), library_name_(library_name),
-    library_name_64bit_(library_name_64bit), symbol_name_(symbol_name) {}
+    library_name_64bit_(library_name_64bit), symbol_name_(symbol_name),
+    versions_(versions) {}
 };
 
 class HalInfoMatchedTest : public ::testing::TestWithParam<HalInfo> {};
@@ -97,130 +100,250 @@ INSTANTIATE_TEST_CASE_P(CommonHaltest,
   ::testing::Values(
   HalInfo(HAL_MODULE_TBM, HAL_GROUP_GRAPHICS, HAL_LICENSE_MIT,
     "HAL_MODULE_TBM", "/hal/lib/libhal-backend-tbm.so",
-    "/hal/lib64/libhal-backend-tbm.so", "hal_backend_tbm_data"),
+    "/hal/lib64/libhal-backend-tbm.so", "hal_backend_tbm_data",
+    vector<struct hal_abi_version_match>{{
+    .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+    .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_TDM, HAL_GROUP_GRAPHICS, HAL_LICENSE_MIT,
     "HAL_MODULE_TDM", "/hal/lib/libhal-backend-tdm.so",
-    "/hal/lib64/libhal-backend-tdm.so", "hal_backend_tdm_data"),
+    "/hal/lib64/libhal-backend-tdm.so", "hal_backend_tdm_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_COREGL, HAL_GROUP_GRAPHICS, HAL_LICENSE_UNKNOWN,
-    "HAL_MODULE_COREGL", nullptr, nullptr, nullptr),
+    "HAL_MODULE_COREGL", nullptr, nullptr, nullptr, {}),
 
   HalInfo(HAL_MODULE_INPUT, HAL_GROUP_GRAPHICS, HAL_LICENSE_MIT,
-    "HAL_MODULE_INPUT", nullptr, nullptr, nullptr),
+    "HAL_MODULE_INPUT", nullptr, nullptr, nullptr, {}),
 
   HalInfo(HAL_MODULE_AUDIO, HAL_GROUP_MULTIMEDIA, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_AUDIO", "/hal/lib/libhal-backend-audio.so",
-    "/hal/lib64/libhal-backend-audio.so", "hal_backend_audio_data"),
+    "/hal/lib64/libhal-backend-audio.so", "hal_backend_audio_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_CAMERA, HAL_GROUP_MULTIMEDIA, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_CAMERA", "/hal/lib/libhal-backend-camera.so",
-    "/hal/lib64/libhal-backend-camera.so", "hal_backend_camera_data"),
+    "/hal/lib64/libhal-backend-camera.so", "hal_backend_camera_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_RADIO, HAL_GROUP_MULTIMEDIA, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_RADIO", "/hal/lib/libhal-backend-radio.so",
-    "/hal/lib64/libhal-backend-radio.so", "hal_backend_radio_data"),
+    "/hal/lib64/libhal-backend-radio.so", "hal_backend_radio_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_CODEC, HAL_GROUP_MULTIMEDIA, HAL_LICENSE_APACHE_2_0,
-    "HAL_MODULE_CODEC", nullptr, nullptr, nullptr),
+    "HAL_MODULE_CODEC", nullptr, nullptr, nullptr, {}),
 
   HalInfo(HAL_MODULE_USB_AUDIO, HAL_GROUP_MULTIMEDIA, HAL_LICENSE_APACHE_2_0,
-    "HAL_MODULE_USB_AUDIO", nullptr, nullptr, nullptr),
+    "HAL_MODULE_USB_AUDIO", nullptr, nullptr, nullptr, {}),
 
   HalInfo(HAL_MODULE_ALSAUCM, HAL_GROUP_MULTIMEDIA, HAL_LICENSE_APACHE_2_0,
-    "HAL_MODULE_ALSAUCM", nullptr, nullptr, nullptr),
+    "HAL_MODULE_ALSAUCM", nullptr, nullptr, nullptr, {}),
 
   HalInfo(HAL_MODULE_BLUETOOTH, HAL_GROUP_CONNECTIVITY, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_BLUETOOTH", "/hal/lib/libhal-backend-bluetooth.so",
-    "/hal/lib64/libhal-backend-bluetooth.so", "hal_backend_bluetooth_data"),
+    "/hal/lib64/libhal-backend-bluetooth.so", "hal_backend_bluetooth_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_WIFI, HAL_GROUP_CONNECTIVITY, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_WIFI", "/hal/lib/libhal-backend-wifi.so",
-    "/hal/lib64/libhal-backend-wifi.so", "hal_backend_wifi_data"),
+    "/hal/lib64/libhal-backend-wifi.so", "hal_backend_wifi_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_NAN, HAL_GROUP_CONNECTIVITY, HAL_LICENSE_APACHE_2_0,
-    "HAL_MODULE_NAN", nullptr, nullptr, nullptr),
+    "HAL_MODULE_NAN", nullptr, nullptr, nullptr, {}),
 
   HalInfo(HAL_MODULE_NFC, HAL_GROUP_CONNECTIVITY, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_NFC", "/hal/lib/libhal-backend-nfc.so",
-    "/hal/lib64/libhal-backend-nfc.so", "hal_backend_nfc_data"),
+    "/hal/lib64/libhal-backend-nfc.so", "hal_backend_nfc_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_ZIGBEE, HAL_GROUP_CONNECTIVITY, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_ZIGBEE", "/hal/lib/libhal-backend-zigbee.so",
-    "/hal/lib64/libhal-backend-zigbee.so", "hal_backend_zigbee_data"),
+    "/hal/lib64/libhal-backend-zigbee.so", "hal_backend_zigbee_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_UWB, HAL_GROUP_CONNECTIVITY, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_UWB", "/hal/lib/libhal-backend-uwb.so",
-    "/hal/lib64/libhal-backend-uwb.so", "hal_backend_uwb_data"),
+    "/hal/lib64/libhal-backend-uwb.so", "hal_backend_uwb_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_MTP, HAL_GROUP_CONNECTIVITY, HAL_LICENSE_APACHE_2_0,
-    "HAL_MODULE_MTP", nullptr, nullptr, nullptr),
+    "HAL_MODULE_MTP", nullptr, nullptr, nullptr, {}),
 
   HalInfo(HAL_MODULE_TELEPHONY, HAL_GROUP_TELEPHONY, HAL_LICENSE_APACHE_2_0,
-    "HAL_MODULE_TELEPHONY", nullptr, nullptr, nullptr),
+    "HAL_MODULE_TELEPHONY", nullptr, nullptr, nullptr, {}),
 
   HalInfo(HAL_MODULE_LOCATION, HAL_GROUP_LOCATION, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_LOCATION", "/hal/lib/libhal-backend-location.so",
-    "/hal/lib64/libhal-backend-location.so", "hal_backend_location_data"),
+    "/hal/lib64/libhal-backend-location.so", "hal_backend_location_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_COMMON, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
-    "HAL_MODULE_COMMON", nullptr, nullptr, nullptr),
+    "HAL_MODULE_COMMON", nullptr, nullptr, nullptr, {}),
 
   HalInfo(HAL_MODULE_POWER, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_POWER", "/hal/lib/libhal-backend-power.so",
-    "/hal/lib64/libhal-backend-power.so", "hal_backend_power_data"),
+    "/hal/lib64/libhal-backend-power.so", "hal_backend_power_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_SENSOR, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_SENSOR", "/hal/lib/libhal-backend-sensor.so",
-    "/hal/lib64/libhal-backend-sensor.so", "hal_backend_sensor_data"),
+    "/hal/lib64/libhal-backend-sensor.so", "hal_backend_sensor_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_PERIPHERAL, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
-    "HAL_MODULE_PERIPHERAL", nullptr, nullptr, nullptr),
+    "HAL_MODULE_PERIPHERAL", nullptr, nullptr, nullptr, {}),
 
   HalInfo(HAL_MODULE_DEVICE_BATTERY, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_DEVICE_BATTERY", "/hal/lib/libhal-backend-device-battery.so",
-    "/hal/lib64/libhal-backend-device-battery.so", "hal_backend_device_battery_data"),
+    "/hal/lib64/libhal-backend-device-battery.so", "hal_backend_device_battery_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_DEVICE_BEZEL, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_DEVICE_BEZEL", "/hal/lib/libhal-backend-device-bezel.so",
-    "/hal/lib64/libhal-backend-device-bezel.so", "hal_backend_device_bezel_data"),
+    "/hal/lib64/libhal-backend-device-bezel.so", "hal_backend_device_bezel_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_DEVICE_DISPLAY, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_DEVICE_DISPLAY", "/hal/lib/libhal-backend-device-display.so",
-    "/hal/lib64/libhal-backend-device-display.so", "hal_backend_device_display_data"),
+    "/hal/lib64/libhal-backend-device-display.so", "hal_backend_device_display_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_DEVICE_IR, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_DEVICE_IR", "/hal/lib/libhal-backend-device-ir.so",
-    "/hal/lib64/libhal-backend-device-ir.so", "hal_backend_device_ir_data"),
+    "/hal/lib64/libhal-backend-device-ir.so", "hal_backend_device_ir_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_DEVICE_TOUCHSCREEN, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_DEVICE_TOUCHSCREEN", "/hal/lib/libhal-backend-device-touchscreen.so",
-    "/hal/lib64/libhal-backend-device-touchscreen.so", "hal_backend_device_touchscreen_data"),
+    "/hal/lib64/libhal-backend-device-touchscreen.so", "hal_backend_device_touchscreen_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_DEVICE_LED, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_DEVICE_LED", "/hal/lib/libhal-backend-device-led.so",
-    "/hal/lib64/libhal-backend-device-led.so", "hal_backend_device_led_data"),
+    "/hal/lib64/libhal-backend-device-led.so", "hal_backend_device_led_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_DEVICE_BOARD, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_DEVICE_BOARD", "/hal/lib/libhal-backend-device-board.so",
-    "/hal/lib64/libhal-backend-device-board.so", "hal_backend_device_board_data"),
+    "/hal/lib64/libhal-backend-device-board.so", "hal_backend_device_board_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_DEVICE_EXTERNAL_CONNECTION, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_DEVICE_EXTERNAL_CONNECTION", "/hal/lib/libhal-backend-device-external-connection.so",
-    "/hal/lib64/libhal-backend-device-external-connection.so", "hal_backend_device_external_connection_data"),
+    "/hal/lib64/libhal-backend-device-external-connection.so", "hal_backend_device_external_connection_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_DEVICE_THERMAL, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_DEVICE_THERMAL", "/hal/lib/libhal-backend-device-thermal.so",
-    "/hal/lib64/libhal-backend-device-thermal.so", "hal_backend_device_thermal_data"),
+    "/hal/lib64/libhal-backend-device-thermal.so", "hal_backend_device_thermal_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_DEVICE_USB_GADGET, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_DEVICE_USB_GADGET", "/hal/lib/libhal-backend-device-usb-gadget.so",
-    "/hal/lib64/libhal-backend-device-usb-gadget.so", "hal_backend_device_usb_gadget_data"),
+    "/hal/lib64/libhal-backend-device-usb-gadget.so", "hal_backend_device_usb_gadget_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  ),
 
   HalInfo(HAL_MODULE_DEVICE_HAPTIC, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
     "HAL_MODULE_DEVICE_HAPTIC", "/hal/lib/libhal-backend-device-haptic.so",
-    "/hal/lib64/libhal-backend-device-haptic.so", "hal_backend_device_haptic_data")
-  ));
+    "/hal/lib64/libhal-backend-device-haptic.so", "hal_backend_device_haptic_data",
+    vector<struct hal_abi_version_match>{{
+      .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+      .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5
+    }}
+  )
+));
 
 TEST_P(HalInfoMatchedTest, get_backend_library_name) {
   const char *ret_library_name;
@@ -279,3 +402,24 @@ TEST_P(HalInfoMatchedTest, test_module_name_matching) {
 
   _destroy_module_info(info);
 }
+
+TEST_P(HalInfoMatchedTest, test_check_backend_abi_version) {
+  struct __hal_module_info *info = NULL;
+
+
+  auto result_info = GetParam();
+  info = _hal_api_conf_get_module_info(result_info.module_);
+  ASSERT_TRUE(info != nullptr);
+
+  vector<struct hal_abi_version_match> versions = result_info.versions_;
+  struct hal_abi_version_match *meta_versions = info->abi_versions;
+
+  for (unsigned int i = 0; i < versions.size(); i++) {
+    struct hal_abi_version_match tmp_version = versions[i];
+
+    int ret = hal_common_check_backend_abi_version(result_info.module_, tmp_version.platform_abi_version);
+    EXPECT_EQ(ret, TIZEN_ERROR_NONE) << "module name is " << result_info.module_name_;
+    EXPECT_EQ(meta_versions[i].platform_abi_version, tmp_version.platform_abi_version) << "module name is " << result_info.module_name_;;
+    EXPECT_EQ(meta_versions[i].backend_min_abi_version, tmp_version.backend_min_abi_version) << "module name is " << result_info.module_name_;;
+  }
+}