2 import os, subprocess, sys, argparse
3 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
6 from pathlib import Path
13 # The `dotnettool` works normally.
15 if not exist("/usr/bin/dotnettool"):
16 return "FAIL : The dotnettool works normally"
18 raw = cmd(f"shell dotnettool")
19 if "Dotnet Tool Version: 1.0" not in raw:
20 return "FAIL : The dotnettool works normally"
24 # The `native image` is generated normally.
26 cmd(f"shell dotnettool --ni-system")
28 if not exist(f"{RUNTIME_DIR}{SPC_DLL}.Backup"):
29 return "FAIL : Create the platform native image"
31 raw = cmd(f"shell find {RUNTIME_DIR} -name *.ni.dll")
32 lines1 = [l for l in raw.splitlines()]
33 len1 = len(lines1) + 1 # System.Private.CoreLib.dll
34 raw = cmd(f"shell find {RUNTIME_DIR} -maxdepth 1 -name *.dll -not -name *.ni.dll")
35 lines2 = [l for l in raw.splitlines()]
38 return f"FAIL : The number of .dll({len2}) and .ni.dll({len1}) must match in the {RUNTIME_DIR}"
40 raw = cmd(f"shell find {FRAMEWORK_DIR} -name *.ni.dll")
41 lines1 = [l for l in raw.splitlines()]
43 raw = cmd(f"shell find {FRAMEWORK_DIR} -name *.dll -not -name *.ni.dll")
44 lines2 = [l for l in raw.splitlines() if "/ref/" not in l]
47 return f"FAIL : The number of .dll({len2}) and .ni.dll({len1}) must match in the {FRAMEWORK_DIR}"
52 if Path(ni).name.replace(".ni.dll", "") == Path(dll).name.replace(".dll", ""):
56 return "FAIL : The file name of .dll and .ni.dll must match in the platform"
60 # Remove the `platform` native image.
62 cmd(f"shell dotnettool --ni-reset-system")
64 if exist(f"{RUNTIME_DIR}{SPC_DLL}.Backup"):
65 return "FAIL : Remove the platform native image"
69 # Create native image for `System.Private.CoreLib.dll`.
71 if exist(f"{RUNTIME_DIR}{SPC_DLL}.Backup"):
72 cmd(f"shell rm {RUNTIME_DIR}{SPC_DLL}")
73 cmd(f"shell mv {RUNTIME_DIR}{SPC_DLL}.Backup {RUNTIME_DIR}{SPC_DLL}")
75 raw = cmd(f"shell dotnettool --ni-dll {RUNTIME_DIR}{SPC_DLL}")
76 if (f"{SPC_DLL}" not in raw) or \
77 ("System.Private.CoreLib.ni.dll generated successfully." not in raw):
78 return f"FAIL : Create native image for {SPC_DLL}"
80 if not exist(f"{RUNTIME_DIR}{SPC_DLL}.Backup"):
81 return f"FAIL : Create native image for {SPC_DLL}"
85 # The file name of `.dll` and `.ni.dll` must match in the framework.
87 cmd(f"shell dotnettool --ni-dir {FRAMEWORK_DIR}")
88 raw = cmd(f"shell find {FRAMEWORK_DIR} -name *.ni.dll")
89 lines1 = [l for l in raw.splitlines()]
90 raw = cmd(f"shell find {FRAMEWORK_DIR} -name *.dll -not -name *.ni.dll")
91 lines2 = [l for l in raw.splitlines() if "/ref/" not in l]
92 if len(lines1) != len(lines2):
93 return "FAIL : The number of .dll and .ni.dll must match"
98 if Path(ni).name.replace(".ni.dll", "") == Path(dll).name.replace(".dll", ""):
102 return "FAIL : The file name of .dll and .ni.dll must match in the {FRAMEWORK_DIR}"
106 # The `.ni.dll` files should not exist in the framework.
108 cmd(f"shell dotnettool --ni-reset-dir {FRAMEWORK_DIR}")
109 raw = cmd(f"shell find {FRAMEWORK_DIR} -name *.ni.dll")
110 lines = [l for l in raw.splitlines()]
112 return "FAIL : The .ni.dll files should not exist"
116 # Create native image for Tizen.dll in `R2R` mode.
118 raw = cmd(f"shell dotnettool --r2r --ni-dll {FRAMEWORK_DIR}Tizen.dll")
119 if ("Tizen.dll" not in raw) or \
120 ("Tizen.ni.dll generated successfully." not in raw):
121 return "FAIL : Create native image for Tizen.dll in R2R mode"
125 # Displays detailed information while creating native image for Tizen.Log.dll.
127 raw = cmd(f"shell dotnettool --verbose --ni-dll {FRAMEWORK_DIR}Tizen.Log.dll")
128 if ("Tizen.Log.ni.dll generated successfully." not in raw) or \
129 ("Processing " not in raw) or \
130 (" dependencies" not in raw) or \
131 ("Moved to phase " not in raw):
132 return "FAIL : Displays detailed information while creating native image for Tizen.Log.dll"
136 # Create a native image for netstandard.dll by specifying the directory containing the IBC files.
138 packaging_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../packaging"))
141 raw = cmd("capability")
142 line = [l for l in raw.splitlines() if "cpu_arch" in l]
143 target_arch = line[0].split(":")[1]
144 if ("armv7" == target_arch) or \
145 ("x86" == target_arch):
146 ibcdata_zip = "ibcdata_arm.zip"
148 ibcdata_zip = "ibcdata_aarch64.zip"
150 cmd(f"push {packaging_path}/{ibcdata_zip} /tmp")
151 cmd(f"shell unzip /tmp/{ibcdata_zip} -d {IBCDATA_DIR}")
152 cmd(f"shell chsmack -a _ {IBCDATA_DIR} -r")
154 if not exist(f"{IBCDATA_DIR}netstandard.ibc"):
155 return "FAIL : The netstandard.ibc file should exist"
157 raw = cmd(f"shell dotnettool --ibc-dir /usr/share/dotnet.tizen/ibcdata/ --ni-dll {RUNTIME_DIR}netstandard.dll")
158 if ("netstandard.dll" not in raw) or \
159 ("netstandard.ni.dll generated successfully." not in raw):
160 return "FAIL : Create native image for netstandard.dll"
164 # The `Launcher_TC_TOOL_01` application does not have native image.
166 sln_name = "Launcher_TC_TOOL_01.Tizen"
168 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
170 return f"FAIL : Get the tpk path for {sln_name}"
172 if "OK" not in app_install(f"{tpk_path}"):
173 return f"FAIL : Install the application for {tpk_path}"
175 pkg_id = f"org.tizen.example.Launcher_TC_TOOL_01.Tizen"
177 root_path = get_root_path(f"{pkg_id}")
178 if root_path == "None":
179 return f"FAIL : Get the root path for {pkg_id}"
181 if not exist(f"{root_path}/bin/.native_image"):
182 return "FAIL : The .native_image folder should exist"
184 cmd(f"shell dotnettool --ni-reset-pkg {pkg_id}")
186 if exist(f"{root_path}/bin/.native_image"):
187 return "FAIL : The .native_image folder should not exist"
189 raw = cmd(f"shell find {root_path}/bin/ -name *.ni.dll")
190 lines = [l for l in raw.splitlines()]
192 return "FAIL : The .ni.dll files should not exist"
196 # The `Launcher_TC_TOOL_02` application generates native image.
198 sln_name = "Launcher_TC_TOOL_02.Tizen"
200 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
202 return f"FAIL : Get the tpk path for {sln_name}"
204 if "OK" not in app_install(f"{tpk_path}"):
205 return f"FAIL : Install the application for {tpk_path}"
207 pkg_id = f"org.tizen.example.Launcher_TC_TOOL_02.Tizen"
209 root_path = get_root_path(f"{pkg_id}")
210 if root_path == "None":
211 return f"FAIL : Get the root path for {pkg_id}"
213 if exist(f"{root_path}/bin/.native_image"):
214 return "FAIL : The .native_image folder not should exist"
216 cmd(f"shell dotnettool --ni-pkg {pkg_id}")
218 if not exist(f"{root_path}/bin/.native_image"):
219 return "FAIL : The .native_image folder should exist"
221 raw = cmd(f"shell find {root_path}/bin/.native_image/ -name *.ni.dll")
222 lines1 = [l for l in raw.splitlines()]
223 raw = cmd(f"shell find {root_path}/bin/ -maxdepth 1 -name *.dll -not -name *.ni.dll")
224 lines2 = [l for l in raw.splitlines()]
225 if len(lines1) != len(lines2):
226 return "FAIL : The number of .dll and .ni.dll must match in the application"
231 if Path(ni).name.replace(".ni.dll", "") == Path(dll).name.replace(".dll", ""):
235 return "FAIL : The file name of .dll and .ni.dll must match in the application"
239 # The `prefer_dotnet_aot` metadata value of `true` will regenerates the native image in all .NET applications.
241 sln_name = "Launcher_TC_TOOL_03.Tizen"
243 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
245 return f"FAIL : Get the tpk path for {sln_name}"
247 if "OK" not in app_install(f"{tpk_path}"):
248 return f"FAIL : Install the application for {tpk_path}"
250 cmd(f"shell dotnettool --ni-regen-all-app")
252 raw = subprocess.run((f"sdb -s {serial} shell pkginfo --metadata-flt").split(), stdout=subprocess.PIPE, input=f"http://tizen.org/metadata/prefer_dotnet_aot\ntrue\n", encoding="utf-8").stdout
253 lines = [l for l in raw.splitlines() if "appid" in l]
255 pkg_id = app.split(": ")[1]
256 raw = subprocess.run((f"sdb -s {serial} shell pkginfo --pkg {pkg_id}").split(), stdout=subprocess.PIPE, encoding="utf-8").stdout
257 readonly = [l for l in raw.splitlines() if "Readonly" in l]
258 if "0" == readonly[0].split(": ")[1]:
259 path = [l for l in raw.splitlines() if "root_path" in l]
260 root_path = path[0].split(": ")[1]
261 raw = cmd(f"shell find {root_path}/bin/.native_image/ -name *.ni.dll")
262 lines1 = [l for l in raw.splitlines()]
263 raw = cmd(f"shell find {root_path}/bin/ -maxdepth 1 -name *.dll -not -name *.ni.dll")
264 lines2 = [l for l in raw.splitlines()]
265 if len(lines1) != len(lines2):
266 return "FAIL : The number of .dll and .ni.dll must match in the application"
271 if Path(ni).name.replace(".ni.dll", "") == Path(dll).name.replace(".dll", ""):
275 return "FAIL : The file name of .dll and .ni.dll must match in the application"
279 # The `prefer_nuget_cache` metadata value of `true` will regenerates the native image in the `TAC`.
281 sln_name = "Launcher_TC_TOOL_04.Tizen"
283 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
285 return f"FAIL : Get the tpk path for {sln_name}"
287 if "OK" not in app_install(f"{tpk_path}"):
288 return f"FAIL : Install the application for {tpk_path}"
290 raw = cmd(f"shell dotnettool --tac-regen-all")
291 if (".dll" not in raw) or \
292 (".ni.dll generated successfully." not in raw):
293 return "FAIL : Create native image for TAC"
297 # The `Launcher_TC_TOOL_05` application must not have `TAC` applied.
299 sln_name = "Launcher_TC_TOOL_05.Tizen"
301 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
303 return f"FAIL : Get the tpk path for {sln_name}"
305 if "OK" not in app_install(f"{tpk_path}"):
306 return f"FAIL : Install the application for {tpk_path}"
308 pkg_id = f"org.tizen.example.Launcher_TC_TOOL_05.Tizen"
310 root_path = get_root_path(f"{pkg_id}")
311 if root_path == "None":
312 return f"FAIL : Get the root path for {pkg_id}"
314 if not exist(f"{root_path}/bin/.tac_symlink"):
315 return "FAIL : The .tac_symlink folder should exist"
317 raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
318 lines1 = [l for l in raw.splitlines()]
319 raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.6.0.967/ -name *.dll -not -name *.ni.dll")
320 lines2 = [l for l in raw.splitlines()]
321 if len(lines1) != len(lines2):
322 return "FAIL : The number of .dll in the .tac_symlink and .dll in the TAC must match"
324 raw = cmd(f"shell ls -alZ {root_path}/bin/.tac_symlink/*.dll")
325 lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
327 origin_path = dll.split("->")[1].strip()
328 if not exist(f"{origin_path}"):
329 return "FAIL : The original file of the symbolic link must exist"
331 cmd(f"shell dotnettool --tac-disable-pkg {pkg_id}")
333 if exist(f"{root_path}/bin/.tac_symlink"):
334 return "FAIL : The .tac_symlink folder should not exist"
336 raw = cmd(f"shell find {root_path}/bin/ -maxdepth 1 -name *.dll -not -name *.ni.dll")
337 lines = [l for l in raw.splitlines()]
339 return "FAIL : The number of .dll must exist correctly in the bin folder"
343 # The `Launcher_TC_TOOL_06` application must have `TAC` applied.
345 sln_name = "Launcher_TC_TOOL_06.Tizen"
347 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
349 return f"FAIL : Get the tpk path for {sln_name}"
351 if "OK" not in app_install(f"{tpk_path}"):
352 return f"FAIL : Install the application for {tpk_path}"
354 pkg_id = f"org.tizen.example.Launcher_TC_TOOL_06.Tizen"
356 root_path = get_root_path(f"{pkg_id}")
357 if root_path == "None":
358 return f"FAIL : Get the root path for {pkg_id}"
360 cmd(f"shell dotnettool --tac-disable-pkg {pkg_id}")
362 if exist(f"{root_path}/bin/.tac_symlink"):
363 return "FAIL : The .tac_symlink folder should not exist"
365 raw = cmd(f"shell find {root_path}/bin/ -maxdepth 1 -name *.dll -not -name *.ni.dll")
366 lines = [l for l in raw.splitlines()]
368 return "FAIL : The number of .dll must exist correctly in the bin folder"
370 cmd(f"shell dotnettool --tac-enable-pkg {pkg_id}")
372 if not exist(f"{root_path}/bin/.tac_symlink"):
373 return "FAIL : The .tac_symlink folder should exist"
375 raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
376 lines1 = [l for l in raw.splitlines()]
377 raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.6.0.967/ -name *.dll -not -name *.ni.dll")
378 lines2 = [l for l in raw.splitlines()]
379 if len(lines1) != len(lines2):
380 return "FAIL : The number of .dll in the .tac_symlink and .dll in the TAC must match"
382 raw = cmd(f"shell ls -alZ {root_path}/bin/.tac_symlink/*.dll")
383 lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
385 origin_path = dll.split("->")[1].strip()
386 if not exist(f"{origin_path}"):
387 return "FAIL : The original file of the symbolic link must exist"
391 # The `DB` of the restored `TAC` and `TLC` must be a valid value.
393 sln_name = "Launcher_TC_TOOL_07.Tizen"
395 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
397 return f"FAIL : Get the tpk path for {sln_name}"
399 if "OK" not in app_install(f"{tpk_path}"):
400 return f"FAIL : Install the application for {tpk_path}"
402 cmd(f"shell rm {DOTNET_DIR}.TAC.App.list.db*")
403 cmd(f"shell rm {DOTNET_DIR}.TLC.App.list.db*")
405 cmd(f"shell dotnettool --tac-restore-db")
407 pkg_id = f"org.tizen.example.Launcher_TC_TOOL_07.Tizen"
409 raw = subprocess.run((f"sdb -s {serial} shell sqlite3 {DOTNET_DIR}.TAC.App.list.db").split(), stdout=subprocess.PIPE, input=f"select * from TAC;\n.q\n", encoding="utf-8").stdout
410 lines = [l for l in raw.splitlines() if f"{pkg_id}" in l]
413 if ("SkiaSharp/2.80.2" in rcd) or \
414 ("Xamarin.Forms/4.6.0.967" in rcd):
418 return "FAIL : TAC database must have a valid value"
420 raw = subprocess.run((f"sdb -s {serial} shell sqlite3 {DOTNET_DIR}.TLC.App.list.db").split(), stdout=subprocess.PIPE, input=f"select * from TLC;\n.q\n", encoding="utf-8").stdout
421 lines = [l for l in raw.splitlines() if f"{pkg_id}" in l]
423 if "libSkiaSharp.so..8e2fcc43f9c49b2de7b6212ff5ed914b319bc92f125715b9fe1f35786df82f98" not in rcd:
424 return "FAIL : TLC database must have a valid value"
428 # The prefer_dotnet_aot metadata value of true will regenerates the native image in all .NET applications of read-only type.
430 sln_name = "Launcher_TC_TOOL_08.Tizen"
432 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
434 return f"FAIL : Get the tpk path for {sln_name}"
436 cmd(f"shell mount -o remount,rw /")
438 raw = cmd(f"push {tpk_path} /usr/apps/.preload-tpk/")
439 if "1 file(s) pushed. 0 file(s) skipped." in raw:
440 cmd(f"shell install_preload_pkg")
442 cmd(f"shell mount -o remount,ro /")
444 cmd(f"shell dotnettool --ni-regen-all-app")
446 raw = subprocess.run((f"sdb -s {serial} shell pkginfo --metadata-flt").split(), stdout=subprocess.PIPE, input=f"http://tizen.org/metadata/prefer_dotnet_aot\ntrue\n", encoding="utf-8").stdout
447 lines = [l for l in raw.splitlines() if "appid" in l]
449 pkg_id = app.split(": ")[1]
450 raw = subprocess.run((f"sdb -s {serial} shell pkginfo --pkg {pkg_id}").split(), stdout=subprocess.PIPE, encoding="utf-8").stdout
451 readonly = [l for l in raw.splitlines() if "Readonly" in l]
452 if "1" == readonly[0].split(": ")[1]:
453 path = [l for l in raw.splitlines() if "root_path" in l]
454 root_path = path[0].split(": ")[1]
455 raw = cmd(f"shell find {DOTNET_DIR}apps/{pkg_id}/bin/.native_image/ -name *.ni.dll")
456 lines1 = [l for l in raw.splitlines()]
457 raw = cmd(f"shell find {root_path}/bin/ -maxdepth 1 -name *.dll -not -name *.ni.dll")
458 lines2 = [l for l in raw.splitlines()]
459 if len(lines1) != len(lines2):
460 return "FAIL : The number of .dll and .ni.dll must match in the application"
465 if Path(ni).name.replace(".ni.dll", "") == Path(dll).name.replace(".dll", ""):
469 return "FAIL : The file name of .dll and .ni.dll must match in the application"
473 # The `Launcher_TC_TOOL_08` application should load the newly generated native image.
475 pkg_id = f"org.tizen.example.Launcher_TC_TOOL_08.Tizen"
477 pid = launch_and_get_pid(f"-e", f"{pkg_id}")
479 return f"FAIL : Get the pid for {pkg_id}"
481 raw = cmd(f"shell cat /proc/{pid}/smaps | grep Xamarin.Forms.*.dll")
482 if (f"{DOTNET_DIR}apps/{pkg_id}/bin/.native_image/Xamarin.Forms.Platform.Tizen.ni.dll" not in raw) or \
483 (f"{DOTNET_DIR}apps/{pkg_id}/bin/.native_image/Xamarin.Forms.Core.ni.dll" not in raw) or \
484 (f"{DOTNET_DIR}apps/{pkg_id}/bin/.native_image/Xamarin.Forms.Platform.ni.dll" not in raw):
485 return "FAIL : The Xamarin.Forms in the application should be loaded when running the application"
487 cmd(f"shell app_launcher -t {pkg_id}")
491 # It should be done together for update test.
503 # The `Launcher_TC_TOOL_09` application of read-only type generates native image.
505 sln_name = "Launcher_TC_TOOL_09.Tizen"
507 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
509 return f"FAIL : Get the tpk path for {sln_name}"
511 cmd(f"shell mount -o remount,rw /")
512 raw = cmd(f"push {tpk_path} /usr/apps/.preload-tpk/")
513 if "1 file(s) pushed. 0 file(s) skipped." in raw:
514 cmd(f"shell install_preload_pkg")
515 cmd(f"shell mount -o remount,ro /")
517 pkg_id = f"org.tizen.example.Launcher_TC_TOOL_09.Tizen"
519 root_path = get_root_path(f"{pkg_id}")
520 if root_path == "None":
521 return f"FAIL : Get the root path for {pkg_id}"
523 if exist(f"{root_path}/bin/.native_image"):
524 return "FAIL : The .native_image folder not should exist"
526 cmd(f"shell dotnettool --ni-pkg {pkg_id}")
528 if not exist(f"{DOTNET_DIR}apps/{pkg_id}/bin/.native_image"):
529 return "FAIL : The .native_image folder should exist"
531 raw = cmd(f"shell find {DOTNET_DIR}apps/{pkg_id}/bin/.native_image/ -name *.ni.dll")
532 lines1 = [l for l in raw.splitlines()]
533 raw = cmd(f"shell find {root_path}/bin/ -maxdepth 1 -name *.dll -not -name *.ni.dll")
534 lines2 = [l for l in raw.splitlines()]
535 if len(lines1) != len(lines2):
536 return "FAIL : The number of .dll and .ni.dll must match in the application"
541 if Path(ni).name.replace(".ni.dll", "") == Path(dll).name.replace(".dll", ""):
545 return "FAIL : The file name of .dll and .ni.dll must match in the application"
549 # Print command and option while creating native image for Tizen.dll.
551 cmd(f"shell mount -o remount,rw /")
552 raw = cmd(f"shell dotnettool --print-cmd --ni-dll {FRAMEWORK_DIR}Tizen.dll")
553 if ("Tizen.ni.dll generated successfully." not in raw) or \
554 ("==================== NI Commands =========================" not in raw) or \
555 ("+ /usr/share/dotnet.tizen/netcoreapp/corerun" not in raw) or \
556 ("+ /usr/share/dotnet.tizen/netcoreapp/crossgen2/crossgen2.dll" not in raw) or \
557 ("+ --jitpath" not in raw) or \
558 ("+ /usr/share/dotnet.tizen/netcoreapp/libclrjit.so" not in raw) or \
559 ("+ --targetarch" not in raw) or \
560 ("+ --out-near-input" not in raw) or \
561 ("+ --single-file-compilation" not in raw) or \
562 ("+ --resilient" not in raw) or \
563 ("+ --Ot" not in raw) or \
564 (f"+ {FRAMEWORK_DIR}Tizen.dll" not in raw) or \
565 ("+ (null)" not in raw):
566 return "FAIL : Print command and option while creating native image for Tizen.dll"
570 # Create native image for netstandard.dll by adding options --inputbubble and --compilebubblegenerics.
572 cmd(f"shell mount -o remount,rw /")
573 raw = cmd(f"shell dotnettool --inputbubble --inputbubbleref \'{RUNTIME_DIR}*.dll\' --print-cmd --ni-dll {RUNTIME_DIR}netstandard.dll")
574 if ("netstandard.ni.dll generated successfully." not in raw) or \
575 ("+ --inputbubble" not in raw) or \
576 ("+ --compilebubblegenerics" not in raw):
577 return "FAIL : Create native image for netstandard.dll by adding options --inputbubble and --compilebubblegenereics"
581 # Create native image for System.dll by adding options --inputbubble and --inputbubbleref.
583 cmd(f"shell mount -o remount,rw /")
584 raw = cmd(f"shell dotnettool --inputbubble --inputbubbleref \'{RUNTIME_DIR}crossgen2/*.dll\' --print-cmd --ni-dll {RUNTIME_DIR}System.dll")
585 if ("System.ni.dll generated successfully." not in raw) or \
586 ("+ --inputbubble" not in raw) or \
587 ("+ --inputbubbleref:/usr/share/dotnet.tizen/netcoreapp/crossgen2/*.dll" not in raw):
588 return "FAIL : Create native image for System.dll by adding options --inputbubble and --inputbubbleref"
592 # Create native image for System.Console.dll by adding option --ref.
594 cmd(f"shell mount -o remount,rw /")
595 raw = cmd(f"shell dotnettool --ref \'{RUNTIME_DIR}*.dll:{RUNTIME_DIR}crossgen2/*.dll\' --print-cmd --ni-dll {RUNTIME_DIR}System.Console.dll")
596 if ("System.Console.ni.dll generated successfully." not in raw) or \
597 (f"+ -r:/usr/share/dotnet.tizen/netcoreapp/*.dll" not in raw) or \
598 (f"+ -r:/usr/share/dotnet.tizen/netcoreapp/crossgen2/*.dll" not in raw):
599 return "FAIL : Create native image for System.Console.dll by adding option --ref"
603 # Create native image for mscorlib.dll by adding option --no-pipeline
605 cmd(f"shell mount -o remount,rw /")
606 raw = cmd(f"shell dotnettool --ni-dll --no-pipeline --print-cmd {RUNTIME_DIR}mscorlib.dll")
607 if ("mscorlib.ni.dll generated successfully." not in raw) or \
608 ("+ -o" not in raw) or \
609 ("/mscorlib.ni.dll" not in raw):
610 return "FAIL : Create native image for mscorlib.dll by adding option --no-pipeline"
615 #dotnettool --rm-app-profile
616 #dotnettool --rm-all-app-profile
621 cmd(f"shell mount -o remount,rw /")
624 tpk_list = search_tpk(f"{module_name}")
626 pn = run_tc_array(module_name, tc_array)
627 n = int(pn.split(":")[0])
628 f = int(pn.split(":")[1])
629 p = int(pn.split(":")[2])
631 if (len(tc_array) - n) != 0:
632 r = round(((p / (len(tc_array) - n)) * 100), 2)
633 print(f"--- {module_name} TCT Result ---\nNONE : [{n}] / FAIL : [{f}] / PASS : [{p}] - [{r}%]\n")
635 # Uninstall the application and restore to original state
637 cmd(f"uninstall org.tizen.example.Launcher_TC_TOOL_01.Tizen")
638 cmd(f"uninstall org.tizen.example.Launcher_TC_TOOL_02.Tizen")
639 cmd(f"uninstall org.tizen.example.Launcher_TC_TOOL_03.Tizen")
640 cmd(f"uninstall org.tizen.example.Launcher_TC_TOOL_04.Tizen")
641 cmd(f"uninstall org.tizen.example.Launcher_TC_TOOL_05.Tizen")
642 cmd(f"uninstall org.tizen.example.Launcher_TC_TOOL_06.Tizen")
643 cmd(f"uninstall org.tizen.example.Launcher_TC_TOOL_07.Tizen")
645 cmd(f"shell rm {FRAMEWORK_DIR}Tizen.ni.dll")
646 cmd(f"shell rm {FRAMEWORK_DIR}Tizen.Log.ni.dll")
647 cmd(f"shell rm {RUNTIME_DIR}netstandard.ni.dll")
648 cmd(f"shell rm {RUNTIME_DIR}System.ni.dll")
649 cmd(f"shell rm {RUNTIME_DIR}System.Console.ni.dll")
650 cmd(f"shell rm {RUNTIME_DIR}mscorlib.ni.dll")
652 # cmd(f"shell rm -rf {IBCDATA_DIR}")
654 cmd(f"shell rm -rf {DOTNET_DIR}apps/org.tizen.example.Launcher_TC_TOOL_08.Tizen")
655 cmd(f"shell rm -rf {DOTNET_DIR}apps/org.tizen.example.Launcher_TC_TOOL_09.Tizen")
659 parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter)
660 parser.add_argument("TC_NUMBER", type=str, nargs="*", help="Individual excution")
661 args = parser.parse_args()
664 if args.TC_NUMBER and "TC_" in args.TC_NUMBER[0]:
666 for tc_num in args.TC_NUMBER:
667 if tc_num not in funcMap:
668 print(f"There is no {tc_num} test.")
671 tc_array.append(funcMap[tc_num])
673 # skip TC_07 (--r2r), TC_09 (--ibc-dir)
674 tc_array = [TC_01, TC_02, TC_03, TC_04, TC_05, TC_06, TC_08, TC_10, TC_11, TC_12, TC_13, TC_14, TC_15, TC_16, TC_17, TC_18, TC_19, TC_20, TC_21, TC_22, TC_23, TC_24]
677 if len(sys.argv) >= 2 and "TC_" not in sys.argv[1]:
678 serial = read_serial(sys.argv[1])
680 serial = read_serial(None)
683 print("No connected device(s).")
686 device = get_device_type()
687 print(f"=== Dotnet-Launcher [{device}] Test Case - ({module_name}) ===")
694 'TC_01': TC_01, 'TC_02': TC_02, 'TC_03': TC_03, 'TC_04': TC_04, 'TC_05': TC_05, 'TC_06': TC_06,
695 'TC_07': TC_07, 'TC_08': TC_08, 'TC_09': TC_09, 'TC_10': TC_10, 'TC_11': TC_11, 'TC_12': TC_12,
696 'TC_13': TC_13, 'TC_14': TC_14, 'TC_15': TC_15, 'TC_16': TC_16, 'TC_17': TC_17, 'TC_18': TC_17_18,
697 'TC_19': TC_19, 'TC_20': TC_20, 'TC_21': TC_21, 'TC_22' : TC_22, 'TC_23' : TC_23, 'TC_24' : TC_24,
698 'TOOL_TC_01': TC_01, 'TOOL_TC_02': TC_02, 'TOOL_TC_03': TC_03, 'TOOL_TC_04': TC_04, 'TOOL_TC_05': TC_05, 'TOOL_TC_06': TC_06,
699 'TOOL_TC_07': TC_07, 'TOOL_TC_08': TC_08, 'TOOL_TC_09': TC_09, 'TOOL_TC_10': TC_10, 'TOOL_TC_11': TC_11, 'TOOL_TC_12': TC_12,
700 'TOOL_TC_13': TC_13, 'TOOL_TC_14': TC_14, 'TOOL_TC_15': TC_15, 'TOOL_TC_16': TC_16, 'TOOL_TC_17': TC_17, 'TOOL_TC_18': TC_17_18, 'TOOL_TC_19': TC_19, 'TOOL_TC_20': TC_20, 'TOOL_TC_21': TC_21, 'TOOL_TC_22' : TC_22, 'TOOL_TC_23' : TC_23, 'TOOL_TC_24' : TC_24
704 if __name__ == "__main__":
707 except KeyboardInterrupt:
708 print("\nExit (Pressed Ctrl+C)")