mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-07 01:55:20 +00:00
Fix test_5_daemon_sigint, and hardware_events tests
This commit is contained in:
parent
c7ff3dfb4f
commit
0440bb970f
@ -33,6 +33,7 @@ add_compile_options(
|
||||
-Wno-sign-compare
|
||||
-Wno-unused-local-typedef
|
||||
-Wno-deprecated-register
|
||||
-Wno-unknown-warning-option
|
||||
-Wnon-virtual-dtor
|
||||
-Wchar-subscripts
|
||||
-Wpointer-arith
|
||||
|
@ -13,6 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <osquery/events.h>
|
||||
#include <osquery/logger.h>
|
||||
#include <osquery/tables.h>
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <osquery/events.h>
|
||||
#include <osquery/logger.h>
|
||||
#include <osquery/tables.h>
|
||||
|
||||
namespace osquery {
|
||||
@ -46,7 +47,7 @@ class {{table_name_cc}}TablePlugin : public TablePlugin {
|
||||
auto subscriber = EventFactory::getEventSubscriber("{{class_name}}");
|
||||
return std::move(subscriber->{{function}}(request));
|
||||
} else {
|
||||
throw std::runtime_error("Subscriber table: {{class_name}} missing.");
|
||||
LOG(ERROR) << "Subscriber table: {{class_name}} missing.";
|
||||
}
|
||||
{% else %}\
|
||||
return std::move(tables::{{function}}(request));
|
||||
|
@ -91,13 +91,14 @@ def single(args):
|
||||
stderr=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE)
|
||||
stdout, stderr = proc.communicate()
|
||||
end_time = time.time() - start_time
|
||||
if proc.returncode is not 0:
|
||||
print (stdout)
|
||||
print (stderr)
|
||||
print ("%s Test %d failed. (total %6.4fs)" % (
|
||||
red("FAILED"), i + 1, sum(times)))
|
||||
print ("%s Test failed. (total %6.4fs)" % (
|
||||
red("FAILED"), end_time))
|
||||
sys.exit(proc.returncode)
|
||||
return time.time() - start_time
|
||||
return end_time
|
||||
|
||||
def stress(args):
|
||||
"""Small utility to run unittests several times."""
|
||||
|
@ -88,7 +88,9 @@ class DaemonTests(test_base.ProcessGenerator, unittest.TestCase):
|
||||
# Send a SIGINT
|
||||
os.kill(daemon.pid, signal.SIGINT)
|
||||
self.assertTrue(daemon.isDead(daemon.pid, 10))
|
||||
self.assertEqual(daemon.retcode, -1 * signal.SIGINT)
|
||||
|
||||
acceptable_retcodes = [-1, -2, -1 * signal.SIGINT]
|
||||
self.assertTrue(daemon.retcode in acceptable_retcodes)
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_base.Tester().run()
|
||||
|
Loading…
Reference in New Issue
Block a user