Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SOCKET_BIND_PORT.py
00001 """ 00002 Copyright 2018 ARM Limited 00003 Licensed under the Apache License, Version 2.0 (the "License"); 00004 you may not use this file except in compliance with the License. 00005 You may obtain a copy of the License at 00006 00007 http://www.apache.org/licenses/LICENSE-2.0 00008 00009 Unless required by applicable law or agreed to in writing, software 00010 distributed under the License is distributed on an "AS IS" BASIS, 00011 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00012 See the License for the specific language governing permissions and 00013 limitations under the License. 00014 """ 00015 from icetea_lib.bench import Bench 00016 from icetea_lib.tools import test_case 00017 00018 00019 class MultipleTestcase(Bench): 00020 def __init__(self, **kwargs): 00021 testcase_args = { 00022 'status': "released", 00023 'component': ["mbed-os", "netsocket"], 00024 'type': "smoke", 00025 'subtype': "socket", 00026 'requirements': { 00027 "duts": { 00028 "*": { 00029 "count": 1, 00030 "type": "hardware", 00031 "application": {"name": "TEST_APPS-device-socket_app"} 00032 }, 00033 "1": {"nick": "dut1"}, 00034 } 00035 } 00036 } 00037 00038 testcase_args.update(kwargs) 00039 Bench.__init__(self, **testcase_args) 00040 00041 def setup(self): 00042 self.command("dut1", "ifup") 00043 00044 def socket_bind_port(self, socket_type): 00045 response = self.command("dut1", "socket new " + socket_type) 00046 socket_id = int(response.parsed['socket_id']) 00047 00048 self.command("dut1", "socket " + str(socket_id) + " open") 00049 00050 self.command("dut1", "socket " + str(socket_id) + " bind port 1024") 00051 00052 self.command("dut1", "socket " + str(socket_id) + " delete") 00053 00054 def teardown(self): 00055 self.command("dut1", "ifdown") 00056 00057 00058 @test_case(MultipleTestcase, 00059 name="TCPSOCKET_BIND_PORT", 00060 title="tcpsocket open and bind port", 00061 purpose="Verify TCPSocket can be created, opened and port binded") 00062 def test1(self): 00063 self.socket_bind_port("TCPSocket") 00064 00065 00066 @test_case(MultipleTestcase, 00067 name="UDPSOCKET_BIND_PORT", 00068 title="udpsocket open and bind port", 00069 purpose="Verify UDPSocket can be created, opened and port binded") 00070 def test2(self): 00071 self.socket_bind_port("UDPSocket")
Generated on Tue Aug 9 2022 00:37:19 by
1.7.2