Added makefile test for sch_variant case.
- Also avoided to repeat the same SCH dependency more than once.
This commit is contained in:
parent
56fa06ef15
commit
79fe05ed9f
|
|
@ -1469,11 +1469,12 @@ class Schematic(object):
|
||||||
self.sub_sheets.append(sch.load_sheet(project, fname, sheet_path, sheet_path_h, libs, fields, fields_lc))
|
self.sub_sheets.append(sch.load_sheet(project, fname, sheet_path, sheet_path_h, libs, fields, fields_lc))
|
||||||
|
|
||||||
def get_files(self):
|
def get_files(self):
|
||||||
""" A list of the names for all the sheets, including this one. """
|
""" A list of the names for all the sheets, including this one.
|
||||||
files = [self.fname]
|
We avoid repeating the same file. """
|
||||||
|
files = {self.fname}
|
||||||
for sch in self.sheets:
|
for sch in self.sheets:
|
||||||
files.extend(sch.sheet.get_files())
|
files.update(sch.sheet.get_files())
|
||||||
return files
|
return list(files)
|
||||||
|
|
||||||
def get_components(self, exclude_power=True):
|
def get_components(self, exclude_power=True):
|
||||||
""" A list of all the components. """
|
""" A list of all the components. """
|
||||||
|
|
@ -1624,9 +1625,10 @@ class Schematic(object):
|
||||||
""" Returns a list of file names created by save_variant() """
|
""" Returns a list of file names created by save_variant() """
|
||||||
fnames = [os.path.join(dest_dir, 'y.lib'),
|
fnames = [os.path.join(dest_dir, 'y.lib'),
|
||||||
os.path.join(dest_dir, 'n.lib'),
|
os.path.join(dest_dir, 'n.lib'),
|
||||||
os.path.join(dest_dir, os.path.basename(self.fname)),
|
|
||||||
os.path.join(dest_dir, 'sym-lib-table')]
|
os.path.join(dest_dir, 'sym-lib-table')]
|
||||||
# Sub-sheets
|
# Sub-sheets
|
||||||
for sch in self.sheets:
|
sub_sheets = self.get_files()
|
||||||
fnames.append(os.path.join(dest_dir, sch.file.replace('/', '_')))
|
for sch in sub_sheets:
|
||||||
|
sch = os.path.basename(sch)
|
||||||
|
fnames.append(os.path.join(dest_dir, sch.replace('/', '_')))
|
||||||
return fnames
|
return fnames
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ from kibot.misc import (EXIT_BAD_ARGS, EXIT_BAD_CONFIG, NO_PCB_FILE, NO_SCH_FILE
|
||||||
|
|
||||||
POS_DIR = 'positiondir'
|
POS_DIR = 'positiondir'
|
||||||
MK_TARGETS = ['position', 'archive', 'interactive_bom', 'run_erc', '3D', 'kibom_internal', 'drill', 'pcb_render',
|
MK_TARGETS = ['position', 'archive', 'interactive_bom', 'run_erc', '3D', 'kibom_internal', 'drill', 'pcb_render',
|
||||||
'print_front', 'svg_sch_def', 'svg_sch_int', 'pdf_sch_def', 'pdf_sch_int']
|
'print_front', 'svg_sch_def', 'svg_sch_int', 'pdf_sch_def', 'pdf_sch_int', 'fake_sch']
|
||||||
|
|
||||||
|
|
||||||
def test_skip_pre_and_outputs(test_dir):
|
def test_skip_pre_and_outputs(test_dir):
|
||||||
|
|
@ -552,12 +552,15 @@ def test_no_colorama(test_dir):
|
||||||
ctx.search_err(r'\[31m.\[1mERROR:Testing 1 2 3')
|
ctx.search_err(r'\[31m.\[1mERROR:Testing 1 2 3')
|
||||||
|
|
||||||
|
|
||||||
def check_test_v5_sch_deps(ctx, deps, extra=[]):
|
def check_test_v5_sch_deps(ctx, deps, extra=[], in_output=False):
|
||||||
assert len(deps) == 5+len(extra), deps
|
assert len(deps) == 3+len(extra), deps
|
||||||
dir = os.path.dirname(ctx.board_file)
|
dir = os.path.dirname(ctx.board_file)
|
||||||
deps_abs = [os.path.abspath(f) for f in deps]
|
deps_abs = [os.path.abspath(f) for f in deps]
|
||||||
for sch in ['test_v5.sch', 'sub-sheet.sch', 'deeper.sch', 'sub-sheet.sch', 'deeper.sch']:
|
for sch in ['test_v5.sch', 'sub-sheet.sch', 'deeper.sch']:
|
||||||
assert os.path.abspath(os.path.join(dir, sch)) in deps_abs
|
if in_output:
|
||||||
|
assert os.path.abspath(ctx.get_out_path(sch)) in deps_abs
|
||||||
|
else:
|
||||||
|
assert os.path.abspath(os.path.join(dir, sch)) in deps_abs
|
||||||
for f in extra:
|
for f in extra:
|
||||||
assert f in deps
|
assert f in deps
|
||||||
|
|
||||||
|
|
@ -644,6 +647,13 @@ def test_makefile_1(test_dir):
|
||||||
assert ctx.get_out_path(prj+'-erc.txt') in deps
|
assert ctx.get_out_path(prj+'-erc.txt') in deps
|
||||||
check_test_v5_sch_deps(ctx, targets[targets['run_erc']].split(' '))
|
check_test_v5_sch_deps(ctx, targets[targets['run_erc']].split(' '))
|
||||||
logging.debug('- Target `run_erc` OK')
|
logging.debug('- Target `run_erc` OK')
|
||||||
|
# fake_sch target
|
||||||
|
deps = targets['fake_sch'].split(' ')
|
||||||
|
assert len(deps) == 6, deps
|
||||||
|
check_test_v5_sch_deps(ctx, deps, extra=[ctx.get_out_path('n.lib'), ctx.get_out_path('y.lib'),
|
||||||
|
ctx.get_out_path('sym-lib-table')], in_output=True)
|
||||||
|
check_test_v5_sch_deps(ctx, targets[targets['fake_sch']].split(' '))
|
||||||
|
logging.debug('- Target `run_erc` OK')
|
||||||
# 3D target
|
# 3D target
|
||||||
deps = targets['3D'].split(' ')
|
deps = targets['3D'].split(' ')
|
||||||
assert len(deps) == 1, deps
|
assert len(deps) == 1, deps
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,10 @@ outputs:
|
||||||
comment: "Print schematic, internal name (PDF)"
|
comment: "Print schematic, internal name (PDF)"
|
||||||
type: pdf_sch_print
|
type: pdf_sch_print
|
||||||
|
|
||||||
|
- name: 'fake_sch'
|
||||||
|
comment: "Schematic with variants applied"
|
||||||
|
type: sch_variant
|
||||||
|
|
||||||
- name: 'archive'
|
- name: 'archive'
|
||||||
comment: 'Compressed files'
|
comment: 'Compressed files'
|
||||||
type: compress
|
type: compress
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue