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