File: test_mcus.py

package info (click to toggle)
python-project-generator-definitions 0.2.46-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 780 kB
  • sloc: python: 1,053; makefile: 15; sh: 6
file content (67 lines) | stat: -rw-r--r-- 2,947 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Copyright 2015 0xc0170
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from unittest import TestCase

from project_generator_definitions.definitions import ProGenMcus

class TestAllMcus(TestCase):

    """test all targets"""

    def setUp(self):
        self.progen_mcus = ProGenMcus()
        self.mcus_list = self.progen_mcus.get_mcus()

    def test_mcu_validity(self):
        # Check for required info in mcu
        for mcu in self.mcus_list:
            mcu_rec = self.progen_mcus.get_mcu_record(mcu)
            assert mcu_rec['mcu']
            assert mcu_rec['mcu']['name'][0]
            assert mcu_rec['mcu']['core'][0]

    def test_mcu_tool_specific_uvision_validity(self):
        for target in self.mcus_list:
            mcu = self.progen_mcus.get_mcu_record(target)
            if 'tool_specific' in mcu:
                try:
                    for tool in mcu['tool_specific'].keys():
                        if tool == 'uvision':
                            assert mcu['tool_specific']['uvision']['TargetOption']
                            assert mcu['tool_specific']['uvision']['TargetOption']['Device'][0]
                            # DeviceId might be 0
                            assert mcu['tool_specific']['uvision']['TargetOption']['DeviceId'][0] != -1
                except KeyError:
                    pass

    def test_mcu_tool_specific_iar_validity(self):
        for mcu in self.mcus_list:
            mcu = self.progen_mcus.get_mcu_record(mcu)
            if 'tool_specific' in mcu:
                for tool in mcu['tool_specific'].keys():
                    if tool == 'iar' :
                        assert mcu['tool_specific']['iar']['OGChipSelectEditMenu']['state'][0]
                        assert mcu['tool_specific']['iar']['OGCoreOrChip']['state'][0]

    def test_mcu_tool_specific_coide_validity(self):
        for mcu in self.mcus_list:
            mcu = self.progen_mcus.get_mcu_record(mcu)
            if 'tool_specific' in mcu:
                for tool in mcu['tool_specific'].keys():
                    if tool == 'coide' :
                        assert mcu['tool_specific']['coide']['Device']['manufacturerName'][0]
                        assert mcu['tool_specific']['coide']['Device']['chipId'][0]
                        assert mcu['tool_specific']['coide']['Device']['chipName'][0]
                        assert mcu['tool_specific']['coide']['DebugOption']['defaultAlgorithm'][0]