[TC Fixed] Change the 'find' command
authorj-h.choi <j-h.choi@samsung.com>
Tue, 29 Dec 2020 05:47:20 +0000 (14:47 +0900)
committer조웅석/Common Platform Lab(SR)/Principal Engineer/삼성전자 <ws77.cho@samsung.com>
Mon, 4 Jan 2021 06:22:05 +0000 (15:22 +0900)
Change-Id: I2e5dee3f79ef4ba012ed741057f004b4319c8a57

tests/TCs/1_AOT/AOT.py
tests/TCs/2_PLUGIN/PLUGIN.py
tests/TCs/4_TAC/TAC.py
tests/TCs/5_TLC/TLC.py
tests/TCs/6_TOOL/TOOL.py
tests/TCs/Utils.py

index 409c342..8be7e01 100755 (executable)
@@ -29,8 +29,7 @@ def TC_01():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .native_image")
-    if ".native_image" in raw:
+    if exist(f"{root_path}/bin/.native_image"):
         return "FAIL : The .native_image folder should not exist"
 
     raw = cmd(f"shell find {root_path}/bin/ -name *.ni.dll")
@@ -60,8 +59,7 @@ def TC_02():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .native_image")
-    if ".native_image" not in raw:
+    if not exist(f"{root_path}/bin/.native_image"):
         return "FAIL : The .native_image folder should exist"
 
     raw = cmd(f"shell find {root_path}/bin/.native_image/ -name *.ni.dll")
@@ -102,8 +100,7 @@ def TC_03():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .native_image")
-    if ".native_image" in raw:
+    if exist(f"{root_path}/bin/.native_image"):
         return "FAIL : The .native_image folder should not exist"
 
     raw = cmd(f"shell find {root_path}/bin/ -name *.ni.dll")
index af6f067..e8cced4 100755 (executable)
@@ -48,9 +48,8 @@ def TC_02():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
-    if f"{root_path}/bin/libSkiaSharp.so" not in raw:
-        return "FAIL : The libSkiaSharp.so library should exist"
+    if not exist(f"{root_path}/bin/libSkiaSharp.so"):
+        return "FAIL : The libSkiaSharp.so library should exist in the application"
 
     if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
         return "FAIL : The arch of the target and the arch of the library must match"
@@ -77,8 +76,7 @@ def TC_03():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .native_image")
-    if ".native_image" in raw:
+    if exist(f"{root_path}/bin/.native_image"):
         return "FAIL : The .native_image folder should not exist"
 
     raw = cmd(f"shell find {root_path}/bin/ -name *.ni.dll")
@@ -108,8 +106,7 @@ def TC_04():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .native_image")
-    if ".native_image" not in raw:
+    if not exist(f"{root_path}/bin/.native_image"):
         return "FAIL : The .native_image folder should exist"
 
     raw = cmd(f"shell find {root_path}/bin/.native_image/ -name *.ni.dll")
@@ -147,8 +144,7 @@ def TC_05():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" in raw:
+    if exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should not exist"
 
     return "PASS"
@@ -170,8 +166,7 @@ def TC_06():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" not in raw:
+    if not exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should exist"
 
     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
@@ -185,8 +180,7 @@ def TC_06():
     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
     for dll in lines:
         origin_path = dll.split("->")[1].strip()
-        raw = cmd(f"shell ls -alZ {origin_path}")
-        if "No such file or directory" in raw:
+        if not exist(f"{origin_path}"):
             return "FAIL : The original file of the symbolic link must exist"
 
     return "PASS"
@@ -208,9 +202,10 @@ def TC_07():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
+    if not exist(f"{root_path}/bin/libSkiaSharp.so"):
+        return "FAIL : The libSkiaSharp.so library should exist only in the application"
+
     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
-    if f"{root_path}/bin/libSkiaSharp.so" not in raw:
-        return "FAIL : The libSkiaSharp.so library should exist only"
     if "->" in raw:
         return "FAIL : The libSkiaSharp.so library should not be a symbolic link"
 
@@ -236,6 +231,9 @@ def TC_08():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
+    if not exist(f"{root_path}/bin/libSkiaSharp.so"):
+        return "FAIL : The libSkiaSharp.so library should exist in the application"
+
     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
index 781776f..4966987 100755 (executable)
@@ -25,8 +25,7 @@ def TC_01():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" not in raw:
+    if not exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should exist"
 
     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
@@ -40,8 +39,7 @@ def TC_01():
     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
     for dll in lines:
         origin_path = dll.split("->")[1].strip()
