Added some compress tests.
Covers zip, tr.bz2 and rar creation for internal BoM, position and gerber files.
This commit is contained in:
parent
d422d380af
commit
c4c33af680
|
|
@ -66,10 +66,11 @@ def test_gerber_inner_ok():
|
|||
prj = 'good-project'
|
||||
ctx = context.TestContext('Gerber_Inner', prj, 'gerber_inner', GERBER_DIR)
|
||||
ctx.run()
|
||||
|
||||
ctx.expect_out_file(os.path.join(GERBER_DIR, prj+'_GND_Cu.gbr'))
|
||||
ctx.expect_out_file(os.path.join(GERBER_DIR, prj+'_Signal1.gbr'))
|
||||
ctx.expect_out_file(os.path.join(GERBER_DIR, 'test-'+prj+'.gbrjob'))
|
||||
files = [prj+'_GND_Cu.gbr', prj+'_Signal1.gbr', 'test-'+prj+'.gbrjob']
|
||||
files = [os.path.join(GERBER_DIR, f) for f in files]
|
||||
for f in files:
|
||||
ctx.expect_out_file(f)
|
||||
ctx.test_compress(prj+'-result.rar', files)
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1351,6 +1351,7 @@ def test_int_bom_fil_2():
|
|||
rows, header, info = ctx.load_csv('virtual.csv')
|
||||
check_kibom_test_netlist(rows, ref_column, 2, None, ['R1-R2', 'C1-C2'])
|
||||
ctx.search_err(r".?R3.? component in board, but not in schematic")
|
||||
ctx.test_compress(prj+'-result.zip', ['BoM/smd.csv', 'BoM/tht.csv', 'BoM/virtual.csv'])
|
||||
ctx.clean_up(keep_project=True)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -188,14 +188,18 @@ def test_position_variant_t2i():
|
|||
prj = 'kibom-variant_3'
|
||||
ctx = context.TestContext('test_position_variant_t2i', prj, 'simple_position_t2i', POS_DIR)
|
||||
ctx.run()
|
||||
rows, header, info = ctx.load_csv(prj+'-both_pos.csv')
|
||||
files = ['-both_pos.csv', '-both_pos_[2].csv', '-both_pos_(production).csv', '-both_pos_(test).csv']
|
||||
files = [prj+f for f in files]
|
||||
rows, header, info = ctx.load_csv(files[0])
|
||||
check_comps(rows, ['R1', 'R2', 'R3'])
|
||||
rows, header, info = ctx.load_csv(prj+'-both_pos_[2].csv')
|
||||
rows, header, info = ctx.load_csv(files[1])
|
||||
check_comps(rows, ['R1', 'R2', 'R3'])
|
||||
rows, header, info = ctx.load_csv(prj+'-both_pos_(production).csv')
|
||||
rows, header, info = ctx.load_csv(files[2])
|
||||
check_comps(rows, ['C2', 'R1', 'R2', 'R3'])
|
||||
rows, header, info = ctx.load_csv(prj+'-both_pos_(test).csv')
|
||||
rows, header, info = ctx.load_csv(files[3])
|
||||
check_comps(rows, ['C1', 'C2', 'R1', 'R3'])
|
||||
files = [POS_DIR+'/'+f for f in files]
|
||||
ctx.test_compress(prj+'-result.tar.bz2', files)
|
||||
ctx.clean_up(keep_project=True)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -651,6 +651,24 @@ class TestContext(object):
|
|||
headers = rows.pop(0)
|
||||
return rows, headers, sh_head
|
||||
|
||||
def test_compress(self, fname, files):
|
||||
logging.debug('Checking compressed output: '+fname)
|
||||
if fname.endswith('.zip'):
|
||||
cmd = ['unzip', '-t', self.get_out_path(fname)]
|
||||
elif fname.endswith('.rar'):
|
||||
cmd = ['rar', 't', self.get_out_path(fname)]
|
||||
else:
|
||||
cmd = ['tar', 'tvf', self.get_out_path(fname)]
|
||||
res = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
||||
text = res.decode()
|
||||
if fname.endswith('.zip'):
|
||||
assert 'No errors detected' in text
|
||||
elif fname.endswith('.rar'):
|
||||
assert 'All OK' in text
|
||||
for f in files:
|
||||
assert f in text, f
|
||||
logging.debug('- `'+f+'` OK')
|
||||
|
||||
|
||||
class TestContextSCH(TestContext):
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ kibot:
|
|||
version: 1
|
||||
|
||||
outputs:
|
||||
|
||||
- name: 'gerbers'
|
||||
comment: "Gerbers for the Gerber god"
|
||||
type: gerber
|
||||
|
|
@ -38,3 +37,11 @@ outputs:
|
|||
suffix: Signal1
|
||||
description: 'Inner signals 1'
|
||||
|
||||
- name: result
|
||||
comment: Test rar compress
|
||||
type: compress
|
||||
options:
|
||||
format: RAR
|
||||
files:
|
||||
- from_output: gerbers
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ outputs:
|
|||
use_alt: true
|
||||
exclude_filter: 'no tht'
|
||||
|
||||
- name: 'no smd'
|
||||
- name: 'virtual'
|
||||
comment: "BoM no virtual"
|
||||
type: bom
|
||||
dir: BoM
|
||||
|
|
@ -46,3 +46,11 @@ outputs:
|
|||
use_alt: true
|
||||
exclude_filter: 'no virtual'
|
||||
|
||||
- name: result
|
||||
comment: Test zip compress
|
||||
type: compress
|
||||
options:
|
||||
files:
|
||||
- from_output: 'no smd'
|
||||
- from_output: 'no tht'
|
||||
- from_output: 'virtual'
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ variants:
|
|||
variants_whitelist: T1, Default
|
||||
|
||||
outputs:
|
||||
- name: 'bom_internal'
|
||||
- name: 'pos_internal'
|
||||
comment: "Bill of Materials in CSV format"
|
||||
type: position
|
||||
dir: positiondir
|
||||
|
|
@ -37,7 +37,7 @@ outputs:
|
|||
only_smd: false
|
||||
variant: default
|
||||
|
||||
- name: 'bom_internal2'
|
||||
- name: 'pos_internal2'
|
||||
comment: "Bill of Materials in CSV format (2)"
|
||||
type: position
|
||||
dir: positiondir
|
||||
|
|
@ -47,7 +47,7 @@ outputs:
|
|||
only_smd: false
|
||||
variant: default2
|
||||
|
||||
- name: 'bom_internal_production'
|
||||
- name: 'pos_internal_production'
|
||||
comment: "Bill of Materials in CSV format for production"
|
||||
type: position
|
||||
dir: positiondir
|
||||
|
|
@ -57,7 +57,7 @@ outputs:
|
|||
only_smd: false
|
||||
variant: production
|
||||
|
||||
- name: 'bom_internal_test'
|
||||
- name: 'pos_internal_test'
|
||||
comment: "Bill of Materials in CSV format for test"
|
||||
type: position
|
||||
dir: positiondir
|
||||
|
|
@ -66,3 +66,15 @@ outputs:
|
|||
separate_files_for_front_and_back: false
|
||||
only_smd: false
|
||||
variant: test
|
||||
|
||||
- name: result
|
||||
comment: Test tarball compress
|
||||
type: compress
|
||||
options:
|
||||
format: TAR
|
||||
compression: bzip2
|
||||
files:
|
||||
- from_output: pos_internal
|
||||
- from_output: pos_internal2
|
||||
- from_output: pos_internal_production
|
||||
- from_output: pos_internal_test
|
||||
|
|
|
|||
Loading…
Reference in New Issue