Fix test_5_daemon_sigint, and hardware_events tests

This commit is contained in:
Teddy Reed 2015-10-12 18:53:47 -07:00
parent c7ff3dfb4f
commit 0440bb970f
5 changed files with 11 additions and 5 deletions

View File

@ -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

View File

@ -13,6 +13,7 @@
*/
#include <osquery/events.h>
#include <osquery/logger.h>
#include <osquery/tables.h>

View File

@ -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));

View File

@ -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."""

View File

@ -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()