Update tests to fabric refactoring

Since the tilegrid.json file is not anymore placed inside the part directory,
the test needs to be updated slightly to work with the new structure.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
This commit is contained in:
Daniel Schultz 2021-01-09 21:11:45 +01:00
parent e986737252
commit cd4ca4916e
8 changed files with 32 additions and 4 deletions

View File

@ -9,7 +9,7 @@
# #
# SPDX-License-Identifier: ISC # SPDX-License-Identifier: ISC
from os import environ, getcwd, chdir from os import environ, getcwd, chdir, mkdir, environ
import json import json
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
from contextlib import contextmanager from contextlib import contextmanager
@ -19,7 +19,7 @@ from unittest import TestCase, main
# in the current subdirectory, which will be a temporary one, to allow concurent # in the current subdirectory, which will be a temporary one, to allow concurent
# testing. # testing.
environ['XRAY_DATABASE_ROOT'] = '.' environ['XRAY_DATABASE_ROOT'] = '.'
environ['XRAY_PART'] = './' environ['XRAY_PART'] = 'xc7a200tffg1156-1'
from prjxray.util import get_roi, get_db_root from prjxray.util import get_roi, get_db_root
from prjxray.overlay import Overlay from prjxray.overlay import Overlay
@ -31,9 +31,18 @@ def setup_database(contents):
with TemporaryDirectory() as d: with TemporaryDirectory() as d:
olddir = getcwd() olddir = getcwd()
chdir(d) chdir(d)
mkdir('xc7a200t')
mkdir('mapping')
environ['XRAY_DATABASE_ROOT'] = d
e = None e = None
with open('tilegrid.json', 'w') as fd: with open('xc7a200t/tilegrid.json', 'w') as fd:
json.dump(contents, fd) json.dump(contents, fd)
# Create some dummy data
with open('mapping/devices.yaml', 'w') as fd:
json.dump({'xc7a200t': {'fabric': "xc7a200t"}}, fd)
with open('mapping/parts.yaml', 'w') as fd:
json.dump({'xc7a200tffg1156-1': {"device": "xc7a200t"}}, fd)
try: try:
yield yield
except Exception as ereal: except Exception as ereal:

View File

@ -0,0 +1,3 @@
# device to fabric mapping
"xc7a200t":
fabric: "xc7a200t"

View File

@ -0,0 +1,5 @@
# part number to device, package and speed grade mapping
"xc7a200tffg1156-1":
device: "xc7a200t"
package: "ffg1156"
speedgrade: "1"

View File

@ -0,0 +1,10 @@
# part number to pins
"xc7a200tffg1156-1":
pins:
0: "R26"
1: "P26"
2: "N26"
3: "M27"
4: "U25"
5: "T25"
6: "P24"

View File

@ -79,7 +79,8 @@ class TestStringMethods(unittest.TestCase):
fout = StringIO() fout = StringIO()
fasm2frames.run( fasm2frames.run(
self.filename_test_data('db'), "xc7", fin.name, fout, **kw) self.filename_test_data('db'), "xc7a200tffg1156-1", fin.name,
fout, **kw)
return fout.getvalue() return fout.getvalue()