-        raw = cmd(f"shell ls -alZ {origin_path}")
-        if "No such file or directory" in raw:
+        if not exist(f"{origin_path}"):
             return "FAIL : The original file of the symbolic link must exist"
 
     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
@@ -75,8 +73,7 @@ def TC_02():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" not in raw:
+    if not exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should exist"
 
     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
@@ -92,8 +89,7 @@ def TC_02():
     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
     for dll in lines:
         origin_path = dll.split("->")[1].strip()
-        raw = cmd(f"shell ls -alZ {origin_path}")
-        if "No such file or directory" in raw:
+        if not exist(f"{origin_path}"):
             return "FAIL : The original file of the symbolic link must exist"
 
     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
@@ -131,8 +127,7 @@ def TC_03():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" not in raw:
+    if not exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should exist"
 
     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
@@ -150,16 +145,13 @@ def TC_03():
     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
     for dll in lines:
         origin_path = dll.split("->")[1].strip()
-        raw = cmd(f"shell ls -alZ {origin_path}")
-        if "No such file or directory" in raw:
+        if not exist(f"{origin_path}"):
             return "FAIL : The original file of the symbolic link must exist"
 
-    raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.8.0.1364/ -name *.dll")
-    if "No such file or directory" not in raw:
+    if exist(f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1364/ -name *.dll"):
         return f"FAIL : The Xamarin.Forms/4.8.0.1364 nuget should not exist in {DOTNET_DIR}"
-    
-    raw = cmd(f"shell find {DOTNET_DIR}Newtonsoft.Json/12.0.1/ -name *.dll")
-    if "No such file or directory" not in raw:
+
+    if exist(f"{DOTNET_DIR}Newtonsoft.Json/12.0.1/ -name *.dll"):
         return f"FAIL : The Newtonsoft.Json/12.0.1 nuget should not exist in {DOTNET_DIR}"
 
     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
@@ -201,24 +193,19 @@ def TC_04():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" in raw:
+    if exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should not exist"
 
-    raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.8.0.1364/ -name *.dll")
-    if "No such file or directory" not in raw:
+    if exist(f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1364/ -name *.dll"):
         return f"FAIL : The Xamarin.Forms/4.8.0.1364 nuget should not exist in {DOTNET_DIR}"
-    
-    raw = cmd(f"shell find {DOTNET_DIR}Newtonsoft.Json/12.0.1/ -name *.dll")
-    if "No such file or directory" not in raw:
+
+    if exist(f"{DOTNET_DIR}Newtonsoft.Json/12.0.1/ -name *.dll"):
         return f"FAIL : The Newtonsoft.Json/12.0.1 nuget should not exist in {DOTNET_DIR}"
 
-    raw = cmd(f"shell find {DOTNET_DIR}sqlite-net-base/1.7.335/ -name *.dll")
-    if "No such file or directory" not in raw:
+    if exist(f"{DOTNET_DIR}sqlite-net-base/1.7.335/ -name *.dll"):
         return f"FAIL : The sqlite-net-base/1.7.335 nuget should not exist in {DOTNET_DIR}"
-    
-    raw = cmd(f"shell find {DOTNET_DIR}SQLitePCLRaw.core/2.0.3/ -name *.dll")
-    if "No such file or directory" not in raw:
+
+    if exist(f"{DOTNET_DIR}SQLitePCLRaw.core/2.0.3/ -name *.dll"):
         return f"FAIL : The SQLitePCLRaw.core/2.0.3 nuget should not exist in {DOTNET_DIR}"
 
     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
@@ -252,8 +239,7 @@ def TC_05():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id1}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" not in raw:
+    if not exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should exist"
 
     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
@@ -267,8 +253,7 @@ def TC_05():
     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
     for dll in lines:
         origin_path = dll.split("->")[1].strip()
-        raw = cmd(f"shell ls -alZ {origin_path}")
-        if "No such file or directory" in raw:
+        if not exist(f"{origin_path}"):
             return "FAIL : The original file of the symbolic link must exist"
 
     sln_name = "Launcher_TC_TAC_06.Tizen"
@@ -286,8 +271,7 @@ def TC_05():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id2}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" not in raw:
+    if not exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should exist"
 
     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
@@ -301,8 +285,7 @@ def TC_05():
     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
     for dll in lines:
         origin_path = dll.split("->")[1].strip()
-        raw = cmd(f"shell ls -alZ {origin_path}")
-        if "No such file or directory" in raw:
+        if not exist(f"{origin_path}"):
             return "FAIL : The original file of the symbolic link must exist"
 
     raw = cmd(f"uninstall {pkg_id1}")
