From 906ff05c62f4d8739ed24193116be0be43e788fb Mon Sep 17 00:00:00 2001 From: Bartlomiej Kunikowski Date: Fri, 9 Sep 2016 11:06:45 +0200 Subject: [PATCH] Add package file ownership checking to smoke tests All tests passed after making fixes: - https://review.tizen.org/gerrit/#/c/87795/ - https://review.tizen.org/gerrit/#/c/87797/ Change-Id: Ic25afade3f3ffe4279a0ddf2562ba9c5420abff8 --- src/unit_tests/smoke_test.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index 4e6606e..e13e6d5 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -39,6 +39,7 @@ namespace ci = common_installer; namespace { const uid_t kTestUserId = tzplatform_getuid(TZ_SYS_DEFAULT_USER); +const gid_t kTestGroupId = tzplatform_getgid(TZ_SYS_DEFAULT_USER); const std::string kTestUserIdStr = std::to_string(kTestUserId); @@ -203,6 +204,16 @@ void ValidatePackageFS(const std::string& pkgid, bf::path manifest_backup = ci::GetBackupPathForManifestFile(manifest_path); ASSERT_FALSE(bf::exists(package_backup)); ASSERT_FALSE(bf::exists(manifest_backup)); + + for (bf::recursive_directory_iterator iter(root_path); + iter != bf::recursive_directory_iterator(); ++iter) { + if (bf::is_symlink(symlink_status(iter->path()))) + continue; + struct stat stats; + stat(iter->path().c_str(), &stats); + ASSERT_EQ(kTestUserId, stats.st_uid); + ASSERT_EQ(kTestGroupId, stats.st_gid); + } } void PackageCheckCleanup(const std::string& pkgid, -- 2.7.4