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))
|
||||
|
||||
def get_files(self):
|
||||
""" A list of the names for all the sheets, including this one. """
|
||||
files = [self.fname]
|
||||
""" A list of the names for all the sheets, including this one.
|
||||
We avoid repeating the same file. """
|
||||
files = {self.fname}
|
||||
for sch in self.sheets:
|
||||
files.extend(sch.sheet.get_files())
|
||||
return files
|
||||
files.update(sch.sheet.get_files())
|
||||
return list(files)
|
||||
|
||||
def get_components(self, exclude_power=True):
|
||||
""" A list of all the components. """
|
||||
|
|
@ -1624,9 +1625,10 @@ class Schematic(object):
|
|||
""" Returns a list of file names created by save_variant() """
|
||||
fnames = [os.path.join(dest_dir, 'y.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')]
|
||||
# Sub-sheets
|
||||
for sch in self.sheets:
|
||||
fnames.append(os.path.join(dest_dir, sch.file.replace('/', '_')))
|
||||
sub_sheets = self.get_files()
|
||||
for sch in sub_sheets:
|
||||
sch = os.path.basename(sch)
|
||||
fnames.append(os.path.join(dest_dir, sch.replace('/', '_')))
|
||||
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'
|
||||
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):
|
||||
|
|
@ -552,12 +552,15 @@ def test_no_colorama(test_dir):
|
|||
ctx.search_err(r'\[31m.\[1mERROR:Testing 1 2 3')
|
||||
|
||||
|
||||
def check_test_v5_sch_deps(ctx, deps, extra=[]):
|
||||
assert len(deps) == 5+len(extra), deps
|
||||
def check_test_v5_sch_deps(ctx, deps, extra=[], in_output=False):
|
||||
assert len(deps) == 3+len(extra), deps
|
||||
dir = os.path.dirname(ctx.board_file)
|
||||
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']:
|
||||
assert os.path.abspath(os.path.join(dir, sch)) in deps_abs
|
||||
for sch in ['test_v5.sch', 'sub-sheet.sch', 'deeper.sch']:
|
||||
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:
|
||||
assert f in deps
|
||||
|
||||
|
|
@ -644,6 +647,13 @@ def test_makefile_1(test_dir):
|
|||
assert ctx.get_out_path(prj+'-erc.txt') in deps
|
||||
check_test_v5_sch_deps(ctx, targets[targets['run_erc']].split(' '))
|
||||
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
|
||||
deps = targets['3D'].split(' ')
|
||||
assert len(deps) == 1, deps
|
||||
|
|
|
|||
|
|
@ -102,6 +102,10 @@ outputs:
|
|||
comment: "Print schematic, internal name (PDF)"
|
||||
type: pdf_sch_print
|
||||
|
||||
- name: 'fake_sch'
|
||||
comment: "Schematic with variants applied"
|
||||
type: sch_variant
|
||||
|
||||
- name: 'archive'
|
||||
comment: 'Compressed files'
|
||||
type: compress
|
||||
|
|
|
|||
Loading…
Reference in New Issue