Changeset 441a022 in nscp for scripts


Ignore:
Timestamp:
01/18/12 22:47:06 (16 months ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2
Children:
2ec2eb6
Parents:
ffa6a59
Message:
  • Fixed error state propagation
  • Added unit tests to cmake (ie make test will now run unit tests)
Location:
scripts
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • scripts/CMakeLists.txt

    r4b1e6fe r441a022  
    55FILE (GLOB scripts_PS1 "*.ps1") 
    66FILE (GLOB scripts_LIB "lib/*.vbs") 
    7 IF(WIN32) 
     7#IF(WIN32) 
    88FILE (GLOB_RECURSE scripts_PYT "python/*.py") 
    9 ELSE(WIN32) 
    10 FILE (GLOB scripts_PYT "python/*.py" "python/lib/*.py") 
    11 ENDIF(WIN32) 
     9#ELSE(WIN32) 
     10#FILE (GLOB scripts_PYT "python/*.py" "python/lib/*.py") 
     11#ENDIF(WIN32) 
    1212FILE (GLOB scripts_LUA "lua/*.lua") 
    1313 
  • scripts/python/lib/test_helper.py

    rffa6a59 r441a022  
    221221      return 'OK: %s'%self.title 
    222222    else: 
    223       (total, ok) = c.count() 
     223      (total, ok) = self.count() 
    224224      return 'ERROR: %s (%d/%d)'%(self.title, ok, total) 
    225225 
  • scripts/python/test_all.py

    rffa6a59 r441a022  
    33 
    44from sys import path 
    5 from os import getcwd 
    6 path.append(getcwd() + '/scripts/python') 
     5import os 
     6path.append(os.getcwd() + '/scripts/python') 
    77 
    88from test_nsca import NSCAServerTest 
    99from test_nrpe import NRPEServerTest 
    1010#from test_pb import NSCAServerTest 
    11 from test_eventlog import EventLogTest 
    1211from test_python import PythonTest 
    13 from test_w32_system import Win32SystemTest 
    1412 
    15 all_tests = [NSCAServerTest, NRPEServerTest, EventLogTest, PythonTest, Win32SystemTest] 
     13#  
     14all_tests = [NSCAServerTest, PythonTest, NRPEServerTest] 
     15if os.name == 'nt': 
     16  from test_eventlog import EventLogTest 
     17  from test_w32_system import Win32SystemTest 
     18  all_tests.extend([EventLogTest, Win32SystemTest]) 
    1619 
    1720def __main__(): 
  • scripts/python/test_nrpe.py

    r89838be r441a022  
    11from NSCP import Settings, Registry, Core, log, status, log_error, sleep 
     2import sys 
     3log('==>%s'%sys.path) 
     4 
    25from test_helper import BasicTest, TestResult, Callable, setup_singleton, install_testcases, init_testcases, shutdown_testcases 
    36import plugin_pb2 
  • scripts/python/test_nsca.py

    rba63b95 r441a022  
    165165    (result_code, err) = core.submit('nsca_test_outbox', message.SerializeToString()) 
    166166 
    167     result = TestResult() 
     167    result = TestResult('Testing payload: %s'%tag) 
    168168    result.add_message(len(err) == 0, 'Testing to send message using %s/sbp'%tag, err) 
    169169    found = self.wait_and_validate(uid, result, msg, perf, '%s/spb'%tag) 
     
    192192    found = self.wait_and_validate(uid, result, msg, perf, '%s/exec'%tag) 
    193193    if retry and not found: 
    194       return self.submit_via_exec(encryption, source, status, msg, perf, tag, False) 
     194      return self.submit_via_exec(encryption, source, status, msg, perf, '%s (retry)'%tag, False) 
    195195    return result 
    196196 
  • scripts/python/test_python.py

    r89838be r441a022  
    44from time import time 
    55 
    6 install_checks = 1000 
     6install_checks = 100 
     7time_to_run = 30 
     8 
     9core = Core.get() 
    710 
    811class PythonTest(BasicTest): 
     
    3639    self.reg.simple_function('py_stress_noop', PythonTest.noop_handler, 'This is a simple noop command') 
    3740    self.reg.simple_subscription('py_stress_test', PythonTest.stress_handler) 
     41    conf = Settings.get() 
     42    conf.set_string('/settings/test_scheduler', 'threads', '50') 
     43    core.reload('test_scheduler') 
     44     
    3845 
    3946  def teardown(self): 
     47    conf = Settings.get() 
     48    conf.set_string('/settings/test_scheduler', 'threads', '0') 
     49    core.reload('test_scheduler') 
    4050    None 
    4151 
     
    4353    result = TestResult() 
    4454    start = time() 
    45     while self.stress_count < install_checks*10: 
    46       log('Waiting for %d: %d/%d'%(install_checks*10, self.stress_count, self.noop_count)) 
     55    total_count = install_checks*time_to_run/5 
     56    while self.stress_count < total_count: 
     57      log('Waiting for %d: %d/%d'%(total_count, self.stress_count, self.noop_count)) 
    4758      old_stress_count = self.stress_count 
    4859      old_noop_count = self.noop_count 
     
    6374     
    6475    base_path = '/settings/test_scheduler' 
    65     conf.set_string(base_path, 'threads', '50') 
     76    conf.set_string(base_path, 'threads', '0') 
    6677 
    6778    default_path = '%s/default'%base_path 
Note: See TracChangeset for help on using the changeset viewer.