DECLARE_string(modules_autoload);
DECLARE_string(extensions_autoload);
DECLARE_bool(disable_logging);
+DECLARE_bool(verbose);
void initTesting() {
// Seed the random number generator, some tests generate temporary files
FLAGS_extensions_autoload = kTestWorkingDirectory + "unittests-ext.load";
FLAGS_modules_autoload = kTestWorkingDirectory + "unittests-mod.load";
FLAGS_disable_logging = true;
+ FLAGS_verbose = true;
// Create a default DBHandle instance before unittests.
(void)DBHandle::getInstance();
ADD_OSQUERY_LIBRARY(TRUE osquery_manager manager.cpp
manager_impl.cpp)
-ADD_OSQUERY_TEST(TRUE osquery_manager_tests manager_tests.cpp)
+FILE(GLOB OSQUERY_MANAGER_TESTS "tests/*.cpp")
+ADD_OSQUERY_TEST(TRUE ${OSQUERY_MANAGER_TESTS})
#include <boost/filesystem/operations.hpp>
+#include <functional>
#include <sstream>
namespace osquery {
ManagerImpl::ManagerImpl()
{
- auto logDir = Flag::get().getValue("osquery_log_dir");
+ auto logDir = Flag::getValue("osquery_log_dir");
if (!logDir.empty() && !(pathExists(logDir).ok()))
boost::filesystem::create_directories(logDir);
- // TODO(Sangwan): Get debug mode at build time
- Flag::updateValue("verbose_debug", "true");
-
- const char* cargv[] = {"tizen-osquery"};
- osquery::initOsquery(1, const_cast<char**>(cargv));
-
LOG(INFO) << "Initalize osquery manager. ";
}
ManagerImpl::~ManagerImpl() noexcept
{
LOG(INFO) << "Shutdown osquery manager.";
- osquery::shutdownOsquery();
}
ManagerImpl& ManagerImpl::instance()
for (const auto& c : columns)
VLOG(1) << "\t" << c;
}
-
-int main(int argc, char* argv[]) {
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
ADD_OSQUERY_LIBRARY(TRUE osquery_notification notification.cpp)
-ADD_OSQUERY_TEST(TRUE osquery_notification_tests notification_tests.cpp)
+FILE(GLOB OSQUERY_NOTIFICATION_TESTS "tests/*.cpp")
+ADD_OSQUERY_TEST(TRUE ${OSQUERY_NOTIFICATION_TESTS})
EXPECT_TRUE(s.ok());
EXPECT_EQ(called, 1);
}
-
-int main(int argc, char* argv[]) {
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
ADD_OSQUERY_LIBRARY(TRUE osquery_property property.cpp)
-ADD_OSQUERY_TEST(TRUE osquery_property_tests property_tests.cpp)
+FILE(GLOB OSQUERY_PROPERTY_TESTS "tests/*.cpp")
+ADD_OSQUERY_TEST(TRUE ${OSQUERY_PROPERTY_TESTS})
// EXPECT_NE(result.hour, -1);
}
-
-int main(int argc, char* argv[]) {
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
# See the License for the specific language governing permissions and
# limitations under the License
-ADD_OSQUERY_TEST(FALSE tsqb_tests tsqb-tests.cpp)
+FILE(GLOB TSQB_TESTS "tests/*.cpp")
+ADD_OSQUERY_TEST(TRUE ${TSQB_TESTS})
"INNER JOIN admin ON managed_policy.aid = admin.id "
"WHERE managed_policy.pid = ?");
}
-
-int main(int argc, char* argv[]) {
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}