Adjusted some details about the time-out control
- Warning when detected pointing to use the global options - Now pcbnmew_do/eeschema_do output is captured - Warning when using floating value for kiauto_wait_start (no fail) - A simple test for time-out Fixes #48
This commit is contained in:
parent
34e85d646c
commit
ce0f22edce
|
|
@ -7,6 +7,7 @@ from .gs import GS
|
||||||
from .macros import macros, document # noqa: F401
|
from .macros import macros, document # noqa: F401
|
||||||
from .pre_filters import FiltersOptions
|
from .pre_filters import FiltersOptions
|
||||||
from .log import get_logger, set_filters
|
from .log import get_logger, set_filters
|
||||||
|
from .misc import W_MUSTBEINT
|
||||||
|
|
||||||
|
|
||||||
class Globals(FiltersOptions):
|
class Globals(FiltersOptions):
|
||||||
|
|
@ -41,6 +42,9 @@ class Globals(FiltersOptions):
|
||||||
GS.global_output = self.set_global(GS.global_output, self.output, 'output')
|
GS.global_output = self.set_global(GS.global_output, self.output, 'output')
|
||||||
GS.global_variant = self.set_global(GS.global_variant, self.variant, 'variant')
|
GS.global_variant = self.set_global(GS.global_variant, self.variant, 'variant')
|
||||||
GS.global_kiauto_wait_start = self.set_global(GS.global_kiauto_wait_start, self.kiauto_wait_start, 'kiauto_wait_start')
|
GS.global_kiauto_wait_start = self.set_global(GS.global_kiauto_wait_start, self.kiauto_wait_start, 'kiauto_wait_start')
|
||||||
|
if GS.global_kiauto_wait_start and int(GS.global_kiauto_wait_start) != GS.global_kiauto_wait_start:
|
||||||
|
GS.global_kiauto_wait_start = int(GS.global_kiauto_wait_start)
|
||||||
|
logger.warning(W_MUSTBEINT+'kiauto_wait_start must be integer, truncating to '+str(GS.global_kiauto_wait_start))
|
||||||
GS.global_kiauto_time_out_scale = self.set_global(GS.global_kiauto_time_out_scale, self.kiauto_time_out_scale,
|
GS.global_kiauto_time_out_scale = self.set_global(GS.global_kiauto_time_out_scale, self.kiauto_time_out_scale,
|
||||||
'kiauto_time_out_scale')
|
'kiauto_time_out_scale')
|
||||||
set_filters(self.unparsed)
|
set_filters(self.unparsed)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import os
|
||||||
import re
|
import re
|
||||||
from sys import exit
|
from sys import exit
|
||||||
from shutil import which
|
from shutil import which
|
||||||
from subprocess import run, PIPE, call
|
from subprocess import run, PIPE
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from distutils.version import StrictVersion
|
from distutils.version import StrictVersion
|
||||||
from importlib.util import (spec_from_file_location, module_from_spec)
|
from importlib.util import (spec_from_file_location, module_from_spec)
|
||||||
|
|
@ -22,7 +22,7 @@ from collections import OrderedDict
|
||||||
from .gs import GS
|
from .gs import GS
|
||||||
from .misc import (PLOT_ERROR, MISSING_TOOL, CMD_EESCHEMA_DO, URL_EESCHEMA_DO, CORRUPTED_PCB,
|
from .misc import (PLOT_ERROR, MISSING_TOOL, CMD_EESCHEMA_DO, URL_EESCHEMA_DO, CORRUPTED_PCB,
|
||||||
EXIT_BAD_ARGS, CORRUPTED_SCH, EXIT_BAD_CONFIG, WRONG_INSTALL, UI_SMD, UI_VIRTUAL, KICAD_VERSION_5_99,
|
EXIT_BAD_ARGS, CORRUPTED_SCH, EXIT_BAD_CONFIG, WRONG_INSTALL, UI_SMD, UI_VIRTUAL, KICAD_VERSION_5_99,
|
||||||
MOD_SMD, MOD_THROUGH_HOLE, MOD_VIRTUAL, W_PCBNOSCH, W_NONEEDSKIP, W_WRONGCHAR, name2make)
|
MOD_SMD, MOD_THROUGH_HOLE, MOD_VIRTUAL, W_PCBNOSCH, W_NONEEDSKIP, W_WRONGCHAR, name2make, W_TIMEOUT)
|
||||||
from .error import PlotError, KiPlotConfigurationError, config_error, trace_dump
|
from .error import PlotError, KiPlotConfigurationError, config_error, trace_dump
|
||||||
from .pre_base import BasePreFlight
|
from .pre_base import BasePreFlight
|
||||||
from .kicad.v5_sch import Schematic, SchFileError
|
from .kicad.v5_sch import Schematic, SchFileError
|
||||||
|
|
@ -122,11 +122,20 @@ def exec_with_retry(cmd):
|
||||||
logger.debug('Executing: '+str(cmd))
|
logger.debug('Executing: '+str(cmd))
|
||||||
retry = 2
|
retry = 2
|
||||||
while retry:
|
while retry:
|
||||||
ret = call(cmd)
|
result = run(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True)
|
||||||
|
ret = result.returncode
|
||||||
retry -= 1
|
retry -= 1
|
||||||
if ret > 0 and ret < 128 and retry:
|
if ret > 0 and ret < 128 and retry:
|
||||||
logger.debug('Failed with error {}, retrying ...'.format(ret))
|
logger.debug('Failed with error {}, retrying ...'.format(ret))
|
||||||
else:
|
else:
|
||||||
|
err = '> '+result.stderr.replace('\n', '\n> ')
|
||||||
|
if ret:
|
||||||
|
logger.error('Output from command:\n'+err)
|
||||||
|
else:
|
||||||
|
logger.debug('Output from command:\n'+err)
|
||||||
|
if 'Timed out' in err:
|
||||||
|
logger.warning(W_TIMEOUT+'Time out detected, on slow machines or complex projects try:')
|
||||||
|
logger.warning(W_TIMEOUT+'`kiauto_time_out_scale` and/or `kiauto_wait_start` global options')
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,8 @@ W_EMPTYZIP = '(W050) '
|
||||||
W_WRONGCHAR = '(W051) '
|
W_WRONGCHAR = '(W051) '
|
||||||
W_NOKIVER = '(W052) '
|
W_NOKIVER = '(W052) '
|
||||||
W_EXTNAME = '(W053) '
|
W_EXTNAME = '(W053) '
|
||||||
|
W_TIMEOUT = '(W054) '
|
||||||
|
W_MUSTBEINT = '(W055) '
|
||||||
|
|
||||||
|
|
||||||
class Rect(object):
|
class Rect(object):
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,15 @@ def test_drc_fail(test_dir):
|
||||||
ctx.clean_up()
|
ctx.clean_up()
|
||||||
|
|
||||||
|
|
||||||
|
def test_drc_time_out(test_dir):
|
||||||
|
prj = 'bom'
|
||||||
|
ctx = context.TestContext(test_dir, 'test_drc_time_out', prj, 'drc_time_out', '')
|
||||||
|
ctx.run(DRC_ERROR)
|
||||||
|
ctx.search_err('Time out detected')
|
||||||
|
ctx.search_err('kiauto_wait_start must be integer')
|
||||||
|
ctx.clean_up()
|
||||||
|
|
||||||
|
|
||||||
def test_update_xml(test_dir):
|
def test_update_xml(test_dir):
|
||||||
prj = 'bom'
|
prj = 'bom'
|
||||||
ctx = context.TestContext(test_dir, 'Update_XML', prj, 'update_xml', '')
|
ctx = context.TestContext(test_dir, 'Update_XML', prj, 'update_xml', '')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue