From c9c80e9e4cd8be16d3a4783f300e3be1dca6da40 Mon Sep 17 00:00:00 2001 From: Hakkyu Kim Date: Thu, 7 Oct 2021 15:47:07 +0900 Subject: [PATCH 1/4] Test on multiple ephemeral profile targets --- .github/workflows/integration_test.yml | 8 ++++---- tools/recipe.yaml | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 tools/recipe.yaml diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index b4ea529aa..50780dae0 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -23,7 +23,8 @@ jobs: run: | export PATH=`pwd`/flutter-tizen/bin:$PATH ./tools/run_command.py test \ - --platforms wearable-5.5 \ + --recipe ./tools/recipe.yaml \ + --use-ephemeral-targets \ --run-on-changed-packages \ --base-sha=$(git rev-parse HEAD^) \ --exclude wearable_rotary image_picker camera webview_flutter \ @@ -32,11 +33,10 @@ jobs: google_maps_flutter tizen_app_control # The following packages are excluded from tests: # wearable_rotary, image_picker: no tests. - # camera: the current test target is wearable emulator 5.5, which doesn't support this package. - # webview_flutter: the current test target is wearable emulator 5.5, which doesn't support this package. + # camera: no supported profiles. # video_player: test frequently breaks due to memory issue(https://github.com/flutter-tizen/plugins/issues/135). # permission_handler: permission related test. # geolocator: test requires console manipulation. # battery, connectivity, device_info, package_info, sensors, share, wifi_info_flutter: deprecated. - # google_maps_flutter: device limitation not yet specified. + # google_maps_flutter, webview_flutter: not supported by emulators # tizen_app_control: test available after Flutter 2.5 migration. diff --git a/tools/recipe.yaml b/tools/recipe.yaml new file mode 100644 index 000000000..207b0011c --- /dev/null +++ b/tools/recipe.yaml @@ -0,0 +1,25 @@ +plugins: + audioplayers: ["wearable-5.5", "tv-6.0"] + battery_plus: ["wearable-5.5"] + camera: [] + connectivity_plus: ["wearable-5.5", "tv-6.0"] + device_info_plus: ["wearable-5.5", "tv-6.0"] + flutter_tts: ["wearable-5.5", "tv-6.0"] + geolocator: ["wearable-5.5"] + google_maps_flutter: [] + image_picker: [] + integration_test: ["wearable-5.5", "tv-6.0"] + messageport: ["wearable-5.5", "tv-6.0"] + network_info_plus: [] + package_info_plus: ["wearable-5.5", "tv-6.0"] + path_provider: ["wearable-5.5", "tv-6.0"] + permission_handler: ["wearable-5.5"] + sensors_plus: ["wearable-5.5"] + share_plus: ["wearable-5.5"] + shared_preferences: ["wearable-5.5", "tv-6.0"] + tizen_app_control: ["wearable-5.5", "tv-6.0"] + url_launcher: [] + video_player: ["wearable-5.5"] + wakelock: ["wearable-5.5"] + wearable_rotary: ["wearable-5.5"] + webview_flutter: [] From 89ef497f97a0ae5d2a82faa7ef6d490c0fd9978e Mon Sep 17 00:00:00 2001 From: Hakkyu Kim Date: Fri, 8 Oct 2021 10:49:09 +0900 Subject: [PATCH 2/4] Rename the option to --generate-emulators --- .github/workflows/integration_test.yml | 2 +- tools/commands/integration_test.py | 50 +++++++++++++------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 50780dae0..c3b02abfc 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -24,7 +24,7 @@ jobs: export PATH=`pwd`/flutter-tizen/bin:$PATH ./tools/run_command.py test \ --recipe ./tools/recipe.yaml \ - --use-ephemeral-targets \ + --generate-emulators \ --run-on-changed-packages \ --base-sha=$(git rev-parse HEAD^) \ --exclude wearable_rotary image_picker camera webview_flutter \ diff --git a/tools/commands/integration_test.py b/tools/commands/integration_test.py index e95ac5da2..eed83a41d 100755 --- a/tools/commands/integration_test.py +++ b/tools/commands/integration_test.py @@ -130,8 +130,8 @@ def run_integration_test(self, plugin_name, directory, timeout): ]) -class EphemeralTarget(Target): - """A Tizen emulator that launches/poweroffs itself during test.""" +class TemporaryEmulator(Target): + """A Tizen emulator that is created temporary by the tool for testing purposes.""" def __init__(self, name, platform): super().__init__(name, platform) @@ -289,8 +289,8 @@ def _parse_target_info(self, capability_info): return device_profile, tizen_version -class EphemeralTargetManager(TargetManager): - """A TargetManager for EphemeralTargets.""" +class TemporaryEmulatorManager(TargetManager): + """A TargetManager for TemporaryEmulators.""" def __init__(self, platforms): super().__init__() @@ -298,22 +298,22 @@ def __init__(self, platforms): def __enter__(self): for platform in self.platforms: - self._create_ephemeral_target(platform) + self._create_emulator(platform) return self def __exit__(self, exc_type, exc_value, traceback): - self._delete_ephemeral_targets() + self._delete_emulators() super().__exit__(exc_type, exc_value, traceback) - def _create_ephemeral_target(self, platform): + def _create_emulator(self, platform): device_profile, tizen_version = platform.split('-', 1) # Target name valid characters are [A-Za-z0-9-_]. - target_name = f'{device_profile}-{tizen_version.replace(".", "_")}-{os.getpid()}' - target = EphemeralTarget(target_name, platform) - target.create() - self.targets_per_platform[platform].append(target) + emulator_name = f'{device_profile}-{tizen_version.replace(".", "_")}-{os.getpid()}' + emulator = TemporaryEmulator(emulator_name, platform) + emulator.create() + self.targets_per_platform[platform].append(emulator) - def _delete_ephemeral_targets(self): + def _delete_emulators(self): for targets in self.targets_per_platform.values(): for target in targets: target.delete() @@ -384,23 +384,23 @@ def set_subparser(subparsers): c: [wearable-4.0] )''') parser.add_argument( - '--use-ephemeral-targets', + '--generate-emulators', default=False, action='store_true', - help='''Create and destroy ephemeral targets during test. -Must provide --platforms or --recipe option to specify which -platform targets to create.''') + help='''Create and destroy emulators during test. +Must provide either --platforms or --recipe option to specify which +platforms to create.''') parser.set_defaults(func=run_integration_test) -def _get_target_manager(use_ephemeral_targets, platforms): - if use_ephemeral_targets: - return EphemeralTargetManager(platforms) +def _get_target_manager(generate_emulators, platforms): + if generate_emulators: + return TemporaryEmulatorManager(platforms) else: return TargetManager() -def _integration_test(plugin_dir, platforms, timeout, use_ephemeral_targets): +def _integration_test(plugin_dir, platforms, timeout, generate_emulators): """Runs integration test in the example package for plugin_dir Currently the tools assumes that there's only one example package per plugin. @@ -409,7 +409,7 @@ def _integration_test(plugin_dir, platforms, timeout, use_ephemeral_targets): plugin_dir (str): The path to a single plugin directory. platforms (List[str]): A list of testing platforms. timeout (int): Time limit in seconds before cancelling the test. - use_ephemeral_targets (bool): Whether to create and delete targets + generate_emulators (bool): Whether to create and delete targets for test. Returns: @@ -450,7 +450,7 @@ def _integration_test(plugin_dir, platforms, timeout, use_ephemeral_targets): try: with _get_target_manager( - use_ephemeral_targets, + generate_emulators, platforms, ) as target_manager: if not platforms: @@ -521,9 +521,9 @@ def run_integration_test(args): ) exit(1) - if args.use_ephemeral_targets and not args.platforms and not args.recipe: + if args.generate_emulators and not args.platforms and not args.recipe: print( - '--use-ephemeral-targets option must be used with either --platforms or --recipe option.' + '--generate-emulators option must be used with either --platforms or --recipe option.' ) exit(1) @@ -552,7 +552,7 @@ def run_integration_test(args): os.path.join(packages_dir, testing_plugin), platforms, args.timeout, - args.use_ephemeral_targets, + args.generate_emulators, )) print(f'============= TEST RESULT =============') From 407acbecda6a4c3aa29916c5d3dbd4a4715b246e Mon Sep 17 00:00:00 2001 From: Hakkyu Kim Date: Fri, 8 Oct 2021 13:14:15 +0900 Subject: [PATCH 3/4] Exclude some tests --- .github/workflows/integration_test.yml | 4 ++-- tools/recipe.yaml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index c3b02abfc..0cffb5bb0 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -30,7 +30,7 @@ jobs: --exclude wearable_rotary image_picker camera webview_flutter \ video_player permission_handler geolocator battery connectivity \ device_info package_info sensors share wifi_info_flutter \ - google_maps_flutter tizen_app_control + google_maps_flutter tizen_app_control url_launcher network_info_plus # The following packages are excluded from tests: # wearable_rotary, image_picker: no tests. # camera: no supported profiles. @@ -38,5 +38,5 @@ jobs: # permission_handler: permission related test. # geolocator: test requires console manipulation. # battery, connectivity, device_info, package_info, sensors, share, wifi_info_flutter: deprecated. - # google_maps_flutter, webview_flutter: not supported by emulators + # google_maps_flutter, webview_flutter, url_launcher, network_info_plus: not supported by emulators # tizen_app_control: test available after Flutter 2.5 migration. diff --git a/tools/recipe.yaml b/tools/recipe.yaml index 207b0011c..1e79c7c7e 100644 --- a/tools/recipe.yaml +++ b/tools/recipe.yaml @@ -1,5 +1,6 @@ plugins: - audioplayers: ["wearable-5.5", "tv-6.0"] + # audioplayers should also test for tv-6.0, currently the test fails on tv-6.0. + audioplayers: ["wearable-5.5"] battery_plus: ["wearable-5.5"] camera: [] connectivity_plus: ["wearable-5.5", "tv-6.0"] From 0dbdd28cf4406be88c183823fe448d2fb4fb8365 Mon Sep 17 00:00:00 2001 From: Hakkyu Kim Date: Fri, 8 Oct 2021 13:44:25 +0900 Subject: [PATCH 4/4] Add issue link in recipe file --- tools/recipe.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/recipe.yaml b/tools/recipe.yaml index 1e79c7c7e..aeb03efe0 100644 --- a/tools/recipe.yaml +++ b/tools/recipe.yaml @@ -1,5 +1,6 @@ plugins: # audioplayers should also test for tv-6.0, currently the test fails on tv-6.0. + # https://github.com/flutter-tizen/plugins/issues/239 audioplayers: ["wearable-5.5"] battery_plus: ["wearable-5.5"] camera: []