@@ -320,8 +303,7 @@ def TC_05():
     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
     for dll in lines:
         origin_path = dll.split("->")[1].strip()
-        raw = cmd(f"shell ls -alZ {origin_path}")
-        if "No such file or directory" in raw:
+        if not exist(f"{origin_path}"):
             return "FAIL : The original file of the symbolic link must exist"
 
     pid = launch_and_get_pid(f"-e", f"{pkg_id2}")
@@ -355,8 +337,7 @@ def TC_06():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" not in raw:
+    if not exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should exist"
 
     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
@@ -370,16 +351,14 @@ def TC_06():
     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
     for dll in lines:
         origin_path = dll.split("->")[1].strip()
-        raw = cmd(f"shell ls -alZ {origin_path}")
-        if "No such file or directory" in raw:
+        if not exist(f"{origin_path}"):
             return "FAIL : The original file of the symbolic link must exist"
 
     raw = cmd(f"uninstall {pkg_id}")
     if "key[end] val[ok]" not in raw:
         return f"FAIL : Uninstall the application for {pkg_id}"
 
-    raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.4.0.991864/ -name *.dll")
-    if "No such file or directory" not in raw:
+    if exist(f"{DOTNET_DIR}Xamarin.Forms/4.4.0.991864/ -name *.dll"):
         return f"FAIL : The Xamarin.Forms/4.4.0.991864 nuget should not exist in {DOTNET_DIR}"
 
     return "PASS"
@@ -407,8 +386,7 @@ def TC_07():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" not in raw:
+    if not exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should exist"
 
     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
@@ -422,8 +400,7 @@ def TC_07():
     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
     for dll in lines:
         origin_path = dll.split("->")[1].strip()
-        raw = cmd(f"shell ls -alZ {origin_path}")
-        if "No such file or directory" in raw:
+        if not exist(f"{origin_path}"):
             return "FAIL : The original file of the symbolic link must exist"
 
     sln_name = "Launcher_TC_TAC_09.Tizen"
@@ -475,8 +452,7 @@ def TC_08():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" not in raw:
+    if not exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should exist"
 
     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
index 5736742..2da7cf6 100755 (executable)
@@ -26,6 +26,9 @@ def TC_01():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
+    if not exist(f"{root_path}/bin/libSkiaSharp.so"):
+        return "FAIL : The libSkiaSharp.so library should exist in the application"
+
     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
@@ -69,6 +72,9 @@ def TC_02():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
+    if not exist(f"{root_path}/bin/libSkiaSharp.so"):
+        return "FAIL : The libSkiaSharp.so library should exist in the application"
+
     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
@@ -103,6 +109,9 @@ def TC_03():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
+    if not exist(f"{root_path}/bin/libSkiaSharp.so"):
+        return "FAIL : The libSkiaSharp.so library should exist in the application"
+
     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
@@ -127,8 +136,7 @@ def TC_03():
     if sha in raw:
         return f"FAIL : The libSkiaSharp.so library should not exist in {DOTNET_DIR}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name libSkiaSharp.so")
-    if f"{root_path}/bin/libSkiaSharp.so" in raw:
+    if exist(f"{root_path}/bin/libSkiaSharp.so"):
         return "FAIL : The libSkiaSharp.so library should not exist in the application"
 
     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
@@ -172,6 +180,9 @@ def TC_04():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
+    if not exist(f"{root_path}/bin/libSkiaSharp.so"):
+        return "FAIL : The libSkiaSharp.so library should exist in the application"
+
     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
@@ -206,6 +217,9 @@ def TC_05():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
+    if not exist(f"{root_path}/bin/libSkiaSharp.so"):
+        return "FAIL : The libSkiaSharp.so library should exist in the application"
+
     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
@@ -230,6 +244,9 @@ def TC_05():
     if sha in raw:
         return f"FAIL : The libSkiaSharp.so library should not exist in {DOTNET_DIR}"
 
+    if not exist(f"{root_path}/bin/libSkiaSharp.so"):
+        return "FAIL : The libSkiaSharp.so library should exist in the application"
+
     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
@@ -276,6 +293,9 @@ def TC_06():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
+    if not exist(f"{root_path}/bin/libSkiaSharp.so"):
+        return "FAIL : The libSkiaSharp.so library should exist in the application"
+
     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
@@ -300,9 +320,10 @@ def TC_06():
     if sha in raw:
         return f"FAIL : The libSkiaSharp.so library should not exist in {DOTNET_DIR}"
 
+    if not exist(f"{root_path}/bin/libSkiaSharp.so"):
+        return "FAIL : The libSkiaSharp.so library should exist only in the application"
+
     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
