![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/TEST_APPS/testcases/netsocket/SOCKET_BIND_PORT.py@0:8fdf9a60065b, 2018-10-10 (annotated)
- Committer:
- kadonotakashi
- Date:
- Wed Oct 10 00:33:53 2018 +0000
- Revision:
- 0:8fdf9a60065b
how to make mbed librry
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kadonotakashi | 0:8fdf9a60065b | 1 | """ |
kadonotakashi | 0:8fdf9a60065b | 2 | Copyright 2018 ARM Limited |
kadonotakashi | 0:8fdf9a60065b | 3 | Licensed under the Apache License, Version 2.0 (the "License"); |
kadonotakashi | 0:8fdf9a60065b | 4 | you may not use this file except in compliance with the License. |
kadonotakashi | 0:8fdf9a60065b | 5 | You may obtain a copy of the License at |
kadonotakashi | 0:8fdf9a60065b | 6 | |
kadonotakashi | 0:8fdf9a60065b | 7 | http://www.apache.org/licenses/LICENSE-2.0 |
kadonotakashi | 0:8fdf9a60065b | 8 | |
kadonotakashi | 0:8fdf9a60065b | 9 | Unless required by applicable law or agreed to in writing, software |
kadonotakashi | 0:8fdf9a60065b | 10 | distributed under the License is distributed on an "AS IS" BASIS, |
kadonotakashi | 0:8fdf9a60065b | 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kadonotakashi | 0:8fdf9a60065b | 12 | See the License for the specific language governing permissions and |
kadonotakashi | 0:8fdf9a60065b | 13 | limitations under the License. |
kadonotakashi | 0:8fdf9a60065b | 14 | """ |
kadonotakashi | 0:8fdf9a60065b | 15 | from icetea_lib.bench import Bench |
kadonotakashi | 0:8fdf9a60065b | 16 | from icetea_lib.tools import test_case |
kadonotakashi | 0:8fdf9a60065b | 17 | |
kadonotakashi | 0:8fdf9a60065b | 18 | |
kadonotakashi | 0:8fdf9a60065b | 19 | class MultipleTestcase(Bench): |
kadonotakashi | 0:8fdf9a60065b | 20 | def __init__(self, **kwargs): |
kadonotakashi | 0:8fdf9a60065b | 21 | testcase_args = { |
kadonotakashi | 0:8fdf9a60065b | 22 | 'status': "released", |
kadonotakashi | 0:8fdf9a60065b | 23 | 'component': ["mbed-os", "netsocket"], |
kadonotakashi | 0:8fdf9a60065b | 24 | 'type': "smoke", |
kadonotakashi | 0:8fdf9a60065b | 25 | 'subtype': "socket", |
kadonotakashi | 0:8fdf9a60065b | 26 | 'requirements': { |
kadonotakashi | 0:8fdf9a60065b | 27 | "duts": { |
kadonotakashi | 0:8fdf9a60065b | 28 | "*": { |
kadonotakashi | 0:8fdf9a60065b | 29 | "count": 1, |
kadonotakashi | 0:8fdf9a60065b | 30 | "type": "hardware", |
kadonotakashi | 0:8fdf9a60065b | 31 | "application": {"name": "TEST_APPS-device-socket_app"} |
kadonotakashi | 0:8fdf9a60065b | 32 | }, |
kadonotakashi | 0:8fdf9a60065b | 33 | "1": {"nick": "dut1"}, |
kadonotakashi | 0:8fdf9a60065b | 34 | } |
kadonotakashi | 0:8fdf9a60065b | 35 | } |
kadonotakashi | 0:8fdf9a60065b | 36 | } |
kadonotakashi | 0:8fdf9a60065b | 37 | |
kadonotakashi | 0:8fdf9a60065b | 38 | testcase_args.update(kwargs) |
kadonotakashi | 0:8fdf9a60065b | 39 | Bench.__init__(self, **testcase_args) |
kadonotakashi | 0:8fdf9a60065b | 40 | |
kadonotakashi | 0:8fdf9a60065b | 41 | def setup(self): |
kadonotakashi | 0:8fdf9a60065b | 42 | self.command("dut1", "ifup") |
kadonotakashi | 0:8fdf9a60065b | 43 | |
kadonotakashi | 0:8fdf9a60065b | 44 | def socket_bind_port(self, socket_type): |
kadonotakashi | 0:8fdf9a60065b | 45 | response = self.command("dut1", "socket new " + socket_type) |
kadonotakashi | 0:8fdf9a60065b | 46 | socket_id = int(response.parsed['socket_id']) |
kadonotakashi | 0:8fdf9a60065b | 47 | |
kadonotakashi | 0:8fdf9a60065b | 48 | self.command("dut1", "socket " + str(socket_id) + " open") |
kadonotakashi | 0:8fdf9a60065b | 49 | |
kadonotakashi | 0:8fdf9a60065b | 50 | self.command("dut1", "socket " + str(socket_id) + " bind port 1024") |
kadonotakashi | 0:8fdf9a60065b | 51 | |
kadonotakashi | 0:8fdf9a60065b | 52 | self.command("dut1", "socket " + str(socket_id) + " delete") |
kadonotakashi | 0:8fdf9a60065b | 53 | |
kadonotakashi | 0:8fdf9a60065b | 54 | def teardown(self): |
kadonotakashi | 0:8fdf9a60065b | 55 | self.command("dut1", "ifdown") |
kadonotakashi | 0:8fdf9a60065b | 56 | |
kadonotakashi | 0:8fdf9a60065b | 57 | |
kadonotakashi | 0:8fdf9a60065b | 58 | @test_case(MultipleTestcase, |
kadonotakashi | 0:8fdf9a60065b | 59 | name="TCPSOCKET_BIND_PORT", |
kadonotakashi | 0:8fdf9a60065b | 60 | title="tcpsocket open and bind port", |
kadonotakashi | 0:8fdf9a60065b | 61 | purpose="Verify TCPSocket can be created, opened and port binded") |
kadonotakashi | 0:8fdf9a60065b | 62 | def test1(self): |
kadonotakashi | 0:8fdf9a60065b | 63 | self.socket_bind_port("TCPSocket") |
kadonotakashi | 0:8fdf9a60065b | 64 | |
kadonotakashi | 0:8fdf9a60065b | 65 | |
kadonotakashi | 0:8fdf9a60065b | 66 | @test_case(MultipleTestcase, |
kadonotakashi | 0:8fdf9a60065b | 67 | name="UDPSOCKET_BIND_PORT", |
kadonotakashi | 0:8fdf9a60065b | 68 | title="udpsocket open and bind port", |
kadonotakashi | 0:8fdf9a60065b | 69 | purpose="Verify UDPSocket can be created, opened and port binded") |
kadonotakashi | 0:8fdf9a60065b | 70 | def test2(self): |
kadonotakashi | 0:8fdf9a60065b | 71 | self.socket_bind_port("UDPSocket") |