Use RUNNER_CHILD_TEST where necessary 24/319624/2
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 13 Feb 2025 16:01:42 +0000 (17:01 +0100)
committerTomasz Swierczek <t.swierczek@samsung.com>
Fri, 14 Feb 2025 12:16:09 +0000 (12:16 +0000)
Tests with fork() and child processes throwing exceptions must be added
as RUNNER_CHILD_TESTs so the exceptions are properly handled.

Change-Id: Ic9b841b38e338f47b52d5fcb036ee6a1d43e3523

src/security-manager-tests/test_cases.cpp
src/security-manager-tests/test_cases_prepare_app.cpp

index 8e83f190395c75ed05b0be8e61983552c4a5d6a7..a6fe8f47eef39d012a28875671754ae70b4d2ed6 100644 (file)
@@ -52,7 +52,7 @@ using namespace PrivilegeNames;
 
 RUNNER_TEST_GROUP_INIT(SECURITY_MANAGER)
 
-RUNNER_TEST(security_manager_01a_app_double_install_double_uninstall)
+RUNNER_CHILD_TEST(security_manager_01a_app_double_install_double_uninstall)
 {
     AppInstallHelperExt app("sm_test_01a_app");
     {
@@ -66,7 +66,7 @@ RUNNER_TEST(security_manager_01a_app_double_install_double_uninstall)
     }
 }
 