-    if f"{root_path}/bin/libSkiaSharp.so" not in raw:
-        return "FAIL : The libSkiaSharp.so library should exist only"
     if "->" in raw:
         return "FAIL : The libSkiaSharp.so library should not be a symbolic link"
 
@@ -355,6 +376,9 @@ def TC_07():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id1}"
 
+    if not exist(f"{root_path}/bin/libHarfBuzzSharp.so"):
+        return "FAIL : The libHarfBuzzSharp.so library should exist in the application"
+
     raw = cmd(f"shell ls -alZ {root_path}/bin/libHarfBuzzSharp.so")
     if (f"{root_path}/bin/libHarfBuzzSharp.so" not in raw) or \
        (f"{DOTNET_DIR}Libraries/libHarfBuzzSharp.so.." not in raw):
@@ -381,10 +405,14 @@ def TC_07():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id2}"
 
-    raw = cmd(f"shell ls -alZ {root_path}/bin/libHarfBuzzSharp.so")
-    if f"{root_path}/bin/libHarfBuzzSharp.so" not in raw:
+    if not exist(f"{root_path}/bin/libHarfBuzzSharp.so"):
         return "FAIL : The libHarfBuzzSharp.so library should exist"
 
+    raw = cmd(f"shell ls -alZ {root_path}/bin/libHarfBuzzSharp.so")
+    if (f"{root_path}/bin/libHarfBuzzSharp.so" not in raw) or \
+       (f"{DOTNET_DIR}Libraries/libHarfBuzzSharp.so.." not in raw):
+        return "FAIL : The libHarfBuzzSharp.so library should exist or be a symbolic link"
+
     if "OK" not in check_library_arch(f"{root_path}", "libHarfBuzzSharp.so"):
         return "FAIL : The arch of the target and the arch of the library must match"
 
@@ -430,6 +458,9 @@ def TC_08():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
+    if not exist(f"{root_path}/bin/libSkiaSharp.so"):
+        return "FAIL : The libSkiaSharp.so library should exist"
+
     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
index 8d4e166..83de4ae 100755 (executable)
@@ -11,8 +11,7 @@ module_name = "TOOL"
 
 # The `dotnettool` works normally.
 def TC_01():
-    raw = cmd(f"shell find /usr/bin/ -name dotnettool")
-    if "/usr/bin/dotnettool" not in raw:
+    if not exist("/usr/bin/dotnettool")
         return "FAIL : The dotnettool works normally"
 
     raw = cmd(f"shell dotnettool")
@@ -25,8 +24,7 @@ def TC_01():
 def TC_02():
     cmd(f"shell dotnettool --ni-system")
 
-    raw = cmd(f"shell find {RUNTIME_DIR} -name {SPC_DLL}.Backup")
-    if f"{RUNTIME_DIR}{SPC_DLL}.Backup" not in raw:
+    if not exist(f"{RUNTIME_DIR}{SPC_DLL}.Backup"):
         return "FAIL : Create the platform native image"
 
     raw = cmd(f"shell find {RUNTIME_DIR} -name *.ni.dll")
@@ -58,16 +56,14 @@ def TC_02():
 def TC_03():
     cmd(f"shell dotnettool --ni-reset-system")
 
-    raw = cmd(f"shell find {RUNTIME_DIR} -name {SPC_DLL}.Backup")
-    if f"{RUNTIME_DIR}{SPC_DLL}.Backup" in raw:
+    if exist(f"{RUNTIME_DIR}{SPC_DLL}.Backup"):
         return "FAIL : Remove the platform native image"
 
     return "PASS"
 
 # Create native image for `System.Private.CoreLib.dll`.
 def TC_04():
-    raw = cmd(f"shell find {RUNTIME_DIR} -name {SPC_DLL}.Backup")
-    if f"{RUNTIME_DIR}{SPC_DLL}.Backup" in raw:
+    if exist(f"{RUNTIME_DIR}{SPC_DLL}.Backup"):
         cmd(f"shell rm {RUNTIME_DIR}{SPC_DLL}")
         cmd(f"shell mv {RUNTIME_DIR}{SPC_DLL}.Backup {RUNTIME_DIR}{SPC_DLL}")
 
@@ -76,8 +72,7 @@ def TC_04():
        "System.Private.CoreLib.ni.dll generated successfully." not in raw:
         return f"FAIL : Create native image for {SPC_DLL}"
 
