Skip to content

Commit

Permalink
making TestInetLayer an executable tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Alami-Amine committed Jun 18, 2024
1 parent ab2907b commit d8cd5dc
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 296 deletions.
1 change: 1 addition & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
"${chip_root}/examples/shell/standalone:chip-shell",
"${chip_root}/src/app/tests/integration:chip-im-initiator",
"${chip_root}/src/app/tests/integration:chip-im-responder",
"${chip_root}/src/inet/tests:inet-layer-test-tool",
"${chip_root}/src/lib/address_resolve:address-resolve-tool",
"${chip_root}/src/messaging/tests/echo:chip-echo-requester",
"${chip_root}/src/messaging/tests/echo:chip-echo-responder",
Expand Down
77 changes: 44 additions & 33 deletions src/inet/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/nlfaultinjection.gni")
import("//build_overrides/pigweed.gni")

import("${chip_root}/build/chip/chip_test_suite.gni")
import("${chip_root}/build/chip/tests.gni")
import("${chip_root}/build/chip/tools.gni")
import("${chip_root}/src/platform/device.gni")
import("${chip_root}/src/system/system.gni")

if (chip_build_tests) {
import("${chip_root}/build/chip/chip_test_suite.gni")
}

config("tests_config") {
include_dirs = [ "." ]
}
Expand All @@ -40,55 +45,61 @@ static_library("helpers") {
"TestSetupSignallingPosix.cpp",
]

if (current_os != "mbed") {
sources += [ "TestInetLayer.cpp" ]
}
cflags = [ "-Wconversion" ]

public_deps = [
"${chip_root}/src/inet",
"${chip_root}/src/lib/core",
"${chip_root}/src/platform",
"${nlfaultinjection_root}:nlfaultinjection",
]

if (chip_with_nlfaultinjection) {
sources += [
"TestSetupFaultInjection.h",
"TestSetupFaultInjectionPosix.cpp",
]
public_deps += [ "${nlfaultinjection_root}:nlfaultinjection" ]
}
}

cflags = [ "-Wconversion" ]
if (chip_build_tests) {
chip_test_suite("tests") {
output_name = "libInetLayerTests"

public_deps = [
"${chip_root}/src/inet",
"${chip_root}/src/lib/core",
"${chip_root}/src/platform",
]
public_configs = [ ":tests_config" ]

public_deps = [
":helpers",
"${chip_root}/src/inet",
"${chip_root}/src/lib/core",
]
test_sources = [
"TestBasicPacketFilters.cpp",
"TestInetAddress.cpp",
"TestInetErrorStr.cpp",
]
sources = []

if (chip_system_config_use_sockets && current_os != "zephyr") {
test_sources += [ "TestInetEndPoint.cpp" ]
}

cflags = [ "-Wconversion" ]
}
}

chip_test_suite("tests") {
output_name = "libInetLayerTests"
executable("inet-layer-test-tool") {
sources = [ "inet-layer-test-tool.cpp" ]

public_configs = [ ":tests_config" ]
cflags = [ "-Wconversion" ]

public_deps = [
":helpers",
"${chip_root}/src/inet",
"${chip_root}/src/lib/core",
"${chip_root}/src/platform",
]
test_sources = [
"TestBasicPacketFilters.cpp",
"TestInetAddress.cpp",
"TestInetErrorStr.cpp",
]
sources = []

if (chip_system_config_use_sockets && current_os != "zephyr") {
test_sources += [ "TestInetEndPoint.cpp" ]
}

# This fails on Raspberry Pi (Linux arm64), so only enable on Linux
# x64.
if (current_os != "mac" && current_os != "zephyr" &&
chip_device_platform != "esp32" && current_cpu == "x64" &&
chip_device_platform != "ameba") {
# TODO: This test does not seem executed
sources += [ "TestLwIPDNS.cpp" ]
}

cflags = [ "-Wconversion" ]
output_dir = root_out_dir
}
4 changes: 2 additions & 2 deletions src/inet/tests/TestInetLayerCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ extern bool IsSender();
extern bool IsTesting(const TestStatus & aTestStatus);
extern bool WasSuccessful(const TestStatus & aTestStatus);

extern chip::System::PacketBufferHandle MakeDataBuffer(uint16_t aDesiredLength, uint8_t aFirstValue);
extern chip::System::PacketBufferHandle MakeDataBuffer(uint16_t aDesiredLength);
extern chip::System::PacketBufferHandle MakeDataBuffer(size_t aDesiredLength, uint8_t aFirstValue);
extern chip::System::PacketBufferHandle MakeDataBuffer(size_t aDesiredLength);
extern chip::System::PacketBufferHandle MakeICMPv4DataBuffer(uint16_t aDesiredUserLength);
extern chip::System::PacketBufferHandle MakeICMPv6DataBuffer(uint16_t aDesiredUserLength);

Expand Down
260 changes: 0 additions & 260 deletions src/inet/tests/TestLwIPDNS.cpp

This file was deleted.

Loading

0 comments on commit d8cd5dc

Please sign in to comment.