• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ARMmbed / mbed-os-tools / #457

24 Aug 2024 09:15PM UTC coverage: 0.0% (-59.9%) from 59.947%
#457

push

coveralls-python

web-flow
Merge 7c6dbce13 into c467d6f14

0 of 4902 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/mbed_os_tools/test/host_tests/detect_auto.py
1
# Copyright (c) 2018, Arm Limited and affiliates.
2
# SPDX-License-Identifier: Apache-2.0
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15

16
import re
×
17
from .. import BaseHostTest
×
18

19
class DetectPlatformTest(BaseHostTest):
×
20
    PATTERN_MICRO_NAME = "Target '(\w+)'"
×
21
    re_detect_micro_name = re.compile(PATTERN_MICRO_NAME)
×
22

23
    def result(self):
×
24
        raise NotImplementedError
×
25

26
    def test(self, selftest):
×
27
        result = True
×
28

29
        c = selftest.mbed.serial_readline() # {{start}} preamble
×
30
        if c is None:
×
31
           return selftest.RESULT_IO_SERIAL
×
32

33
        selftest.notify(c.strip())
×
34
        selftest.notify("HOST: Detecting target name...")
×
35

36
        c = selftest.mbed.serial_readline()
×
37
        if c is None:
×
38
            return selftest.RESULT_IO_SERIAL
×
39
        selftest.notify(c.strip())
×
40

41
        # Check for target name
42
        m = self.re_detect_micro_name.search(c)
×
43
        if m and len(m.groups()):
×
44
            micro_name = m.groups()[0]
×
45
            micro_cmp = selftest.mbed.options.micro == micro_name
×
46
            result = result and micro_cmp
×
47
            selftest.notify("HOST: MUT Target name '%s', expected '%s'... [%s]"% (micro_name,
×
48
                selftest.mbed.options.micro,
49
                "OK" if micro_cmp else "FAIL"))
50

51
        for i in range(0, 2):
×
52
            c = selftest.mbed.serial_readline()
×
53
            if c is None:
×
54
               return selftest.RESULT_IO_SERIAL
×
55
            selftest.notify(c.strip())
×
56

57
        return selftest.RESULT_SUCCESS if result else selftest.RESULT_FAILURE
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc