mirror of
https://github.com/espressif/openthread.git
synced 2026-08-31 22:39:54 +00:00
+7
-1
@@ -10,4 +10,10 @@ clone_depth: 10
|
||||
build:
|
||||
project: etc/visual-studio/openthread.sln
|
||||
verbosity: minimal
|
||||
test: off
|
||||
test_script:
|
||||
- cmd: >-
|
||||
set Platform2=%Platform%
|
||||
|
||||
if %Platform2%==x86 set Platform2=Win32
|
||||
|
||||
vstest.console /logger:Appveyor /inIsolation /platform:%Platform% build\bin\%Platform2%\%Configuration%\dll\UnitTests.dll
|
||||
@@ -0,0 +1,194 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{FD64BF17-8D36-4578-8D13-77B123BE30D3}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>UnitTests</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>..\..\build\bin\$(Platform)\$(Configuration)\dll\</OutDir>
|
||||
<IntDir>..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>..\..\build\bin\$(Platform)\$(Configuration)\dll\</OutDir>
|
||||
<IntDir>..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>..\..\build\bin\$(Platform)\$(Configuration)\dll\</OutDir>
|
||||
<IntDir>..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>..\..\build\bin\$(Platform)\$(Configuration)\dll\</OutDir>
|
||||
<IntDir>..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;..\..\include;..\..\src;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<UseFullPaths>true</UseFullPaths>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>..\..\build\bin\$(Platform)\$(Configuration)\lib\libopenthread.lib;..\..\build\bin\$(Platform)\$(Configuration)\lib\mbedtls.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;..\..\include;..\..\src;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<UseFullPaths>true</UseFullPaths>
|
||||
<PrecompiledHeaderFile />
|
||||
<PrecompiledHeaderOutputFile />
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>..\..\build\bin\$(Platform)\$(Configuration)\lib\libopenthread.lib;..\..\build\bin\$(Platform)\$(Configuration)\lib\mbedtls.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;..\..\include;..\..\src;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<UseFullPaths>true</UseFullPaths>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>..\..\build\bin\$(Platform)\$(Configuration)\lib\libopenthread.lib;..\..\build\bin\$(Platform)\$(Configuration)\lib\mbedtls.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;..\..\include;..\..\src;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<UseFullPaths>true</UseFullPaths>
|
||||
<PrecompiledHeaderFile />
|
||||
<PrecompiledHeaderOutputFile />
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>..\..\build\bin\$(Platform)\$(Configuration)\lib\libopenthread.lib;..\..\build\bin\$(Platform)\$(Configuration)\lib\mbedtls.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\tests\unit\test_aes.cpp" />
|
||||
<ClCompile Include="..\..\tests\unit\test_hmac_sha256.cpp" />
|
||||
<ClCompile Include="..\..\tests\unit\test_link_quality.cpp" />
|
||||
<ClCompile Include="..\..\tests\unit\test_lowpan.cpp" />
|
||||
<ClCompile Include="..\..\tests\unit\test_mac_frame.cpp" />
|
||||
<ClCompile Include="..\..\tests\unit\test_message.cpp" />
|
||||
<ClCompile Include="..\..\tests\unit\test_platform.cpp" />
|
||||
<ClCompile Include="..\..\tests\unit\test_timer.cpp" />
|
||||
<ClCompile Include="..\..\tests\unit\test_toolchain.cpp" />
|
||||
<ClCompile Include="..\..\tests\unit\test_util.cpp" />
|
||||
<ClCompile Include="..\..\tests\unit\test_vector.c" />
|
||||
<ClCompile Include="..\..\tests\unit\test_windows.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\tests\unit\test_util.h" />
|
||||
<ClInclude Include="..\..\tests\unit\test_util.hpp" />
|
||||
<ClInclude Include="..\..\tests\unit\test_vector.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="libopenthread.vcxproj">
|
||||
<Project>{dd5018be-54c6-4fd4-9f8d-08d52fc0cd40}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="mbedtls.vcxproj">
|
||||
<Project>{4111c8bb-d354-4348-ad3c-eb6832e84831}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\tests\unit\test_vector.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\tests\unit\test_aes.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\tests\unit\test_hmac_sha256.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\tests\unit\test_link_quality.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\tests\unit\test_lowpan.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\tests\unit\test_mac_frame.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\tests\unit\test_message.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\tests\unit\test_timer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\tests\unit\test_toolchain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\tests\unit\test_util.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\tests\unit\test_windows.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\tests\unit\test_platform.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\tests\unit\test_util.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\tests\unit\test_util.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\tests\unit\test_vector.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -3,6 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config files", "config files", "{53F4EEF6-B96D-4887-B9CF-CD21E8BECD15}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
..\..\.appveyor.yml = ..\..\.appveyor.yml
|
||||
..\..\.codecov.yml = ..\..\.codecov.yml
|
||||
..\..\.travis.yml = ..\..\.travis.yml
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{95BD0669-04C8-4EEB-B3CC-0535B03F4468}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{35F6AB71-5BD2-4D53-8A51-D75CCD4CCC3D}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "third_party", "third_party", "{873E9D16-2A08-41FC-B301-79C95B3A8F98}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libopenthread", "libopenthread.vcxproj", "{DD5018BE-54C6-4FD4-9F8D-08D52FC0CD40}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libopenthread_k", "libopenthread_k.vcxproj", "{9B33C190-5D07-40BF-9536-68843DC5D7AF}"
|
||||
@@ -11,16 +24,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mbedtls", "mbedtls.vcxproj"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mbedtls_k", "mbedtls_k.vcxproj", "{69BE8E8C-CF1E-46D6-932B-DB435F47059B}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{95BD0669-04C8-4EEB-B3CC-0535B03F4468}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "third_party", "third_party", "{873E9D16-2A08-41FC-B301-79C95B3A8F98}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config files", "config files", "{53F4EEF6-B96D-4887-B9CF-CD21E8BECD15}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
..\..\.appveyor.yml = ..\..\.appveyor.yml
|
||||
..\..\.codecov.yml = ..\..\.codecov.yml
|
||||
..\..\.travis.yml = ..\..\.travis.yml
|
||||
EndProjectSection
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests", "UnitTests.vcxproj", "{FD64BF17-8D36-4578-8D13-77B123BE30D3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -66,6 +70,14 @@ Global
|
||||
{69BE8E8C-CF1E-46D6-932B-DB435F47059B}.Release|x86.ActiveCfg = Release|Win32
|
||||
{69BE8E8C-CF1E-46D6-932B-DB435F47059B}.Release|x86.Build.0 = Release|Win32
|
||||
{69BE8E8C-CF1E-46D6-932B-DB435F47059B}.Release|x86.Deploy.0 = Release|Win32
|
||||
{FD64BF17-8D36-4578-8D13-77B123BE30D3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FD64BF17-8D36-4578-8D13-77B123BE30D3}.Debug|x64.Build.0 = Debug|x64
|
||||
{FD64BF17-8D36-4578-8D13-77B123BE30D3}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{FD64BF17-8D36-4578-8D13-77B123BE30D3}.Debug|x86.Build.0 = Debug|Win32
|
||||
{FD64BF17-8D36-4578-8D13-77B123BE30D3}.Release|x64.ActiveCfg = Release|x64
|
||||
{FD64BF17-8D36-4578-8D13-77B123BE30D3}.Release|x64.Build.0 = Release|x64
|
||||
{FD64BF17-8D36-4578-8D13-77B123BE30D3}.Release|x86.ActiveCfg = Release|Win32
|
||||
{FD64BF17-8D36-4578-8D13-77B123BE30D3}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -75,5 +87,6 @@ Global
|
||||
{9B33C190-5D07-40BF-9536-68843DC5D7AF} = {95BD0669-04C8-4EEB-B3CC-0535B03F4468}
|
||||
{4111C8BB-D354-4348-AD3C-EB6832E84831} = {873E9D16-2A08-41FC-B301-79C95B3A8F98}
|
||||
{69BE8E8C-CF1E-46D6-932B-DB435F47059B} = {873E9D16-2A08-41FC-B301-79C95B3A8F98}
|
||||
{FD64BF17-8D36-4578-8D13-77B123BE30D3} = {35F6AB71-5BD2-4D53-8A51-D75CCD4CCC3D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -70,6 +70,9 @@
|
||||
#define snprintf sprintf_s
|
||||
#endif // WINDOWS_KERNEL
|
||||
|
||||
// Redefine rand to random for test code
|
||||
#define random rand
|
||||
|
||||
// Temporary !!! TODO - Remove this once we figure out the strncpy issue
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
|
||||
+9
-10
@@ -57,7 +57,6 @@ AM_CPPFLAGS = \
|
||||
|
||||
COMMON_LDADD = \
|
||||
$(top_builddir)/src/core/libopenthread.a \
|
||||
$(top_builddir)/examples/platforms/posix/libopenthread-posix.a \
|
||||
$(top_builddir)/third_party/mbedtls/libmbedcrypto.a \
|
||||
-lpthread \
|
||||
$(NULL)
|
||||
@@ -109,31 +108,31 @@ TESTS_ENVIRONMENT = \
|
||||
# Source, compiler, and linker options for test programs.
|
||||
|
||||
test_aes_LDADD = $(COMMON_LDADD)
|
||||
test_aes_SOURCES = test_aes.cpp
|
||||
test_aes_SOURCES = test_platform.cpp test_aes.cpp
|
||||
|
||||
test_hmac_sha256_LDADD = $(COMMON_LDADD)
|
||||
test_hmac_sha256_SOURCES = test_hmac_sha256.cpp
|
||||
test_hmac_sha256_SOURCES = test_platform.cpp test_hmac_sha256.cpp
|
||||
|
||||
test_link_quality_LDADD = $(COMMON_LDADD)
|
||||
test_link_quality_SOURCES = test_link_quality.cpp
|
||||
test_link_quality_SOURCES = test_platform.cpp test_link_quality.cpp
|
||||
|
||||
test_lowpan_LDADD = $(COMMON_LDADD)
|
||||
test_lowpan_SOURCES = test_lowpan.cpp test_util.cpp test_vector.c
|
||||
test_lowpan_SOURCES = test_platform.cpp test_lowpan.cpp test_util.cpp test_vector.c
|
||||
|
||||
test_mac_frame_LDADD = $(COMMON_LDADD)
|
||||
test_mac_frame_SOURCES = test_mac_frame.cpp
|
||||
test_mac_frame_SOURCES = test_platform.cpp test_mac_frame.cpp
|
||||
|
||||
test_message_LDADD = $(COMMON_LDADD)
|
||||
test_message_SOURCES = test_message.cpp
|
||||
test_message_SOURCES = test_platform.cpp test_message.cpp
|
||||
|
||||
test_ncp_buffer_LDADD = $(COMMON_LDADD)
|
||||
test_ncp_buffer_SOURCES = test_ncp_buffer.cpp
|
||||
test_ncp_buffer_SOURCES = test_platform.cpp test_ncp_buffer.cpp
|
||||
|
||||
test_timer_LDADD = $(COMMON_LDADD)
|
||||
test_timer_SOURCES = test_timer.cpp
|
||||
test_timer_SOURCES = test_platform.cpp test_timer.cpp
|
||||
|
||||
test_toolchain_LDADD = $(COMMON_LDADD)
|
||||
test_toolchain_SOURCES = test_toolchain.cpp
|
||||
test_toolchain_SOURCES = test_platform.cpp test_toolchain.cpp
|
||||
|
||||
if OPENTHREAD_ENABLE_DIAG
|
||||
test_diag_LDADD = $(top_builddir)/src/diag/libopenthread-diag.a \
|
||||
|
||||
@@ -35,10 +35,6 @@
|
||||
|
||||
static Thread::Crypto::MbedTls mbedtls;
|
||||
|
||||
extern"C" void otSignalTaskletPending(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies test vectors from IEEE 802.15.4-2006 Annex C Section C.2.1
|
||||
*/
|
||||
@@ -233,6 +229,7 @@ void TestMacCommandFrame()
|
||||
"TestMacCommandFrame decrypt failed\n");
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TEST_MAIN
|
||||
int main(void)
|
||||
{
|
||||
TestMacBeaconFrame();
|
||||
@@ -241,3 +238,4 @@ int main(void)
|
||||
printf("All tests passed\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -165,9 +165,11 @@ void TestDiag()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TEST_MAIN
|
||||
int main(void)
|
||||
{
|
||||
TestDiag();
|
||||
printf("All tests passed\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -36,10 +36,6 @@
|
||||
|
||||
static Thread::Crypto::MbedTls mbedtls;
|
||||
|
||||
extern"C" void otSignalTaskletPending(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
void TestHmacSha256(void)
|
||||
{
|
||||
static const struct
|
||||
@@ -80,9 +76,11 @@ void TestHmacSha256(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TEST_MAIN
|
||||
int main(void)
|
||||
{
|
||||
TestHmacSha256();
|
||||
printf("All tests passed\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -34,10 +34,6 @@
|
||||
|
||||
namespace Thread {
|
||||
|
||||
extern"C" void otSignalTaskletPending(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
kMaxRssValue = 0,
|
||||
@@ -342,6 +338,7 @@ void TestLinkQualityCalculations(void)
|
||||
|
||||
} // namespace Thread
|
||||
|
||||
#ifdef ENABLE_TEST_MAIN
|
||||
int main(void)
|
||||
{
|
||||
Thread::TestRssAveraging();
|
||||
@@ -349,3 +346,4 @@ int main(void)
|
||||
printf("All tests passed\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -40,41 +40,6 @@ using namespace Thread;
|
||||
|
||||
namespace Thread {
|
||||
|
||||
extern "C" void otSignalTaskletPending(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
extern "C" bool otAreTaskletsPending(otInstance *)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
extern "C" void otPlatUartSendDone(void)
|
||||
{
|
||||
}
|
||||
|
||||
extern "C" void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
|
||||
{
|
||||
(void)aBuf;
|
||||
(void)aBufLength;
|
||||
}
|
||||
|
||||
extern "C" void otPlatDiagAlarmFired(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
extern "C" void otPlatDiagRadioTransmitDone(otInstance *, bool aRxPending, ThreadError aError)
|
||||
{
|
||||
(void)aRxPending;
|
||||
(void)aError;
|
||||
}
|
||||
|
||||
extern "C" void otPlatDiagRadioReceiveDone(otInstance *, RadioPacket *aFrame, ThreadError aError)
|
||||
{
|
||||
(void)aFrame;
|
||||
(void)aError;
|
||||
}
|
||||
|
||||
Ip6::Ip6 sIp6;
|
||||
ThreadNetif sMockThreadNetif(sIp6);
|
||||
Lowpan::Lowpan sMockLowpan(sMockThreadNetif);
|
||||
@@ -162,7 +127,7 @@ void TestLowpanIphc(void)
|
||||
|
||||
} // namespace Thread
|
||||
|
||||
|
||||
#ifdef ENABLE_TEST_MAIN
|
||||
int main(void)
|
||||
{
|
||||
TestLowpanIphc();
|
||||
@@ -170,3 +135,4 @@ int main(void)
|
||||
printf("All tests passed\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -34,10 +34,6 @@
|
||||
|
||||
namespace Thread {
|
||||
|
||||
extern"C" void otSignalTaskletPending(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
void TestMacHeader(void)
|
||||
{
|
||||
static const struct
|
||||
@@ -88,9 +84,11 @@ void TestMacHeader(void)
|
||||
|
||||
} // namespace Thread
|
||||
|
||||
#ifdef ENABLE_TEST_MAIN
|
||||
int main(void)
|
||||
{
|
||||
Thread::TestMacHeader();
|
||||
printf("All tests passed\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -32,14 +32,6 @@
|
||||
#include <common/message.hpp>
|
||||
#include <string.h>
|
||||
|
||||
extern"C" void otSignalTaskletPending(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
extern "C" void otPlatDiagAlarmFired(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
void TestMessage(void)
|
||||
{
|
||||
Thread::MessagePool messagePool;
|
||||
@@ -68,9 +60,11 @@ void TestMessage(void)
|
||||
"Message::Free failed\n");
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TEST_MAIN
|
||||
int main(void)
|
||||
{
|
||||
TestMessage();
|
||||
printf("All tests passed\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -36,14 +36,6 @@ namespace Thread {
|
||||
|
||||
// This module implements unit-test for NcpFrameBuffer class.
|
||||
|
||||
extern"C" void otSignalTaskletPending(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
extern "C" void otPlatDiagAlarmFired(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
kTestBufferSize = 101, // Size of backed buffer for NcpFrameBuffer.
|
||||
@@ -468,9 +460,11 @@ void TestNcpFrameBuffer(void)
|
||||
|
||||
} // namespace Thread
|
||||
|
||||
#ifdef ENABLE_TEST_MAIN
|
||||
int main(void)
|
||||
{
|
||||
Thread::TestNcpFrameBuffer();
|
||||
printf("\nAll tests passed.\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if _WIN32
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <openthread.h>
|
||||
|
||||
#include <common/code_utils.hpp>
|
||||
#include <platform/alarm.h>
|
||||
#include <platform/misc.h>
|
||||
#include <platform/radio.h>
|
||||
#include <platform/random.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum
|
||||
{
|
||||
kCallCountIndexAlarmStop = 0,
|
||||
kCallCountIndexAlarmStart,
|
||||
kCallCountIndexTimerHandler,
|
||||
|
||||
kCallCountIndexMax
|
||||
};
|
||||
|
||||
uint32_t sNow;
|
||||
uint32_t sPlatT0;
|
||||
uint32_t sPlatDt;
|
||||
bool sTimerOn;
|
||||
uint32_t sCallCount[kCallCountIndexMax];
|
||||
|
||||
bool sDiagMode = false;
|
||||
|
||||
extern "C" {
|
||||
|
||||
void otSignalTaskletPending(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
bool otAreTaskletsPending(otInstance *)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Alarm
|
||||
//
|
||||
|
||||
void otPlatAlarmStop(otInstance *)
|
||||
{
|
||||
sTimerOn = false;
|
||||
sCallCount[kCallCountIndexAlarmStop]++;
|
||||
}
|
||||
|
||||
void otPlatAlarmStartAt(otInstance *, uint32_t aT0, uint32_t aDt)
|
||||
{
|
||||
sTimerOn = true;
|
||||
sCallCount[kCallCountIndexAlarmStart]++;
|
||||
sPlatT0 = aT0;
|
||||
sPlatDt = aDt;
|
||||
}
|
||||
|
||||
uint32_t otPlatAlarmGetNow(void)
|
||||
{
|
||||
return sNow;
|
||||
}
|
||||
|
||||
//
|
||||
// Radio
|
||||
//
|
||||
|
||||
void otPlatRadioGetIeeeEui64(otInstance *, uint8_t *)
|
||||
{
|
||||
}
|
||||
|
||||
ThreadError otPlatRadioSetPanId(otInstance *, uint16_t)
|
||||
{
|
||||
return kThreadError_None;
|
||||
}
|
||||
|
||||
ThreadError otPlatRadioSetExtendedAddress(otInstance *, uint8_t *)
|
||||
{
|
||||
return kThreadError_None;
|
||||
}
|
||||
|
||||
ThreadError otPlatRadioSetShortAddress(otInstance *, uint16_t)
|
||||
{
|
||||
return kThreadError_None;
|
||||
}
|
||||
|
||||
void otPlatRadioSetPromiscuous(otInstance *, bool)
|
||||
{
|
||||
}
|
||||
|
||||
ThreadError otPlatRadioEnable(otInstance *)
|
||||
{
|
||||
return kThreadError_None;
|
||||
}
|
||||
|
||||
ThreadError otPlatRadioDisable(otInstance *)
|
||||
{
|
||||
return kThreadError_None;
|
||||
}
|
||||
|
||||
ThreadError otPlatRadioSleep(otInstance *)
|
||||
{
|
||||
return kThreadError_None;
|
||||
}
|
||||
|
||||
ThreadError otPlatRadioReceive(otInstance *, uint8_t)
|
||||
{
|
||||
return kThreadError_None;
|
||||
}
|
||||
|
||||
ThreadError otPlatRadioTransmit(otInstance *)
|
||||
{
|
||||
return kThreadError_None;
|
||||
}
|
||||
|
||||
RadioPacket *otPlatRadioGetTransmitBuffer(otInstance *)
|
||||
{
|
||||
return (RadioPacket *)0;
|
||||
}
|
||||
|
||||
int8_t otPlatRadioGetRssi(otInstance *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
otRadioCaps otPlatRadioGetCaps(otInstance *)
|
||||
{
|
||||
return kRadioCapsNone;
|
||||
}
|
||||
|
||||
bool otPlatRadioGetPromiscuous(otInstance *)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Random
|
||||
//
|
||||
|
||||
uint32_t otPlatRandomGet(void)
|
||||
{
|
||||
#if _WIN32
|
||||
return (uint32_t)rand();
|
||||
#else
|
||||
return (uint32_t)random();
|
||||
#endif
|
||||
}
|
||||
|
||||
ThreadError otPlatRandomSecureGet(uint16_t aInputLength, uint8_t *aOutput, uint16_t *aOutputLength)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aOutput && aOutputLength, error = kThreadError_InvalidArgs);
|
||||
|
||||
for (uint16_t length = 0; length < aInputLength; length++)
|
||||
{
|
||||
aOutput[length] = (uint8_t)otPlatRandomGet();
|
||||
}
|
||||
|
||||
*aOutputLength = aInputLength;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
//
|
||||
// Diag
|
||||
//
|
||||
|
||||
void otPlatDiagProcess(int argc, char *argv[], char *aOutput)
|
||||
{
|
||||
// no more diagnostics features for Posix platform
|
||||
sprintf(aOutput, "diag feature '%s' is not supported\r\n", argv[0]);
|
||||
(void)argc;
|
||||
}
|
||||
|
||||
void otPlatDiagModeSet(bool aMode)
|
||||
{
|
||||
sDiagMode = aMode;
|
||||
}
|
||||
|
||||
bool otPlatDiagModeGet()
|
||||
{
|
||||
return sDiagMode;
|
||||
}
|
||||
|
||||
void otPlatDiagAlarmFired(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
void otPlatDiagRadioTransmitDone(otInstance *, bool, ThreadError)
|
||||
{
|
||||
}
|
||||
|
||||
void otPlatDiagRadioReceiveDone(otInstance *, RadioPacket *, ThreadError)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Uart
|
||||
//
|
||||
|
||||
void otPlatUartSendDone(void)
|
||||
{
|
||||
}
|
||||
|
||||
void otPlatUartReceived(const uint8_t *, uint16_t)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Misc
|
||||
//
|
||||
|
||||
void otPlatReset(otInstance *aInstance)
|
||||
{
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
|
||||
{
|
||||
(void)aInstance;
|
||||
return kPlatResetReason_PowerOn;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
@@ -43,34 +43,11 @@ enum
|
||||
};
|
||||
|
||||
static Thread::TimerScheduler sTimerScheduler;
|
||||
static uint32_t sNow;
|
||||
static uint32_t sPlatT0;
|
||||
static uint32_t sPlatDt;
|
||||
static bool sTimerOn;
|
||||
static uint32_t sCallCount[kCallCountIndexMax];
|
||||
|
||||
extern "C" {
|
||||
|
||||
void otPlatAlarmStop(otInstance *)
|
||||
{
|
||||
sTimerOn = false;
|
||||
sCallCount[kCallCountIndexAlarmStop]++;
|
||||
}
|
||||
|
||||
void otPlatAlarmStartAt(otInstance *, uint32_t aT0, uint32_t aDt)
|
||||
{
|
||||
sTimerOn = true;
|
||||
sCallCount[kCallCountIndexAlarmStart]++;
|
||||
sPlatT0 = aT0;
|
||||
sPlatDt = aDt;
|
||||
}
|
||||
|
||||
uint32_t otPlatAlarmGetNow(void)
|
||||
{
|
||||
return sNow;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
extern uint32_t sNow;
|
||||
extern uint32_t sPlatT0;
|
||||
extern uint32_t sPlatDt;
|
||||
extern bool sTimerOn;
|
||||
extern uint32_t sCallCount[kCallCountIndexMax];
|
||||
|
||||
void InitCounters(void)
|
||||
{
|
||||
@@ -409,9 +386,11 @@ void RunTimerTests(void)
|
||||
TestTenTimers();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TEST_MAIN
|
||||
int main(void)
|
||||
{
|
||||
RunTimerTests();
|
||||
printf("All tests passed\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -34,23 +34,29 @@
|
||||
|
||||
void test_packed1()
|
||||
{
|
||||
typedef OT_TOOL_PACKED_BEGIN struct
|
||||
OT_TOOL_PACKED_BEGIN
|
||||
struct packed_t
|
||||
{
|
||||
uint8_t mByte;
|
||||
uint32_t mWord;
|
||||
uint16_t mShort;
|
||||
} OT_TOOL_PACKED_END packed_t;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
CompileTimeAssert(sizeof(packed_t) == 7, "packed_t should be packed to 7 bytes");
|
||||
|
||||
VerifyOrQuit(sizeof(packed_t) == 7, "Toolchain::OT_TOOL_PACKED failed 1\n");
|
||||
}
|
||||
|
||||
void test_packed2()
|
||||
{
|
||||
typedef OT_TOOL_PACKED_BEGIN struct
|
||||
OT_TOOL_PACKED_BEGIN
|
||||
struct packed_t
|
||||
{
|
||||
uint8_t mBytes[3];
|
||||
uint8_t mByte;
|
||||
} OT_TOOL_PACKED_END packed_t;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
CompileTimeAssert(sizeof(packed_t) == 4, "packed_t should be packed to 4 bytes");
|
||||
|
||||
VerifyOrQuit(sizeof(packed_t) == 4, "Toolchain::OT_TOOL_PACKED failed 2\n");
|
||||
}
|
||||
@@ -62,7 +68,8 @@ void test_packed_union()
|
||||
uint16_t mField;
|
||||
} nested_t;
|
||||
|
||||
typedef OT_TOOL_PACKED_BEGIN struct
|
||||
OT_TOOL_PACKED_BEGIN
|
||||
struct packed_t
|
||||
{
|
||||
uint8_t mBytes[3];
|
||||
union
|
||||
@@ -70,7 +77,9 @@ void test_packed_union()
|
||||
nested_t mNestedStruct;
|
||||
uint8_t mByte;
|
||||
} OT_TOOL_PACKED_FIELD;
|
||||
} OT_TOOL_PACKED_END packed_t;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
CompileTimeAssert(sizeof(packed_t) == 5, "packed_t should be packed to 5 bytes");
|
||||
|
||||
VerifyOrQuit(sizeof(packed_t) == 5, "Toolchain::OT_TOOL_PACKED failed 3\n");
|
||||
}
|
||||
@@ -92,9 +101,11 @@ void TestToolchain(void)
|
||||
test_packed_enum();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TEST_MAIN
|
||||
int main(void)
|
||||
{
|
||||
TestToolchain();
|
||||
printf("All tests passed\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -34,10 +34,15 @@
|
||||
|
||||
#include <openthread-types.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Enable main functions
|
||||
#define ENABLE_TEST_MAIN
|
||||
|
||||
#define SuccessOrQuit(ERR, MSG) \
|
||||
do { \
|
||||
if ((ERR) != kThreadError_None) \
|
||||
@@ -58,8 +63,30 @@ extern "C" {
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
//#define CompileTimeAssert(COND, MSG) typedef char __C_ASSERT__[(COND)?1:-1]
|
||||
|
||||
// I would use the above definition for CompileTimeAssert, but I am getting the following errors
|
||||
// when I run 'make -f examples/Makefile-posix distcheck':
|
||||
//
|
||||
// error: typedef ‘__C_ASSERT__’ locally defined but not used [-Werror=unused-local-typedefs]
|
||||
//
|
||||
#define CompileTimeAssert(COND, MSG)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
typedef void (*utAssertTrue)(bool condition, const wchar_t *message);
|
||||
extern utAssertTrue s_AssertTrue;
|
||||
|
||||
#define SuccessOrQuit(ERR, MSG) s_AssertTrue((ERR) == kThreadError_None, L##MSG)
|
||||
|
||||
#define VerifyOrQuit(ERR, MSG) s_AssertTrue(ERR, L##MSG)
|
||||
|
||||
#define CompileTimeAssert(COND, MSG) static_assert(COND, MSG)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
#include "CppUnitTest.h"
|
||||
#include "test_util.h"
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
#pragma region Test Declarations
|
||||
|
||||
// test_aes.cpp
|
||||
void TestMacBeaconFrame();
|
||||
void TestMacDataFrame();
|
||||
void TestMacCommandFrame();
|
||||
|
||||
// test_hmac_sha256.cpp
|
||||
void TestHmacSha256();
|
||||
|
||||
// test_link_quality.cpp
|
||||
namespace Thread
|
||||
{
|
||||
void TestRssAveraging();
|
||||
void TestLinkQualityCalculations();
|
||||
}
|
||||
|
||||
// test_lowpan.cpp
|
||||
namespace Thread
|
||||
{
|
||||
void TestLowpanIphc();
|
||||
}
|
||||
|
||||
// test_mac_frame.cpp
|
||||
namespace Thread
|
||||
{
|
||||
void TestMacHeader();
|
||||
}
|
||||
|
||||
// test_message.cpp
|
||||
void TestMessage();
|
||||
|
||||
// test_timer.cpp
|
||||
int TestOneTimer();
|
||||
int TestTenTimers();
|
||||
|
||||
// test_toolchain.cpp
|
||||
void test_packed1();
|
||||
void test_packed2();
|
||||
void test_packed_union();
|
||||
void test_packed_enum();
|
||||
|
||||
#pragma endregion
|
||||
|
||||
utAssertTrue s_AssertTrue;
|
||||
|
||||
namespace Thread
|
||||
{
|
||||
TEST_CLASS(UnitTests)
|
||||
{
|
||||
public:
|
||||
|
||||
UnitTests() { s_AssertTrue = AssertTrue; }
|
||||
|
||||
// Helper for openthread test code to call
|
||||
static void AssertTrue(bool condition, const wchar_t* message)
|
||||
{
|
||||
Assert::IsTrue(condition, message);
|
||||
}
|
||||
|
||||
// test_aes.cpp
|
||||
TEST_METHOD(TestMacBeaconFrame) { ::TestMacBeaconFrame(); }
|
||||
TEST_METHOD(TestMacDataFrame) { ::TestMacDataFrame(); }
|
||||
TEST_METHOD(TestMacCommandFrame) { ::TestMacCommandFrame(); }
|
||||
|
||||
// test_hmac_sha256.cpp
|
||||
TEST_METHOD(TestHmacSha256) { ::TestHmacSha256(); }
|
||||
|
||||
// test_link_quality.cpp
|
||||
TEST_METHOD(TestRssAveraging) { Thread::TestRssAveraging(); }
|
||||
TEST_METHOD(TestLinkQualityCalculations) { Thread::TestLinkQualityCalculations(); }
|
||||
|
||||
// test_lowpan.cpp
|
||||
TEST_METHOD(TestLowpanIphc) { Thread::TestLowpanIphc(); }
|
||||
|
||||
// test_mac_frame.cpp
|
||||
TEST_METHOD(TestMacHeader) { Thread::TestMacHeader(); }
|
||||
|
||||
// test_message.cpp
|
||||
TEST_METHOD(TestMessage) { ::TestMessage(); }
|
||||
|
||||
// test_message.cpp
|
||||
TEST_METHOD(TestOneTimer) { ::TestOneTimer(); }
|
||||
TEST_METHOD(TestTenTimers) { ::TestTenTimers(); }
|
||||
|
||||
// test_toolchain.cpp
|
||||
TEST_METHOD(test_packed1) { ::test_packed1(); }
|
||||
TEST_METHOD(test_packed2) { ::test_packed2(); }
|
||||
TEST_METHOD(test_packed_union) { ::test_packed_union(); }
|
||||
TEST_METHOD(test_packed_enum) { ::test_packed_enum(); }
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user