### MAIN
########################################################################
-def test_version(pingcheck_binary, log):
- """ run pingcheck --version; we want > 0.1 for proper IP parsing """
+def test_version(pingcheck_binary):
+ """ run pingcheck --version; we want > 0.1 for proper IP parsing
- try:
- output = check_output(['pingcheck', '--version'])
- except:
- pass
+ no try-catch here, also intended as test-run for pingcheck binary
+ """
+
+ output = subprocess.check_output([pingcheck_binary, '--version'], universal_newlines=True)
+ match = regexp('\s*pingcheck version (\d+\.\d+)\s*', output)
+ if match is None:
+ raise ValueError('Could not determine pingcheck version from output of {0} --version!'\
+ .format(pingcheck_binary))
+ version = float(match.groups()[0])
+ if version < 0.2:
+ raise ValueError('Pingcheck version is {0} but require version > 0.1!'.format(version))
#end: test_version
tester = None
line_iter = None
try:
- # test version
- #test_version(opts.pingcheck_binary, log)
-
config_file, n_hosts = create_conf_file(opts.output_prefix)
save_file = opts.output_prefix + '_save.pickle'
log.info('created config file {0}'.format(config_file))
+ # test version
+ test_version(opts.pingcheck_binary)
+
#signal.signal(signal.SIGCHLD, \
# lambda signum, curr_frame: handle_sigchild(signum, curr_frame, log, \
# (log, pinger, tester, line_iter, save_file) )