security-manager: more fixes
authorZofia Abramowska <z.abramowska@samsung.com>
Wed, 21 May 2025 15:51:41 +0000 (17:51 +0200)
committerZofia Abramowska <z.abramowska@samsung.com>
Thu, 22 May 2025 09:21:16 +0000 (11:21 +0200)
Change-Id: I50a5faad26ea89d5792d6b7bf7b82416e50cb7cd

src/security-manager-tests/run-security-manager-no-smack-tests.sh
src/security-manager-tests/test_cases.cpp

index 750e17385741d460e05d11bc5c15804bbb1c000e..3fa9dca947bba5153be181ca9d2f9532daa34cfc 100755 (executable)
@@ -244,6 +244,7 @@ required=(
        security_manager_53c_get_id_by_cynara_client_only_pkgid
        security_manager_53d_get_id_by_cynara_client_only_appid
        security_manager_53e_get_id_by_cynara_client_nulls
+       security_manager_25b_global_user_set_install_type_local
 )
 
 function run_tests_and_exit {
index b36ceb3d2086c6bd36961d98db9dbd90695cb816..71c519e811aedeace1859f69486ffef447da3b15 100644 (file)
@@ -1014,7 +1014,14 @@ RUNNER_TEST(security_manager_25b_global_user_set_install_type_local)
     requestInst.setPkgId(app.getPkgId());
     requestInst.setInstallType(SM_APP_INSTALL_LOCAL);
 
-    Api::install(requestInst, (lib_retcode)SECURITY_MANAGER_ERROR_SERVER_ERROR);
+    // TODO: If local install for global user is not allowed, there should be
+    // a specific check for that in security-manager with a proper error code.
+    // Tests should not rely on a random error code based on the order of operations.
+    if (smack_check()) {
+        Api::install(requestInst, (lib_retcode)SECURITY_MANAGER_ERROR_SERVER_ERROR);
+    } else {
+        Api::install(requestInst, (lib_retcode)SECURITY_MANAGER_ERROR_UNKNOWN);
+    }
 }
 
 RUNNER_CHILD_TEST(security_manager_25c_global_user_set_install_type_preloaded)