-RUNNER_TEST(security_manager_01b_app_double_install_wrong_pkg_id)
+RUNNER_CHILD_TEST(security_manager_01b_app_double_install_wrong_pkg_id)
 {
     AppInstallHelperExt app("sm_test_01b");
     {
@@ -83,7 +83,7 @@ RUNNER_TEST(security_manager_01b_app_double_install_wrong_pkg_id)
     app.checkAfterUninstall();
 }
 
-RUNNER_TEST(security_manager_01c_app_uninstall_wrong_pkg_id)
+RUNNER_CHILD_TEST(security_manager_01c_app_uninstall_wrong_pkg_id)
 {
     AppInstallHelperExt app("sm_test_01c");
     ScopedInstaller appInstall(app);
@@ -366,7 +366,7 @@ RUNNER_CHILD_TEST(security_manager_07a_user_add_app_install)
     app.checkDeniedPrivileges(someDeniedPrivs);
 }
 
-RUNNER_TEST(security_manager_07b_user_add_offline)
+RUNNER_CHILD_TEST(security_manager_07b_user_add_offline)
 {
     ServiceManager("security-manager.service").stopService();
 
@@ -386,7 +386,7 @@ RUNNER_TEST(security_manager_07b_user_add_offline)
     app.checkAfterUninstall();
 }
 
-RUNNER_TEST(security_manager_08_user_double_add_double_remove)
+RUNNER_CHILD_TEST(security_manager_08_user_double_add_double_remove)
 {
     const PrivilegeVector somePrivs = {PRIV_LED, PRIV_NOTIFICATION};
 
@@ -418,7 +418,7 @@ RUNNER_TEST(security_manager_08_user_double_add_double_remove)
     Api::deleteUser(deleteUserRequest, SECURITY_MANAGER_ERROR_SERVER_ERROR);
 }
 
-RUNNER_TEST(security_manager_09_app_install_constraint_check)
+RUNNER_CHILD_TEST(security_manager_09_app_install_constraint_check)
 {
     auto install = [](const AppInstallHelperExt& app, bool success)
     {
@@ -522,7 +522,7 @@ RUNNER_TEST(security_manager_09_app_install_constraint_check)
         app.checkAfterUninstall();
 }
 
-RUNNER_TEST(security_manager_09a_install_many_apps_in_single_request)
+RUNNER_CHILD_TEST(security_manager_09a_install_many_apps_in_single_request)
 {
     constexpr char pkgIdPrefix[] = "sm_test_09a";
     const AppInstallHelperExt apps[] = {{"sm_test_09a_0", pkgIdPrefix},
@@ -547,7 +547,7 @@ RUNNER_TEST(security_manager_09a_install_many_apps_in_single_request)
     }
 }
 
-RUNNER_TEST(security_manager_09b_install_many_apps_in_single_request_duplicated_ids)
+RUNNER_CHILD_TEST(security_manager_09b_install_many_apps_in_single_request_duplicated_ids)
 {
     AppInstallHelperExt app("sm_test_09b");
     {
@@ -558,7 +558,7 @@ RUNNER_TEST(security_manager_09b_install_many_apps_in_single_request_duplicated_
     app.checkAfterUninstall();
 }
 
-RUNNER_TEST(security_manager_09c_update_many_apps_in_single_request_hybrid_package)
+RUNNER_CHILD_TEST(security_manager_09c_update_many_apps_in_single_request_hybrid_package)
 {
     constexpr char pkgIdPrefix[] = "sm_test_09c";
     AppInstallHelperExt apps[] = {{"sm_test_09c_0", pkgIdPrefix},
@@ -604,7 +604,7 @@ RUNNER_TEST(security_manager_09c_update_many_apps_in_single_request_hybrid_packa
     }
 }
 
-RUNNER_TEST(security_manager_09d_uninstall_app_from_hybrid_package)
+RUNNER_CHILD_TEST(security_manager_09d_uninstall_app_from_hybrid_package)
 {
     constexpr char pkgIdPrefix[] = "sm_test_09d";
     AppInstallHelperExt apps[] = {{"sm_test_09d_0", pkgIdPrefix},
@@ -647,7 +647,7 @@ RUNNER_TEST(security_manager_09d_uninstall_app_from_hybrid_package)
     }
 }
 
-RUNNER_TEST(security_manager_09e_update_app_nonhybrid_package)
+RUNNER_CHILD_TEST(security_manager_09e_update_app_nonhybrid_package)
 {
     constexpr char pkgId[] = "sm_test_09e";
     AppInstallHelperExt apps[] = {{"sm_test_09e_0", pkgId},
@@ -671,7 +671,7 @@ RUNNER_TEST(security_manager_09e_update_app_nonhybrid_package)
     apps[1].checkAfterUninstall(true);
 }
 
-RUNNER_TEST(security_manager_09f_update_app_hybrid_package)
+RUNNER_CHILD_TEST(security_manager_09f_update_app_hybrid_package)
 {
     constexpr char pkgId[] = "sm_test_09f";
     AppInstallHelperExt apps[] = {{"sm_test_09f_0", pkgId},
@@ -980,7 +980,7 @@ RUNNER_TEST(security_manager_24_groups_get)
 
 RUNNER_TEST_GROUP_INIT(SECURITY_MANAGER_INSTALL_TYPE)
 
-RUNNER_TEST(security_manager_25a_global_user_set_install_type_global)
+RUNNER_CHILD_TEST(security_manager_25a_global_user_set_install_type_global)
 {
     AppInstallHelperExt app("sm_test_25a");
     app.setInstallType(SM_APP_INSTALL_GLOBAL);
@@ -1006,7 +1006,7 @@ RUNNER_TEST(security_manager_25b_global_user_set_install_type_local)
     Api::install(requestInst, (lib_retcode)SECURITY_MANAGER_ERROR_SERVER_ERROR);
 }
 
-RUNNER_TEST(security_manager_25c_global_user_set_install_type_preloaded)
+RUNNER_CHILD_TEST(security_manager_25c_global_user_set_install_type_preloaded)
 {
     AppInstallHelperExt app("sm_test_25c");
     app.setInstallType(SM_APP_INSTALL_PRELOADED);
index 9d34968b523e972ea60c5e9e758692f40179e564..f6181e563f5aa2233c83638bde70412c053eb616 100644 (file)
@@ -584,7 +584,7 @@ template <class T, size_t N>
 constexpr size_t arraySize(T (&)[N]) { return N; }
 } // namespace
 
-RUNNER_TEST(security_manager_190_prepare_app_threads_malloc)
+RUNNER_CHILD_TEST(security_manager_190_prepare_app_threads_malloc)
 {
     TemporaryTestUser tmpUser(APP_TEST_USER, GUM_USERTYPE_NORMAL, false);
     tmpUser.create();
@@ -627,7 +627,7 @@ RUNNER_TEST(security_manager_190_prepare_app_threads_malloc)
        Api::cleanupApp(app.getAppId(), uid, pid);
 }
 
-RUNNER_TEST(security_manager_200_prepare_app_perf)
+RUNNER_CHILD_TEST(security_manager_200_prepare_app_perf)
 {
     constexpr int8_t nThreads = 32;
     constexpr int8_t nConcurrentAppsSamples[] = { 0 /* 1 app w/ nThreads */, 1, 2, 4, 8, 16, 32 };
@@ -822,7 +822,7 @@ RUNNER_CHILD_TEST(security_manager_400_prepare_app_with_concurrent_install)
     }
 }
 
-RUNNER_TEST(security_manager_400_prepare_app_series_with_concurrent_install_stress)
+RUNNER_CHILD_TEST(security_manager_400_prepare_app_series_with_concurrent_install_stress)
 {
     std::srand(std::time(nullptr)); // use current time as seed for random generator
     TemporaryTestUser tmpUser(APP_TEST_USER, GUM_USERTYPE_NORMAL, false);