From 048caad578c7f20c607b38f7f3087f4e2d9a171e Mon Sep 17 00:00:00 2001 From: emdee Date: Tue, 18 Oct 2022 00:16:56 +0000 Subject: [PATCH] bootstrap_iNmapInfo --- README.md | 3 +++ wrapper_tests/support_testing.py | 40 +++++++++++++++++++++++++++++++- wrapper_tests/tests_wrapper.py | 40 ++------------------------------ 3 files changed, 44 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 74fa3b9..62e9db1 100644 --- a/README.md +++ b/README.md @@ -82,3 +82,6 @@ Others include: To our point of view, the ability of CTYPEs to follow code in the debugger is crucial. + +Work on this project is suspended until the +[MultiDevice](https://git.plastiras.org/emdee/tox_profile/wiki/MultiDevice-Announcements-POC) problem is solved. Fork me! diff --git a/wrapper_tests/support_testing.py b/wrapper_tests/support_testing.py index 0d81583..aed1904 100644 --- a/wrapper_tests/support_testing.py +++ b/wrapper_tests/support_testing.py @@ -4,6 +4,7 @@ import os import sys import argparse import re +import traceback import logging import shutil import json @@ -62,7 +63,8 @@ else: # self._audio_thread.isAlive iTHREAD_TIMEOUT = 1 iTHREAD_SLEEP = 1 -iTHREAD_JOINS = 5 +iTHREAD_JOINS = 8 +iNODES=6 lToxSamplerates = [8000, 12000, 16000, 24000, 48000] lToxSampleratesK = [8, 12, 16, 24, 48] @@ -70,6 +72,7 @@ lBOOLEANS = [ 'local_discovery_enabled', 'udp_enabled', 'ipv6_enabled', + 'trace_enabled', 'compact_mode', 'allow_inline', 'notifications', @@ -511,6 +514,41 @@ def bootstrap_tcp(lelts, lToxes): else: LOG.debug('bootstrap_tcp to ' +largs[0] +' not connected') +def bootstrap_iNmapInfo(lElts, oArgs, bIS_LOCAL=False, iNODES=iNODES): + if not bIS_LOCAL and not bAreWeConnected(): + LOG.warn(f"bootstrap_iNmapInfo not local and NOT CONNECTED") + return True + env = dict() + if oArgs.proxy_type == 2: + protocol='socks' + elif oArgs.proxy_type == 1: + protocol='https' + else: + protocol='ipv4' + env = os.environ + lRetval = [] + for elts in lElts[:iNODES]: + if elts[0] in lDEAD_BS: continue + iRet = -1 + try: + iRet = iNmapInfo(protocol, *elts) + if iRet != 0: + LOG.warn('iNmapInfo to ' +repr(elts[0]) +' retval=' +str(iRet)) + lRetval += [False] + else: + LOG.info(f'bootstrap_iNmapInfo ' + +f" net={oArgs.network}" + +f" prot={protocol}" + +f" proxy={oArgs.proxy_type}" + +f' {elts[:2]!r}' + ) + lRetval += [True] + except Exception as e: + LOG.error('iNmapInfo to ' +repr(elts[0]) +' : ' +str(e) \ + +'\n' + traceback.format_exc()) + lRetval += [False] + return any(lRetval) + def setup_logging(oArgs): global LOG if coloredlogs: diff --git a/wrapper_tests/tests_wrapper.py b/wrapper_tests/tests_wrapper.py index e6c1dd6..a20725d 100644 --- a/wrapper_tests/tests_wrapper.py +++ b/wrapper_tests/tests_wrapper.py @@ -81,7 +81,6 @@ try: except ImportError: bIS_NOT_TOXYGEN = True -iNODES=8 # from PyQt5 import QtCore if 'QtCore' in globals(): def qt_sleep(fSec): @@ -140,41 +139,6 @@ def iNmapInfo(sProt, sHost, sPort, key=None, environ=None, bTest=False): LOG.debug(f"iNmapInfo: {s}") return 0 -def bootstrap_iNmapInfo(lElts): - if not bIS_LOCAL and not ts.bAreWeConnected(): - LOG.warn(f"bootstrap_iNmapInfo not local and NOT CONNECTED") - return True - env = dict() - if oTOX_OARGS.proxy_type == 2: - protocol='socks' - elif oTOX_OARGS.proxy_type == 1: - protocol='https' - else: - protocol='ipv4' - env = os.environ - lRetval = [] - for elts in lElts[:iNODES]: - if elts[0] in ts.lDEAD_BS: continue - iRet = -1 - try: - iRet = iNmapInfo(protocol, *elts) - if iRet != 0: - LOG.warn('iNmapInfo to ' +repr(elts[0]) +' retval=' +str(iRet)) - lRetval += [False] - else: - LOG.info(f'bootstrap_iNmapInfo ' - +f" net={oTOX_OARGS.network}" - +f" prot={protocol}" - +f" proxy={oTOX_OARGS.proxy_type}" - +f' {elts[:2]!r}' - ) - lRetval += [True] - except Exception as e: - LOG.error('iNmapInfo to ' +repr(elts[0]) +' : ' +str(e) \ - +'\n' + traceback.format_exc()) - lRetval += [False] - return any(lRetval) - class ToxOptions(): def __init__(self): self.ipv6_enabled = True @@ -816,8 +780,8 @@ class ToxSuite(unittest.TestCase): lRetval = [] random.shuffle(lElts) # assert - bootstrap_iNmapInfo(lElts) - + ts.bootstrap_iNmapInfo(lElts, oTOX_OARGS, bIS_LOCAL, iNODES=8) + def test_self_get_secret_key(self): # works """ t:self_get_secret_key