|
| 1 | +#!/usr/bin/env python |
| 2 | +""" |
| 3 | + mbed |
| 4 | + Copyright (c) 2017-2017 ARM Limited |
| 5 | +
|
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | +
|
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +
|
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | +""" |
| 18 | + |
| 19 | +import sys |
| 20 | +from os.path import join, abspath, dirname |
| 21 | +import unittest |
| 22 | + |
| 23 | +# Be sure that the tools directory is in the search path |
| 24 | +ROOT = abspath(join(dirname(__file__), "..", "..", "..")) |
| 25 | +sys.path.insert(0, ROOT) |
| 26 | + |
| 27 | +from tools.targets import TARGETS |
| 28 | +from tools.arm_pack_manager import Cache |
| 29 | + |
| 30 | +class TestTargets(unittest.TestCase): |
| 31 | + |
| 32 | + def test_device_name(self): |
| 33 | + """Assert device name is in a pack""" |
| 34 | + cache = Cache(True, True) |
| 35 | + named_targets = (target for target in TARGETS if |
| 36 | + hasattr(target, "device_name")) |
| 37 | + for target in named_targets: |
| 38 | + self.assertTrue(target.device_name in cache.index, |
| 39 | + "Target %s contains invalid device_name %s" % |
| 40 | + (target.name, target.device_name)) |
| 41 | + |
| 42 | +if __name__ == '__main__': |
| 43 | + unittest.main() |
0 commit comments