[TC Fixed] Index out of range
[platform/core/dotnet/launcher.git] / tests / TCs / 4_TAC / TAC.py
1 #!/usr/bin/env python3
2 import os, subprocess, sys, argparse
3 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
4
5 from time import sleep
6 from Utils import *
7
8
9 module_name = "TAC"
10
11 # The `Launcher_TC_TAC_01` application must have TAC applied.
12 def TC_01():
13     sln_name = "Launcher_TC_TAC_01.Tizen"
14
15     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
16     if tpk_path == None:
17         return f"FAIL : Get the tpk path for {sln_name}"
18
19     if "OK" not in app_install(f"{tpk_path}"):
20         return f"FAIL : Install the application for {tpk_path}"
21
22     pkg_id = f"org.tizen.example.Launcher_TC_TAC_01.Tizen"
23
24     root_path = get_root_path(f"{pkg_id}")
25     if root_path == "None":
26         return f"FAIL : Get the root path for {pkg_id}"
27
28     raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
29     if ".tac_symlink" not in raw:
30         return "FAIL : The .tac_symlink folder should exist"
31
32     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
33     lines1 = [l for l in raw.splitlines()]
34     raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.6.0.967/ -name *.dll -not -name *.ni.dll")
35     lines2 = [l for l in raw.splitlines()]
36     if len(lines1) != len(lines2):
37         return "FAIL : The number of .dll in the .tac_symlink and .dll in the TAC must match"
38
39     raw = cmd(f"shell ls -alZ {root_path}/bin/.tac_symlink/*.dll")
40     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
41     for dll in lines:
42         origin_path = dll.split("->")[1].strip()
43         raw = cmd(f"shell ls -alZ {origin_path}")
44         if "No such file or directory" in raw:
45             return "FAIL : The original file of the symbolic link must exist"
46
47     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
48     if 0 == pid:
49         return f"FAIL : Get the pid for {pkg_id}"
50
51     raw = cmd(f"shell cat /proc/{pid}/smaps | grep Xamarin.Forms.*.dll")
52     if (f"{DOTNET_DIR}Xamarin.Forms/4.6.0.967/Xamarin.Forms.Platform.Tizen.dll" not in raw) and \
53        (f"{DOTNET_DIR}Xamarin.Forms/4.6.0.967/Xamarin.Forms.Core.dll" not in raw) and \
54        (f"{DOTNET_DIR}Xamarin.Forms/4.6.0.967/Xamarin.Forms.Platform.dll" not in raw):
55         return "FAIL : The Xamarin.Forms in the TAC should be loaded when running the application"
56
57     cmd(f"shell app_launcher -t {pkg_id}")
58
59     return "PASS"
60
61 # The `Launcher_TC_TAC_02` application must have TAC applied.
62 def TC_02():
63     sln_name = "Launcher_TC_TAC_02.Tizen"
64
65     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
66     if tpk_path == None:
67         return f"FAIL : Get the tpk path for {sln_name}"
68
69     if "OK" not in app_install(f"{tpk_path}"):
70         return f"FAIL : Install the application for {tpk_path}"
71
72     pkg_id = f"org.tizen.example.Launcher_TC_TAC_00.Tizen"
73
74     root_path = get_root_path(f"{pkg_id}")
75     if root_path == "None":
76         return f"FAIL : Get the root path for {pkg_id}"
77
78     raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
79     if ".tac_symlink" not in raw:
80         return "FAIL : The .tac_symlink folder should exist"
81
82     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
83     lines1 = [l for l in raw.splitlines()]
84     raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.8.0.1364/ -name *.dll -not -name *.ni.dll")
85     lines2 = [l for l in raw.splitlines()]
86     raw = cmd(f"shell find {DOTNET_DIR}Newtonsoft.Json/12.0.1/ -name *.dll -not -name *.ni.dll")
87     lines3 = [l for l in raw.splitlines()]
88     if len(lines1) != len(lines2)+len(lines3):
89         return "FAIL : The number of .dll in the .tac_symlink and .dll in the TAC must match"
90
91     raw = cmd(f"shell ls -alZ {root_path}/bin/.tac_symlink/*.dll")
92     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
93     for dll in lines:
94         origin_path = dll.split("->")[1].strip()
95         raw = cmd(f"shell ls -alZ {origin_path}")
96         if "No such file or directory" in raw:
97             return "FAIL : The original file of the symbolic link must exist"
98
99     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
100     if 0 == pid:
101         return f"FAIL : Get the pid for {pkg_id}"
102
103     raw = cmd(f"shell cat /proc/{pid}/smaps | grep Xamarin.Forms.*.dll")
104     if (f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1364/Xamarin.Forms.Platform.Tizen.dll" not in raw) and \
105        (f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1364/Xamarin.Forms.Core.dll" not in raw) and \
106        (f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1364/Xamarin.Forms.Platform.dll" not in raw):
107         return "FAIL : The Xamarin.Forms in the TAC should be loaded when running the application"
108
109     raw = cmd(f"shell cat /proc/{pid}/smaps | grep Newtonsoft.Json.dll")
110     if f"{DOTNET_DIR}Newtonsoft.Json/12.0.1/Newtonsoft.Json.dll" not in raw:
111         return "FAIL : The Newtonsoft.Json in the TAC should be loaded when running the application"
112
113     cmd(f"shell app_launcher -t {pkg_id}")
114
115     return "PASS"
116
117 # The `Launcher_TC_TAC_03` application is normally TAC applied when updating.
118 def TC_03():
119     sln_name = "Launcher_TC_TAC_03.Tizen"
120
121     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
122     if tpk_path == None:
123         return f"FAIL : Get the tpk path for {sln_name}"
124
125     if "OK" not in app_install(f"{tpk_path}"):
126         return f"FAIL : Install the application for {tpk_path}"
127
128     pkg_id = f"org.tizen.example.Launcher_TC_TAC_00.Tizen"
129
130     root_path = get_root_path(f"{pkg_id}")
131     if root_path == "None":
132         return f"FAIL : Get the root path for {pkg_id}"
133
134     raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
135     if ".tac_symlink" not in raw:
136         return "FAIL : The .tac_symlink folder should exist"
137
138     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
139     lines1 = [l for l in raw.splitlines()]
140     raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.8.0.1687/ -name *.dll -not -name *.ni.dll")
141     lines2 = [l for l in raw.splitlines()]
142     raw = cmd(f"shell find {DOTNET_DIR}sqlite-net-base/1.7.335/ -name *.dll -not -name *.ni.dll")
143     lines3 = [l for l in raw.splitlines()]
144     raw = cmd(f"shell find {DOTNET_DIR}SQLitePCLRaw.core/2.0.3/ -name *.dll -not -name *.ni.dll")
145     lines4 = [l for l in raw.splitlines()]
146     if len(lines1) != len(lines2)+len(lines3)+len(lines4):
147         return "FAIL : The number of .dll in the .tac_symlink and .dll in the TAC must match"
148
149     raw = cmd(f"shell ls -alZ {root_path}/bin/.tac_symlink/*.dll")
150     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
151     for dll in lines:
152         origin_path = dll.split("->")[1].strip()
153         raw = cmd(f"shell ls -alZ {origin_path}")
154         if "No such file or directory" in raw:
155             return "FAIL : The original file of the symbolic link must exist"
156
157     raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.8.0.1364/ -name *.dll")
158     if "No such file or directory" not in raw:
159         return f"FAIL : The Xamarin.Forms/4.8.0.1364 nuget should not exist in {DOTNET_DIR}"
160     
161     raw = cmd(f"shell find {DOTNET_DIR}Newtonsoft.Json/12.0.1/ -name *.dll")
162     if "No such file or directory" not in raw:
163         return f"FAIL : The Newtonsoft.Json/12.0.1 nuget should not exist in {DOTNET_DIR}"
164
165     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
166     if 0 == pid:
167         return f"FAIL : Get the pid for {pkg_id}"
168
169     raw = cmd(f"shell cat /proc/{pid}/smaps | grep Xamarin.Forms.*.dll")
170     if (f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1687/Xamarin.Forms.Platform.Tizen.dll" not in raw) and \
171        (f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1687/Xamarin.Forms.Core.dll" not in raw) and \
172        (f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1687/Xamarin.Forms.Platform.dll" not in raw):
173         return "FAIL : The Xamarin.Forms in the TAC should be loaded when running the application"
174
175     raw = cmd(f"shell cat /proc/{pid}/smaps | grep SQLite-net.dll")
176     if f"{DOTNET_DIR}sqlite-net-base/1.7.335/SQLite-net.dll" not in raw:
177         return "FAIL : The sqlite-net-base in the TAC should be loaded when running the application"
178
179     raw = cmd(f"shell cat /proc/{pid}/smaps | grep SQLitePCLRaw.core.dll")
180     if f"{DOTNET_DIR}SQLitePCLRaw.core/2.0.3/SQLitePCLRaw.core.dll" not in raw:
181         return "FAIL : The SQLitePCLRaw.core in the TAC should be loaded when running the application"
182
183     cmd(f"shell app_launcher -t {pkg_id}")
184
185     return "PASS"
186
187 # The `Launcher_TC_TAC_04` application should not apply TAC when updating.
188 def TC_04():
189     sln_name = "Launcher_TC_TAC_04.Tizen"
190
191     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
192     if tpk_path == None:
193         return f"FAIL : Get the tpk path for {sln_name}"
194
195     if "OK" not in app_install(f"{tpk_path}"):
196         return f"FAIL : Install the application for {tpk_path}"
197
198     pkg_id = f"org.tizen.example.Launcher_TC_TAC_00.Tizen"
199
200     root_path = get_root_path(f"{pkg_id}")
201     if root_path == "None":
202         return f"FAIL : Get the root path for {pkg_id}"
203
204     raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
205     if ".tac_symlink" in raw:
206         return "FAIL : The .tac_symlink folder should not exist"
207
208     raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.8.0.1364/ -name *.dll")
209     if "No such file or directory" not in raw:
210         return f"FAIL : The Xamarin.Forms/4.8.0.1364 nuget should not exist in {DOTNET_DIR}"
211     
212     raw = cmd(f"shell find {DOTNET_DIR}Newtonsoft.Json/12.0.1/ -name *.dll")
213     if "No such file or directory" not in raw:
214         return f"FAIL : The Newtonsoft.Json/12.0.1 nuget should not exist in {DOTNET_DIR}"
215
216     raw = cmd(f"shell find {DOTNET_DIR}sqlite-net-base/1.7.335/ -name *.dll")
217     if "No such file or directory" not in raw:
218         return f"FAIL : The sqlite-net-base/1.7.335 nuget should not exist in {DOTNET_DIR}"
219     
220     raw = cmd(f"shell find {DOTNET_DIR}SQLitePCLRaw.core/2.0.3/ -name *.dll")
221     if "No such file or directory" not in raw:
222         return f"FAIL : The SQLitePCLRaw.core/2.0.3 nuget should not exist in {DOTNET_DIR}"
223
224     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
225     if 0 == pid:
226         return f"FAIL : Get the pid for {pkg_id}"
227
228     raw = cmd(f"shell cat /proc/{pid}/smaps | grep Xamarin.Forms.*.dll")
229     if (f"{root_path}/bin/Xamarin.Forms.Platform.Tizen.dll" not in raw) and \
230        (f"{root_path}/bin/Xamarin.Forms.Core.dll" not in raw) and \
231        (f"{root_path}/bin/Xamarin.Forms.Platform.dll" not in raw):
232         return "FAIL : The Xamarin.Forms in the application should be loaded when running the application"
233
234     cmd(f"shell app_launcher -t {pkg_id}")
235
236     return "PASS"
237
238 # The `Launcher_TC_TAC_05`, `Launcher_TC_TAC_06` applications using the same nuget are normally TAC applied.
239 def TC_05():
240     sln_name = "Launcher_TC_TAC_05.Tizen"
241
242     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
243     if tpk_path == None:
244         return f"FAIL : Get the tpk path for {sln_name}"
245
246     if "OK" not in app_install(f"{tpk_path}"):
247         return f"FAIL : Install the application for {tpk_path}"
248
249     pkg_id1 = f"org.tizen.example.Launcher_TC_TAC_05.Tizen"
250
251     root_path = get_root_path(f"{pkg_id1}")
252     if root_path == "None":
253         return f"FAIL : Get the root path for {pkg_id1}"
254
255     raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
256     if ".tac_symlink" not in raw:
257         return "FAIL : The .tac_symlink folder should exist"
258
259     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
260     lines1 = [l for l in raw.splitlines()]
261     raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/5.0.0.1558-pre3/ -name *.dll -not -name *.ni.dll")
262     lines2 = [l for l in raw.splitlines()]
263     if len(lines1) != len(lines2):
264         return "FAIL : The number of .dll in the .tac_symlink and .dll in the TAC must match"
265
266     raw = cmd(f"shell ls -alZ {root_path}/bin/.tac_symlink/*.dll")
267     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
268     for dll in lines:
269         origin_path = dll.split("->")[1].strip()
270         raw = cmd(f"shell ls -alZ {origin_path}")
271         if "No such file or directory" in raw:
272             return "FAIL : The original file of the symbolic link must exist"
273
274     sln_name = "Launcher_TC_TAC_06.Tizen"
275
276     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
277     if tpk_path == None:
278         return f"FAIL : Get the tpk path for {sln_name}"
279
280     if "OK" not in app_install(f"{tpk_path}"):
281         return f"FAIL : Install the application for {tpk_path}"
282
283     pkg_id2 = f"org.tizen.example.Launcher_TC_TAC_06.Tizen"
284
285     root_path = get_root_path(f"{pkg_id2}")
286     if root_path == "None":
287         return f"FAIL : Get the root path for {pkg_id2}"
288
289     raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
290     if ".tac_symlink" not in raw:
291         return "FAIL : The .tac_symlink folder should exist"
292
293     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
294     lines1 = [l for l in raw.splitlines()]
295     raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/5.0.0.1558-pre3/ -name *.dll -not -name *.ni.dll")
296     lines2 = [l for l in raw.splitlines()]
297     if len(lines1) != len(lines2):
298         return "FAIL : The number of .dll in the .tac_symlink and .dll in the TAC must match"
299
300     raw = cmd(f"shell ls -alZ {root_path}/bin/.tac_symlink/*.dll")
301     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
302     for dll in lines:
303         origin_path = dll.split("->")[1].strip()
304         raw = cmd(f"shell ls -alZ {origin_path}")
305         if "No such file or directory" in raw:
306             return "FAIL : The original file of the symbolic link must exist"
307
308     raw = cmd(f"uninstall {pkg_id1}")
309     if "key[end] val[ok]" not in raw:
310         return f"FAIL : Uninstall the application for {pkg_id1}"
311
312     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
313     lines1 = [l for l in raw.splitlines()]
314     raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/5.0.0.1558-pre3/ -name *.dll -not -name *.ni.dll")
315     lines2 = [l for l in raw.splitlines()]
316     if len(lines1) != len(lines2):
317         return "FAIL : The number of .dll in the .tac_symlink and .dll in the TAC must match"
318
319     raw = cmd(f"shell ls -alZ {root_path}/bin/.tac_symlink/*.dll")
320     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
321     for dll in lines:
322         origin_path = dll.split("->")[1].strip()
323         raw = cmd(f"shell ls -alZ {origin_path}")
324         if "No such file or directory" in raw:
325             return "FAIL : The original file of the symbolic link must exist"
326
327     pid = launch_and_get_pid(f"-e", f"{pkg_id2}")
328     if 0 == pid:
329         return f"FAIL : Get the pid for {pkg_id2}"
330
331     raw = cmd(f"shell cat /proc/{pid}/smaps | grep Xamarin.Forms.*.dll")
332     if (f"{DOTNET_DIR}Xamarin.Forms/5.0.0.1558-pre3/Xamarin.Forms.Platform.Tizen.dll" not in raw) and \
333        (f"{DOTNET_DIR}Xamarin.Forms/5.0.0.1558-pre3/Xamarin.Forms.Core.dll" not in raw) and \
334        (f"{DOTNET_DIR}Xamarin.Forms/5.0.0.1558-pre3/Xamarin.Forms.Platform.dll" not in raw):
335         return "FAIL : The Xamarin.Forms in the TAC should be loaded when running the application"
336
337     cmd(f"shell app_launcher -t {pkg_id2}")
338
339     return "PASS"
340
341 # The `Launcher_TC_TAC_07` application is normally TAC applied when uninstall.
342 def TC_06():
343     sln_name = "Launcher_TC_TAC_07.Tizen"
344
345     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
346     if tpk_path == None:
347         return f"FAIL : Get the tpk path for {sln_name}"
348
349     if "OK" not in app_install(f"{tpk_path}"):
350         return f"FAIL : Install the application for {tpk_path}"
351
352     pkg_id = f"org.tizen.example.Launcher_TC_TAC_07.Tizen"
353
354     root_path = get_root_path(f"{pkg_id}")
355     if root_path == "None":
356         return f"FAIL : Get the root path for {pkg_id}"
357
358     raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
359     if ".tac_symlink" not in raw:
360         return "FAIL : The .tac_symlink folder should exist"
361
362     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
363     lines1 = [l for l in raw.splitlines()]
364     raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.4.0.991864/ -name *.dll -not -name *.ni.dll")
365     lines2 = [l for l in raw.splitlines()]
366     if len(lines1) != len(lines2):
367         return "FAIL : The number of .dll in the .tac_symlink and .dll in the TAC must match"
368
369     raw = cmd(f"shell ls -alZ {root_path}/bin/.tac_symlink/*.dll")
370     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
371     for dll in lines:
372         origin_path = dll.split("->")[1].strip()
373         raw = cmd(f"shell ls -alZ {origin_path}")
374         if "No such file or directory" in raw:
375             return "FAIL : The original file of the symbolic link must exist"
376
377     raw = cmd(f"uninstall {pkg_id}")
378     if "key[end] val[ok]" not in raw:
379         return f"FAIL : Uninstall the application for {pkg_id}"
380
381     raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.4.0.991864/ -name *.dll")
382     if "No such file or directory" not in raw:
383         return f"FAIL : The Xamarin.Forms/4.4.0.991864 nuget should not exist in {DOTNET_DIR}"
384
385     return "PASS"
386
387 # The `Launcher_TC_TAC_08` application should be applied to TAC, but The `Launcher_TC_TAC_09` application should not be applied to TAC.
388 def TC_07():
389     raw = cmd(f"shell find {FRAMEWORK_DIR}/XSF.*")
390     if "XSF.dll" in raw:
391         cmd(f"shell mv {FRAMEWORK_DIR}/XSF.dll {FRAMEWORK_DIR}/XSF.dll2")
392     elif "XSF.ni.dll" in raw:
393         cmd(f"shell mv {FRAMEWORK_DIR}/XSF.ni.dll {FRAMEWORK_DIR}/XSF.ni.dll2")
394
395     sln_name = "Launcher_TC_TAC_08.Tizen"
396
397     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
398     if tpk_path == None:
399         return f"FAIL : Get the tpk path for {sln_name}"
400
401     if "OK" not in app_install(f"{tpk_path}"):
402         return f"FAIL : Install the application for {tpk_path}"
403
404     pkg_id = f"org.tizen.example.Launcher_TC_TAC_08.Tizen"
405
406     root_path = get_root_path(f"{pkg_id}")
407     if root_path == "None":
408         return f"FAIL : Get the root path for {pkg_id}"
409
410     raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
411     if ".tac_symlink" not in raw:
412         return "FAIL : The .tac_symlink folder should exist"
413
414     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
415     lines1 = [l for l in raw.splitlines()]
416     raw = cmd(f"shell find {DOTNET_DIR}XSF/1.0.0.0/ -name *.dll -not -name *.ni.dll")
417     lines2 = [l for l in raw.splitlines()]
418     if len(lines1) != len(lines2):
419         return "FAIL : The number of .dll in the .tac_symlink and .dll in the TAC must match"
420
421     raw = cmd(f"shell ls -alZ {root_path}/bin/.tac_symlink/*.dll")
422     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
423     for dll in lines:
424         origin_path = dll.split("->")[1].strip()
425         raw = cmd(f"shell ls -alZ {origin_path}")
426         if "No such file or directory" in raw:
427             return "FAIL : The original file of the symbolic link must exist"
428
429     sln_name = "Launcher_TC_TAC_09.Tizen"
430
431     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
432     if tpk_path == None:
433         return f"FAIL : Get the tpk path for {sln_name}"
434
435     if "OK" not in app_install(f"{tpk_path}"):
436         return f"FAIL : Install the application for {tpk_path}"
437
438     pkg_id = f"org.tizen.example.Launcher_TC_TAC_09.Tizen"
439
440     root_path = get_root_path(f"{pkg_id}")
441     if root_path == "None":
442         return f"FAIL : Get the root path for {pkg_id}"
443
444     raw = cmd(f"shell find {root_path}/bin/.tac_symlink -name XSF.dll -not -name XSF.ni.dll")
445     lines = [l for l in raw.splitlines()]
446     if len(lines) != 0:
447         return "FAIL : The version is the same Nuget, but the SHA value is different"
448
449     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
450     if 0 == pid:
451         return f"FAIL : Get the pid for {pkg_id}"
452
453     raw = cmd(f"shell cat /proc/{pid}/smaps | grep XSF.dll")
454     if f"{root_path}/bin/XSF.dll" not in raw:
455         return "FAIL : The XSF in the application should be loaded when running the application"
456
457     cmd(f"shell app_launcher -t {pkg_id}")
458
459     return "PASS"
460
461 # The Launcher_TC_TAC_10 application should match the information of nuget with the value of TAC DB.
462 def TC_08():
463     sln_name = "Launcher_TC_TAC_10.Tizen"
464
465     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
466     if tpk_path == None:
467         return f"FAIL : Get the tpk path for {sln_name}"
468
469     if "OK" not in app_install(f"{tpk_path}"):
470         return f"FAIL : Install the application for {tpk_path}"
471
472     pkg_id = f"org.tizen.example.Launcher_TC_TAC_10.Tizen"
473
474     root_path = get_root_path(f"{pkg_id}")
475     if root_path == "None":
476         return f"FAIL : Get the root path for {pkg_id}"
477
478     raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
479     if ".tac_symlink" not in raw:
480         return "FAIL : The .tac_symlink folder should exist"
481
482     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
483     lines = [l for l in raw.splitlines() if f"{pkg_id}" in l]
484     for rcd in lines:
485         if ("Xamarin.Forms/4.8.0.1560" not in rcd) and \
486            ("Google.Apis.Core/1.49.0" not in rcd) and \
487            ("Google.Apis/1.49.0" not in rcd) and \
488            ("Newtonsoft.Json/12.0.3" not in rcd):
489             return "FAIL : TAC database must have a valid value"
490
491     return "PASS"
492
493 # The Launcher_TC_TAC_11 application must match the version of the nuget in .deps.json and the version of the nuget in TAC DB.
494 def TC_09():
495     sln_name = "Launcher_TC_TAC_11.Tizen"
496
497     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
498     if tpk_path == None:
499         return f"FAIL : Get the tpk path for {sln_name}"
500
501     if "OK" not in app_install(f"{tpk_path}"):
502         return f"FAIL : Install the application for {tpk_path}"
503
504     pkg_id = f"org.tizen.example.Launcher_TC_TAC_11.Tizen"
505
506     root_path = get_root_path(f"{pkg_id}")
507     if root_path == "None":
508         return f"FAIL : Get the root path for {pkg_id}"
509
510     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
511     lines = [l for l in raw.splitlines() if f"{pkg_id}" in l]
512     for nuget in lines:
513         name = nuget.split("|")[3]
514         version = nuget.split("|")[4]
515         raw = cmd(f"shell cat {root_path}/{sln_name}.deps.json | grep {name}/")
516         if f"{version}" not in f"{raw}":
517             return "FAIL : "
518
519     return "PASS"
520
521 # Run the test
522 def run():
523     cmd(f"root on")
524     cmd(f"shell mount -o remount,rw /")
525
526     global tpk_list
527     tpk_list = search_tpk(f"{module_name}")
528
529     p = run_tc_array(module_name, tc_array)
530     f = len(tc_array) - p
531     r = round(((p / len(tc_array)) * 100), 2)
532     print(f"--- {module_name} TCT Result ---\nFAIL : [{f}] / PASS : [{p}] - [{r}%]\n")
533
534 # Uninstall the application and restore to original state
535 def clean():
536     cmd(f"uninstall org.tizen.example.Launcher_TC_TAC_01.Tizen")
537     cmd(f"uninstall org.tizen.example.Launcher_TC_TAC_00.Tizen")
538     cmd(f"uninstall org.tizen.example.Launcher_TC_TAC_06.Tizen")
539     cmd(f"uninstall org.tizen.example.Launcher_TC_TAC_07.Tizen")
540     cmd(f"uninstall org.tizen.example.Launcher_TC_TAC_08.Tizen")
541     cmd(f"uninstall org.tizen.example.Launcher_TC_TAC_09.Tizen")
542     cmd(f"uninstall org.tizen.example.Launcher_TC_TAC_10.Tizen")
543     cmd(f"uninstall org.tizen.example.Launcher_TC_TAC_11.Tizen")
544
545     cmd(f"shell mv {FRAMEWORK_DIR}/XSF.dll2 {FRAMEWORK_DIR}/XSF.dll")
546     cmd(f"shell mv {FRAMEWORK_DIR}/XSF.ni.dll2 {FRAMEWORK_DIR}/XSF.ni.dll")
547
548 # Main entry point
549 def main():
550     parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter)
551     parser.add_argument("TC_NUMBER", type=str, nargs="*", help="Individual excution")
552     args = parser.parse_args()
553
554     global tc_array
555     if args.TC_NUMBER and "TC_" in args.TC_NUMBER[0]:
556         tc_array = []
557         for tc_num in args.TC_NUMBER:
558             if tc_num not in funcMap:
559                 print(f"There is no {tc_num} test.")
560                 exit(1)
561             else:
562                 tc_array.append(funcMap[tc_num])
563     else:
564         tc_array = [TC_01, TC_02, TC_03, TC_04, TC_05, TC_06, TC_07, TC_08, TC_09]
565
566     global serial
567     if len(sys.argv) >= 2 and "TC_" not in sys.argv[1]:
568         serial = read_serial(sys.argv[1])
569     else:
570         serial = read_serial(None)
571
572     if serial is None:
573         print("No connected device(s).")
574         exit(1)
575
576     device = get_device_type()
577     print(f"=== Dotnet-Launcher [{device}] Test Case - ({module_name}) ===")
578
579     run()
580     clean()
581
582
583 funcMap = {
584 'TC_01': TC_01, 'TC_02': TC_02, 'TC_03': TC_03, 'TC_04': TC_04, 'TC_05': TC_05, 'TC_06': TC_06, 'TC_07': TC_07, 'TC_08': TC_08, 'TC_09': TC_09,
585 'TAC_TC_01': TC_01, 'TAC_TC_02': TC_02, 'TAC_TC_03': TC_03, 'TAC_TC_04': TC_04, 'TAC_TC_05': TC_05,
586 'TAC_TC_06': TC_06, 'TAC_TC_07': TC_07, 'TAC_TC_08': TC_08, 'TAC_TC_09': TC_09
587 }
588
589
590 if __name__ == "__main__":
591     try:
592         main()
593     except KeyboardInterrupt:
594         print("\nExit (Pressed Ctrl+C)")
595         exit(1)