mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-07 18:08:53 +00:00
Use a null DB for the run test binary
This commit is contained in:
parent
57e8ef2ab3
commit
b29168a7b7
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user