[SmokeTest] Skip tests for preload request 01/119901/7
authorDamian Pietruchowski <d.pietruchow@samsung.com>
Mon, 20 Mar 2017 11:56:30 +0000 (12:56 +0100)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Fri, 26 May 2017 07:17:26 +0000 (07:17 +0000)
Change-Id: I78231a9bb8edf43db8ae71f7828aa7d82fa0d5ee
Signed-off-by: Damian Pietruchowski <d.pietruchow@samsung.com>
src/unit_tests/smoke_test.cc

index 0784028..4270c1b 100644 (file)
@@ -47,6 +47,12 @@ class SmokeEnvironment : public testing::Environment {
 class SmokeTest : public testing::Test {
 };
 
+class PreloadSmokeTest : public testing::Test {
+  void SetUp() override {
+    ASSERT_EQ(kGlobalUserUid, kTestUserId);
+  }
+};
+
 // TODO(b.kunikowski): New smoke app pkgid name convention.
 //    Change all smokeapp pkgids to smoketpk, because now there
 //    may be some smoke app pkgid identical as in tpk smoke tests, and this may
@@ -379,7 +385,7 @@ TEST_F(SmokeTest, TEP_Tpk_Mount_TepInstallNoTepUpdateRollback) {
   ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
 }
 
-TEST_F(SmokeTest, InstallationMode_Preload) {
+TEST_F(PreloadSmokeTest, InstallationMode_Preload) {
   ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
   bf::path path = kSmokePackagesDirectory / "InstallationMode_Preload.tpk";
   std::string pkgid = "smoketpk29";
@@ -388,7 +394,7 @@ TEST_F(SmokeTest, InstallationMode_Preload) {
   ValidatePackage(pkgid, appid, true);
 }
 
-TEST_F(SmokeTest, UpdateMode_Preload) {
+TEST_F(PreloadSmokeTest, UpdateMode_Preload) {
   ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
   bf::path path_old = kSmokePackagesDirectory / "UpdateMode_Preload.tpk";
   bf::path path_new = kSmokePackagesDirectory / "UpdateMode_Preload2.tpk";
@@ -401,7 +407,7 @@ TEST_F(SmokeTest, UpdateMode_Preload) {
   ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", "2", true));
 }
 
-TEST_F(SmokeTest, DeinstallationMode_Preload) {
+TEST_F(PreloadSmokeTest, DeinstallationMode_Preload) {
   ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
   bf::path path = kSmokePackagesDirectory / "DeinstallationMode_Preload.tpk";
   std::string pkgid = "smoketpk31";
@@ -538,6 +544,10 @@ TEST_F(SmokeTest, MountUpdateMode_Rollback) {
 
 int main(int argc,  char** argv) {
   ci::RequestMode request_mode = ParseRequestMode(argc, argv);
+  if (getuid() != 0 || request_mode != ci::RequestMode::GLOBAL) {
+    std::cout << "Skip tests for preload request" << std::endl;
+    ::testing::GTEST_FLAG(filter) = "SmokeTest.*";
+  }
   testing::InitGoogleTest(&argc, argv);
   testing::AddGlobalTestEnvironment(
       new common_installer::SmokeEnvironment(request_mode));