Use a null DB for the run test binary

This commit is contained in:
Teddy Reed 2015-11-04 10:39:40 -08:00
parent 57e8ef2ab3
commit b29168a7b7
3 changed files with 5 additions and 2 deletions

View File

@ -78,7 +78,6 @@ endif()
# Construct a set of all object files, starting with third-party and all
# of the osquery core objects (sources from ADD_CORE_LIBRARY macros).
set(OSQUERY_OBJECTS $<TARGET_OBJECTS:osquery_sqlite>)
add_compile_options(-Werror)
# Add subdirectories
add_subdirectory(config)

View File

@ -15,6 +15,7 @@
#include <osquery/flags.h>
#include <osquery/logger.h>
#include "osquery/database/db_handle.h"
#include "osquery/sql/sqlite_util.h"
DEFINE_string(query, "", "query to execute");
@ -40,6 +41,8 @@ int main(int argc, char* argv[]) {
return 1;
}
osquery::DBHandle::setAllowOpen(true);
osquery::FLAGS_database_path = "/dev/null";
osquery::Registry::setUp();
osquery::FLAGS_disable_events = true;
osquery::FLAGS_registry_exceptions = true;

View File

@ -140,7 +140,6 @@ def profile_cmd(cmd, proc=None, shell=False, timeout=0, count=1):
shell=shell,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
p = psutil.Process(pid=proc.pid)
delay = 0
@ -170,6 +169,8 @@ def profile_cmd(cmd, proc=None, shell=False, timeout=0, count=1):
else:
avg_utilization = sum(utilization) / len(utilization)
if len(stats.keys()) == 0:
raise Exception("No stats recorded, perhaps binary returns -1?")
return {
"utilization": avg_utilization,
"duration": duration,