Skip to content

Commit

Permalink
Reactivate EMAC Greentea test (#378)
Browse files Browse the repository at this point in the history
* Migrate emac test code into a library

* Build passes now!

* Fix STLINK bug, update README

* Reduce verbosity a bit

* Formatting

* Fix licenses
  • Loading branch information
multiplemonomials authored Oct 30, 2024
1 parent 197e043 commit e72b38a
Show file tree
Hide file tree
Showing 38 changed files with 474 additions and 964 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/basic_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -90,7 +90,7 @@ jobs:
steps:

- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
steps:

- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
Expand Down Expand Up @@ -216,7 +216,7 @@ jobs:
steps:
-
name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -244,7 +244,7 @@ jobs:
steps:
-
name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install python3-venv
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/greentea_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install python3-venv
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_building_multiple_executables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
container: ghcr.io/armmbed/mbed-os-env:master-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python packages
# Note: pip>=20.3 is needed to install dependencies of cysecuretools
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ Arm Mbed OS is an open source embedded operating system designed specifically fo
Mbed OS provides a platform that includes:

- Security foundations.
- Cloud management services.
- Drivers for sensors, I/O devices and connectivity.
- Embedded networking libraries, e.g Wi-Fi and Ethernet drivers and network libraries using them
- Drivers for microcontroller hardware features, including digital and analog I/O, PWM, and communications busses
- Storage features, including file system and block device abstractions and low-level drivers

This is Mbed OS Community Edition (CE), a fork focused on improving the build system and tooling, fixing bugs, and keeping maintenance going after ARM's step back from the Mbed project.

Expand Down
2 changes: 2 additions & 0 deletions connectivity/libraries/nanostack-libservice/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ target_sources(mbed-nanostack-libservice
source/nvmHelper/ns_nvm_helper.c
)

target_link_libraries(mbed-nanostack-libservice PUBLIC mbed-nanostack-hal_mbed_cmsis_rtos)

# The definition, source files and include directories below
# are needed by mbed-trace which is part of the mbed-core CMake target
target_compile_definitions(mbed-core-flags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
#ifndef ARM_HAL_INTERRUPT_PRIVATE_H_
#define ARM_HAL_INTERRUPT_PRIVATE_H_

#ifdef __cplusplus
extern "C" {
#endif

void platform_critical_init(void);

#ifdef __cplusplus
}
#endif

#endif
2 changes: 2 additions & 0 deletions connectivity/netsocket/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_subdirectory(tests/emac_test_utils)

if(MBED_ENABLE_OS_INTERNAL_TESTS)
if(MBED_BUILD_GREENTEA_TESTS)
add_subdirectory(tests/TESTS)
Expand Down
1 change: 1 addition & 0 deletions connectivity/netsocket/tests/TESTS/network/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
add_subdirectory(emac)
add_subdirectory(interface)
add_subdirectory(wifi)
24 changes: 9 additions & 15 deletions connectivity/netsocket/tests/TESTS/network/emac/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)

set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../.. CACHE INTERNAL "")
set(TEST_TARGET mbed-connectivity-netsocket-network-emac)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})
if(NOT "MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE=WIFI" IN_LIST MBED_CONFIG_DEFINITIONS AND
NOT "MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE=ETHERNET" IN_LIST MBED_CONFIG_DEFINITIONS)
set(TEST_SKIPPED "Requires wi-fi or ethernet to be the default network interface")
endif()

list(
APPEND
TEST_SOURCE_LIST
main.cpp
emac_TestMemoryManager.cpp
emac_TestNetworkStack.cpp
emac_ctp.cpp
emac_membuf.cpp
emac_test_broadcast.cpp
emac_test_initialize.cpp
emac_test_memory.cpp
Expand All @@ -26,14 +18,16 @@ list(
emac_test_unicast_burst.cpp
emac_test_unicast_frame_len.cpp
emac_test_unicast_long.cpp
emac_util.cpp
)

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-connectivity-network-emac
TEST_SOURCES
${TEST_SOURCE_LIST}
TEST_REQUIRED_LIBS
mbed-emac
mbed-netsocket
mbed-emac-test-utils
TEST_SKIPPED
${TEST_SKIPPED}
)
24 changes: 1 addition & 23 deletions connectivity/netsocket/tests/TESTS/network/emac/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This document describes how to run EMAC tests. The EMAC test cases are made usin

## Configuring the CTP echo server

To configure a device to be a CTP echo server, you need to enable the `echo-server` setting in the `json` file of the test environment application. When you configure a device to be a CTP echo server, it starts to forward CTP messages automatically when it is on and continues to do so until you switch it off.
To configure a device to be a CTP echo server, you need to flash it with the [mbed-ethernet-ctp-server](https://github.com/mbed-ce/mbed-ethernet-ctp-server) application. When you configure a device to be a CTP echo server, it starts to forward CTP messages automatically when it is on and continues to do so until you switch it off.

## Other configuration options

Expand Down Expand Up @@ -56,28 +56,6 @@ Please refer to the following table for priorities of test cases. Priorities are

## Example commands

### CTP echo server

You can use the following command to a build CTP echo server:

`mbed test --compile -m TARGET -t GCC_ARM -v -n tests-network-emac --app-config TESTS/network/emac/template_mbed_app_echo_server.txt`

Replace TARGET with the target device. After building, flash the binary to the CTP echo server device.

You can verify that the CTP echo server has started properly by making a terminal connection to the device, resetting it and verifying that `echo server started successfully` prints on the terminal. You can run host tests when the CTP echo server is running on the Ethernet segment.

For Wi-Fi tests, the CTP echo server can also run on the ethernet side as long as the network configuration is such that Ethernet frames are routed between Wi-Fi and Ethernet.

The CTP echo server sends a 100-byte long broadcast CTP Ethernet frame every 60 seconds to inform the network of its presence.

### Running tests

You can use the following command to run tests:

`mbed test --compile --run -m TARGET -t GCC_ARM -v -n tests-network-emac --app-config TESTS/network/emac/template_mbed_app.txt`

Replace TARGET with the target device.

## Traces

Test cases have different trace levels based on how much tracing can be done without affecting the performance of the test case. Configure tracing using `SET\_TRACE\_LEVEL` macro.
Expand Down
Loading

0 comments on commit e72b38a

Please sign in to comment.