-    raw = cmd(f"shell find {RUNTIME_DIR} -name {SPC_DLL}.Backup")
-    if f"{RUNTIME_DIR}{SPC_DLL}.Backup" not in raw:
+    if not exist(f"{RUNTIME_DIR}{SPC_DLL}.Backup"):
         return f"FAIL : Create native image for {SPC_DLL}"
 
     return "PASS"
@@ -151,8 +146,7 @@ def TC_09():
     cmd(f"shell unzip /tmp/{ibcdata_zip} -d {IBCDATA_DIR}")
     cmd(f"shell chsmack -a _ {IBCDATA_DIR} -r")
 
-    raw = cmd(f"shell find {IBCDATA_DIR}netstandard.ibc")
-    if f"No such file or directory" in raw:
+    if not exist(f"{IBCDATA_DIR}netstandard.ibc"):
         return "FAIL : The netstandard.ibc file should exist"
 
     raw = cmd(f"shell dotnettool --ibc-dir /usr/share/dotnet.tizen/ibcdata/ --ni-dll {RUNTIME_DIR}netstandard.dll")
@@ -179,14 +173,12 @@ def TC_10():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .native_image")
-    if ".native_image" not in raw:
+    if not exist(f"{root_path}/bin/.native_image"):
         return "FAIL : The .native_image folder should exist"
 
     cmd(f"shell dotnettool --ni-reset-pkg {pkg_id}")
 
-    raw = cmd(f"shell ls {root_path}/bin/.native_image")
-    if "No such file or directory" not in raw:
+    if exist(f"{root_path}/bin/.native_image"):
         return "FAIL : The .native_image folder should not exist"
 
     raw = cmd(f"shell find {root_path}/bin/ -name *.ni.dll")
@@ -213,14 +205,12 @@ def TC_11():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell ls {root_path}/bin/.native_image")
-    if "No such file or directory" not in raw:
+    if exist(f"{root_path}/bin/.native_image"):
         return "FAIL : The .native_image folder not should exist"
 
     cmd(f"shell dotnettool --ni-pkg {pkg_id}")
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .native_image")
-    if ".native_image" not in raw:
+    if not exist(f"{root_path}/bin/.native_image"):
         return "FAIL : The .native_image folder should exist"
 
     raw = cmd(f"shell find {root_path}/bin/.native_image/ -name *.ni.dll")
@@ -317,8 +307,7 @@ def TC_14():
     if root_path == "None":
         return f"FAIL : Get the root path for {pkg_id}"
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" not in raw:
+    if not exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should exist"
 
     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
@@ -332,14 +321,12 @@ def TC_14():
     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
     for dll in lines:
         origin_path = dll.split("->")[1].strip()
-        raw = cmd(f"shell ls -alZ {origin_path}")
-        if "No such file or directory" in raw:
+        if not exist(f"{origin_path}"):
             return "FAIL : The original file of the symbolic link must exist"
 
     cmd(f"shell dotnettool --tac-disable-pkg {pkg_id}")
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" in raw:
+    if exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should not exist"
 
     raw = cmd(f"shell find {root_path}/bin/ -maxdepth 1 -name *.dll -not -name *.ni.dll")
@@ -368,8 +355,7 @@ def TC_15():
 
     cmd(f"shell dotnettool --tac-disable-pkg {pkg_id}")
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" in raw:
+    if exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should not exist"
 
     raw = cmd(f"shell find {root_path}/bin/ -maxdepth 1 -name *.dll -not -name *.ni.dll")
@@ -379,8 +365,7 @@ def TC_15():
 
     cmd(f"shell dotnettool --tac-enable-pkg {pkg_id}")
 
-    raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
-    if ".tac_symlink" not in raw:
+    if not exist(f"{root_path}/bin/.tac_symlink"):
         return "FAIL : The .tac_symlink folder should exist"
 
     raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
@@ -394,8 +379,7 @@ def TC_15():
     lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
     for dll in lines:
         origin_path = dll.split("->")[1].strip()
-        raw = cmd(f"shell ls -alZ {origin_path}")
-        if "No such file or directory" in raw:
+        if not exist(f"{origin_path}"):
             return "FAIL : The original file of the symbolic link must exist"
 
     return "PASS"
index 23f6f02..e4b8390 100755 (executable)
@@ -167,6 +167,14 @@ def check_library_arch(rootpath, library):
     subprocess.run((f"rm ./{library}").split(), encoding="utf-8", stdout=subprocess.PIPE).stdout
     return "OK"
 
+# Check if the file or directory exists
+def exist(path):
+    raw = cmd(f"shell find {path}")
+    if "No such file or directory" in raw:
+        return False
+    else:
+        return True
+
 # Run the test array
 def run_tc_array(module_name, tc_array):
     p = 0