Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002  * Copyright (c) 2017, ARM Limited, All Rights Reserved
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00006  * not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  * http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00013  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #if !defined(MBED_CONF_APP_TEST_WIFI)      || \
00019     !defined(MBED_CONF_APP_TEST_ETHERNET)  || \
00020     !defined(MBED_CONF_APP_ECHO_SERVER)    || \
00021     !defined(MBED_CONF_APP_WIFI_SCAN)      || \
00022     !defined(MBED_CONF_APP_WIFI_SSID )     || \
00023     !defined(MBED_CONF_APP_WIFI_SECURITY)  || \
00024     !defined(MBED_CONF_APP_WIFI_PASSWORD)
00025 #error [NOT_SUPPORTED] Requires parameters from mbed_app.json
00026 #endif
00027 
00028 #if !MBED_CONF_APP_TEST_WIFI && !MBED_CONF_APP_TEST_ETHERNET
00029 #error [NOT_SUPPORTED] Either wifi or ethernet testing need to be enabled
00030 #endif
00031 #if MBED_CONF_APP_TEST_WIFI
00032 #if !defined(TARGET_UBLOX_EVK_ODIN_W2) && !defined(TARGET_REALTEK_RTL8195AM)
00033 #error [NOT_SUPPORTED] Tests are valid only for UBLOX_EVK_ODIN_W2 and REALTEK_RTL8195AM
00034 #endif
00035 #endif
00036 #if MBED_CONF_APP_TEST_ETHERNET
00037 #error [NOT_SUPPORTED] Ethernet testing not supported
00038 #endif
00039 
00040 #include "greentea-client/test_env.h"
00041 #include "unity/unity.h"
00042 #include "utest.h"
00043 
00044 #include "emac_tests.h"
00045 #include "emac_util.h"
00046 
00047 using namespace utest::v1;
00048 
00049 // Test setup
00050 utest::v1::status_t test_setup(const size_t number_of_cases) {
00051 #if !MBED_CONF_APP_ECHO_SERVER
00052     GREENTEA_SETUP(600, "default_auto");
00053 #endif
00054     return verbose_test_setup_handler(number_of_cases);
00055 }
00056 
00057 Case cases[] = {
00058     Case("EMAC interface initialize", test_emac_initialize),
00059     Case("EMAC interface broadcast", test_emac_broadcast),
00060     Case("EMAC interface unicast", test_emac_unicast),
00061     Case("EMAC interface unicast frame length", test_emac_unicast_frame_len),
00062     Case("EMAC interface broadcast (run again)", test_emac_broadcast)
00063 };
00064 
00065 Specification specification(test_setup, cases);
00066 
00067 int main()
00068 {
00069     return !Harness::run(specification);
00070 }
00071