From cd4ca4916e876f83d551e76d143e3d0c1d67631a Mon Sep 17 00:00:00 2001 From: Daniel Schultz Date: Sat, 9 Jan 2021 21:11:45 +0100 Subject: [PATCH] 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 --- tests/test_util.py | 15 ++++++++++++--- utils/test_data/db/mapping/devices.yaml | 3 +++ utils/test_data/db/mapping/parts.yaml | 5 +++++ utils/test_data/db/mapping/resources.yaml | 10 ++++++++++ .../test_data/db/{xc7 => xc7a200t}/tilegrid.json | 0 .../{xc7 => xc7a200tffg1156-1}/package_pins.csv | 0 .../db/{xc7 => xc7a200tffg1156-1}/part.json | 0 utils/test_fasm2frames.py | 3 ++- 8 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 utils/test_data/db/mapping/devices.yaml create mode 100644 utils/test_data/db/mapping/parts.yaml create mode 100644 utils/test_data/db/mapping/resources.yaml rename utils/test_data/db/{xc7 => xc7a200t}/tilegrid.json (100%) rename utils/test_data/db/{xc7 => xc7a200tffg1156-1}/package_pins.csv (100%) rename utils/test_data/db/{xc7 => xc7a200tffg1156-1}/part.json (100%) diff --git a/tests/test_util.py b/tests/test_util.py index 2187630c..a82a73c3 100755 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -9,7 +9,7 @@ # # SPDX-License-Identifier: ISC -from os import environ, getcwd, chdir +from os import environ, getcwd, chdir, mkdir, environ import json from tempfile import TemporaryDirectory 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 # testing. environ['XRAY_DATABASE_ROOT'] = '.' -environ['XRAY_PART'] = './' +environ['XRAY_PART'] = 'xc7a200tffg1156-1' from prjxray.util import get_roi, get_db_root from prjxray.overlay import Overlay @@ -31,9 +31,18 @@ def setup_database(contents): with TemporaryDirectory() as d: olddir = getcwd() chdir(d) + mkdir('xc7a200t') + mkdir('mapping') + environ['XRAY_DATABASE_ROOT'] = d e = None - with open('tilegrid.json', 'w') as fd: + with open('xc7a200t/tilegrid.json', 'w') as 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: yield except Exception as ereal: diff --git a/utils/test_data/db/mapping/devices.yaml b/utils/test_data/db/mapping/devices.yaml new file mode 100644 index 00000000..3ebd25bb --- /dev/null +++ b/utils/test_data/db/mapping/devices.yaml @@ -0,0 +1,3 @@ +# device to fabric mapping +"xc7a200t": + fabric: "xc7a200t" diff --git a/utils/test_data/db/mapping/parts.yaml b/utils/test_data/db/mapping/parts.yaml new file mode 100644 index 00000000..4f37d241 --- /dev/null +++ b/utils/test_data/db/mapping/parts.yaml @@ -0,0 +1,5 @@ +# part number to device, package and speed grade mapping +"xc7a200tffg1156-1": + device: "xc7a200t" + package: "ffg1156" + speedgrade: "1" diff --git a/utils/test_data/db/mapping/resources.yaml b/utils/test_data/db/mapping/resources.yaml new file mode 100644 index 00000000..5ba91e90 --- /dev/null +++ b/utils/test_data/db/mapping/resources.yaml @@ -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" diff --git a/utils/test_data/db/xc7/tilegrid.json b/utils/test_data/db/xc7a200t/tilegrid.json similarity index 100% rename from utils/test_data/db/xc7/tilegrid.json rename to utils/test_data/db/xc7a200t/tilegrid.json diff --git a/utils/test_data/db/xc7/package_pins.csv b/utils/test_data/db/xc7a200tffg1156-1/package_pins.csv similarity index 100% rename from utils/test_data/db/xc7/package_pins.csv rename to utils/test_data/db/xc7a200tffg1156-1/package_pins.csv diff --git a/utils/test_data/db/xc7/part.json b/utils/test_data/db/xc7a200tffg1156-1/part.json similarity index 100% rename from utils/test_data/db/xc7/part.json rename to utils/test_data/db/xc7a200tffg1156-1/part.json diff --git a/utils/test_fasm2frames.py b/utils/test_fasm2frames.py index 931bb592..133c1710 100755 --- a/utils/test_fasm2frames.py +++ b/utils/test_fasm2frames.py @@ -79,7 +79,8 @@ class TestStringMethods(unittest.TestCase): fout = StringIO() 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()