Revert "[SmokeTest] Skip tests for preload request"
[platform/core/appfw/wgt-backend.git] / src / unit_tests / smoke_test.cc
index 25d87d8..0fb52ff 100644 (file)
@@ -848,8 +848,7 @@ class SmokeTest : public testing::Test {
 
 class PreloadSmokeTest : public testing::Test {
   void SetUp() override {
-    ASSERT_EQ(ci::RequestMode::GLOBAL, kRequestMode);
-    ASSERT_EQ(0, getuid()) << "Test cannot be run by normal user";
+    ASSERT_TRUE(kRequestMode == ci::RequestMode::GLOBAL);
   }
 };
 
@@ -1387,7 +1386,8 @@ TEST_F(SmokeTest, MigrateLegacyExternalImageMode) {
   ValidateExternalPackage(pkgid, {appid});
 }
 
-TEST_F(PreloadSmokeTest, InstallationMode_Preload) {;
+TEST_F(PreloadSmokeTest, InstallationMode_Preload) {
+  ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
   bf::path path = kSmokePackagesDirectory / "InstallationMode_Preload.wgt";
   std::string pkgid = "smokewgt37";
   std::string appid = "smokewgt37.InstallationModePreload";
@@ -1397,6 +1397,7 @@ TEST_F(PreloadSmokeTest, InstallationMode_Preload) {;
 }
 
 TEST_F(PreloadSmokeTest, UpdateMode_Preload) {
+  ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
   bf::path path_old = kSmokePackagesDirectory / "UpdateMode_Preload.wgt";
   bf::path path_new = kSmokePackagesDirectory / "UpdateMode_Preload2.wgt";
   std::string pkgid = "smokewgt38";
@@ -1414,6 +1415,7 @@ TEST_F(PreloadSmokeTest, UpdateMode_Preload) {
 }
 
 TEST_F(PreloadSmokeTest, DeinstallationMode_Preload) {
+  ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
   bf::path path = kSmokePackagesDirectory / "DeinstallationMode_Preload.wgt";
   std::string pkgid = "smokewgt39";
   std::string appid = "smokewgt39.DeinstallationModePreload";
@@ -1498,13 +1500,9 @@ TEST_F(SmokeTest, SharedRes30HybridDelta) {
 }  // namespace common_installer
 
 int main(int argc,  char** argv) {
-  ParseRequestMode(argc, argv);
-  if (getuid() != 0 || kRequestMode != ci::RequestMode::GLOBAL) {
-    std::cout << "Skip tests for preload request" << std::endl;
-    ::testing::GTEST_FLAG(filter) = "SmokeTest.*";
-  }
   testing::InitGoogleTest(&argc, argv);
   testing::Environment *env = testing::AddGlobalTestEnvironment(
       new common_installer::SmokeEnvironment());
+  ParseRequestMode(argc, argv);
   return RUN_ALL_TESTS();
 }