Added tests for debug details in generated makefiles.
This commit is contained in:
parent
a49d4e45fa
commit
61855a2d8c
|
|
@ -598,13 +598,10 @@ def check_test_v5_sch_deps(ctx, deps, extra=[], in_output=False):
|
|||
assert os.path.relpath(ctx.yaml_file) in deps
|
||||
|
||||
|
||||
def test_makefile_1(test_dir):
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, 'test_makefile_1', prj, 'makefile_1', '')
|
||||
mkfile = ctx.get_out_path('Makefile')
|
||||
ctx.run(extra=['-s', 'all', 'archive'])
|
||||
ctx.run(extra=['-m', mkfile])
|
||||
def check_makefile(ctx, mkfile, prj, dbg, txt):
|
||||
ctx.expect_out_file('Makefile')
|
||||
res = ctx.search_in_file('Makefile', ['DEBUG=(.*)', txt])
|
||||
assert res[0][0] == dbg, res
|
||||
targets = ctx.read_mk_targets(mkfile)
|
||||
all = targets['all']
|
||||
phony = targets['.PHONY']
|
||||
|
|
@ -765,7 +762,26 @@ def test_makefile_1(test_dir):
|
|||
logging.debug('- Target `archive` OK')
|
||||
ctx.search_err(r'\(kibom_external\) \[kibom\] uses a name generated by the external tool')
|
||||
ctx.search_err(r'\(ibom_external\) \[ibom\] uses a name generated by the external tool')
|
||||
ctx.search_err(r'Wrong character in file name `(.*)/test_makefile_1/test_v5-top\$.svg')
|
||||
ctx.search_err(r'Wrong character in file name `(.*)/test_v5-top\$.svg')
|
||||
|
||||
|
||||
def test_makefile_1(test_dir):
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, 'test_makefile_1', prj, 'makefile_1', '')
|
||||
mkfile = ctx.get_out_path('Makefile')
|
||||
ctx.run(extra=['-s', 'all', 'archive'])
|
||||
ctx.run(extra=['-m', mkfile])
|
||||
check_makefile(ctx, mkfile, prj, '-v', r"^\t\$\(KIBOT_CMD\) -s (.*) -i$")
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_makefile_2(test_dir):
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, 'test_makefile_2', prj, 'makefile_1', '')
|
||||
mkfile = ctx.get_out_path('Makefile')
|
||||
ctx.run(extra=['-s', 'all', 'archive'])
|
||||
ctx.run(extra=['-m', mkfile], no_verbose=True)
|
||||
check_makefile(ctx, mkfile, prj, '', r"^\t@\$\(KIBOT_CMD\) -s (.*) -i 2>> \$\(LOGFILE\)$")
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import os
|
||||
import sys
|
||||
import re
|
||||
import pytest
|
||||
import coverage
|
||||
import logging
|
||||
|
|
@ -17,7 +18,7 @@ from kibot.layer import Layer
|
|||
from kibot.pre_base import BasePreFlight
|
||||
from kibot.out_base import BaseOutput
|
||||
from kibot.gs import GS
|
||||
from kibot.kiplot import load_actions, _import, load_board
|
||||
from kibot.kiplot import load_actions, _import, load_board, search_as_plugin
|
||||
from kibot.registrable import RegOutput, RegFilter
|
||||
from kibot.misc import (MISSING_TOOL, WRONG_INSTALL, BOM_ERROR, DRC_ERROR, ERC_ERROR, PDF_PCB_PRINT, CMD_PCBNEW_PRINT_LAYERS,
|
||||
KICAD2STEP_ERR)
|
||||
|
|
@ -276,3 +277,24 @@ def test_unknown_prefix(caplog):
|
|||
with context.cover_it(cov):
|
||||
get_prefix('y')
|
||||
assert 'Unknown prefix, please report' in caplog.text
|
||||
|
||||
|
||||
def test_search_as_plugin_ok(test_dir, caplog):
|
||||
with context.cover_it(cov):
|
||||
detect_kicad()
|
||||
load_actions()
|
||||
dir_fake = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'data')
|
||||
GS.kicad_plugins_dirs.append(dir_fake)
|
||||
fname = search_as_plugin('fake', ['fake_plugin'])
|
||||
assert re.search(r"Using `(.*)data/fake_plugin/fake` for `fake` \(fake_plugin\)", caplog.text) is not None
|
||||
assert re.search(r"(.*)data/fake_plugin/fake", fname) is not None
|
||||
|
||||
|
||||
def test_search_as_plugin_fail(test_dir, caplog):
|
||||
with context.cover_it(cov):
|
||||
detect_kicad()
|
||||
load_actions()
|
||||
dir_fake = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'data')
|
||||
GS.kicad_plugins_dirs.append(dir_fake)
|
||||
fname = search_as_plugin('fake', [''])
|
||||
assert fname == 'fake'
|
||||
|
|
|
|||
Loading…
Reference in New Issue