From f32618319568331491d0f6e3b7ce777f6e462bc1 Mon Sep 17 00:00:00 2001 From: Damian Pietruchowski Date: Thu, 9 Mar 2017 15:07:45 +0100 Subject: [PATCH] [SmokeTest] Regex match for uninstall in tear down After all tests, apps are uninstalled based on names of directories in globalapps or apps_rw directory. It should avoid trying to uninstall apps like "tmp" or "pkgdid.bck". Change-Id: If64970a49aa657df759de1173e1f1c96fe7e87ea Signed-off-by: Damian Pietruchowski --- src/unit_tests/smoke_test.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index e150b84..d4c0efc 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -32,6 +32,7 @@ #include #include #include +#include #include "hybrid/hybrid_installer.h" #include "wgt/wgt_app_query_interface.h" @@ -781,11 +782,15 @@ void UninstallAllAppsInDirectory(bf::path dir, bool is_preload) { bf::directory_iterator(dir), bf::directory_iterator())) { if (dir_entry.path().string().find("smoke") != std::string::npos && bf::is_directory(dir_entry)) { - if(Uninstall(dir_entry.path().filename().string(), PackageType::WGT, - is_preload, RequestResult::NORMAL) != - ci::AppInstaller::Result::OK) { - LOG(ERROR) << "Cannot uninstall smoke test app: " - << dir_entry.path().filename().string(); + std::string package = dir_entry.path().filename().string(); + std::regex pkg_regex("smoke[a-zA-Z]{3,}[1-9]{2,}"); + if (std::regex_match(package, pkg_regex)) { + if(Uninstall(dir_entry.path().filename().string(), PackageType::WGT, + is_preload, RequestResult::NORMAL) != + ci::AppInstaller::Result::OK) { + LOG(ERROR) << "Cannot uninstall smoke test app: " + << dir_entry.path().filename().string(); + } } } } -- 2.7.4