Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/migen
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 71a48446d9d4
Choose a base ref
...
head repository: m-labs/migen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 41a07f18c21b
Choose a head ref
  • 4 commits
  • 1 file changed
  • 2 contributors

Commits on Nov 14, 2017

  1. Copy the full SHA
    71915c5 View commit details
  2. 1
    Copy the full SHA
    210c4fd View commit details

Commits on Nov 16, 2017

  1. Copy the full SHA
    36e82d3 View commit details
  2. Merge pull request #86 from cr1901/plat-test

    Add Platform-specific tests
    jordens authored Nov 16, 2017
    Copy the full SHA
    41a07f1 View commit details
Showing with 46 additions and 0 deletions.
  1. +46 −0 migen/test/test_platform.py
46 changes: 46 additions & 0 deletions migen/test/test_platform.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import unittest
import importlib
import pkgutil
import tempfile

from migen import *
from migen.genlib.cdc import MultiReg
import migen.build.platforms


def _find_platforms(mod_root):
def mk_name(mod, child):
return ".".join([mod.__name__, child])

imports = []
for _, name, is_mod in pkgutil.walk_packages(mod_root.__path__):
if is_mod:
new_root = importlib.import_module(mk_name(mod_root, name))
imports.extend(_find_platforms(new_root))
else:
imports.append((mk_name(mod_root, name), name))
return imports


class TestModulePlatform(Module):
def __init__(self, plat):
# FIXME: Somehow incorporate plat.request() into this.
inp = Signal()
out = Signal()

self.specials += MultiReg(inp, out)


class TestExamplesPlatform(unittest.TestCase):
def test_platforms(self):
for mod, name in _find_platforms(migen.build.platforms):
with self.subTest(mod=mod, name=name):
# Roach has no default clock, so expect failure/skip.
if name == "roach":
pass
else:
plat = importlib.import_module(mod).Platform()
m = TestModulePlatform(plat)
with tempfile.TemporaryDirectory(name) as temp_dir:
plat.build(m, run=False, build_name=name,
build_dir=temp_dir)