Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Espressif examples run with local wolfSSL (no setup!) #6018

Merged
merged 13 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 102 additions & 5 deletions IDE/Espressif/ESP-IDF/compileAllExamples.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,111 @@
#!/bin/bash

#
# testing script: compileAllExamples
#
# This script will compile all the local examples, optionally installing wolfSSL in the ESP-IDF components directory.
#
# Example usage:
# cd wolfssl && docker run --rm -v $PWD:/project -w /project espressif/idf:latest IDE/Espressif/ESP-IDF/compileAllExamples.sh

#
# Parameter option to also run the ./setup.sh to install the wolfSSL component in ESP-IDF and test for multiple installs:
#
# --run-setup
#
# Note that once installed, the wolfSSL component will need to be manually removed to successfully run this script.
#
if [[ "$IDF_PATH" == "" ]]; then
echo "Error: $IDF_PATH not found; run Espressif export.sh"
exit 1
fi
SCRIPT_DIR=$(builtin cd ${BASH_SOURCE%/*}; pwd)
pushd ${SCRIPT_DIR} && ./setup.sh; popd
RUN_SETUP=$1
THIS_ERR=0

echo "Found IDF_PATH = $IDF_PATH"

# Regular tests of wolfSSL in local component directories of each project:
#
# Note these tests should FAIL if wolfSSL is already installed in ESP-IDF
#
for file in "benchmark" "client" "server" "test"; do
cd ${IDF_PATH}/examples/protocols/wolfssl_${file}/ && idf.py build
if [ $? -ne 0 ]; then
pushd ${SCRIPT_DIR}/examples/wolfssl_${file}/ && idf.py fullclean build;
THIS_ERR=$?
popd
if [ $THIS_ERR -ne 0 ]; then
echo "Failed in ${file}"
exit 1
fi
done


# Check for option to also install wolfSSL.
#
# When doing so, we'll run a check that multiple installs should cause build failure.
if [[ "$RUN_SETUP" == "--run-setup" ]]; then
echo "Running wolfSSL setup.sh"

# install wolfSSL into EDP-IDF shared components directory.
./setup.sh --verbose

THIS_ERR=$?
if [ $? -ne 0 ]; then
echo "Failed running setup.sh"
exit 1
fi

# Check ESP-IDF install:
#
# The wolfssl_test_idf should NOT have a local components/wolfssl when testing!
# This test is to confirm the ESP-IDF component build properly after setup.
#
echo ""
echo "Testing a build of wolfSSL in ESP-IDF components directory"
echo ""
for file in "test_idf"; do
pushd ${SCRIPT_DIR}/examples/wolfssl_${file}/ && idf.py fullclean build;
THIS_ERR=$?
popd
if [ $? -ne 0 ]; then
echo "Failed in ${file}"
exit 1
fi
done

# Check multiple installs: the wolfSSL component in ESP-IDF and local directory:
#
# The wolfssl_test project already has a local wolfSSL component directory.
#
# Once wolfssl has been installed to ESP-IDF components, the local
# component build SHOULD fail:
echo ""
echo "Testing a build of wolfSSL in both local and ESP-IDF components directory"
echo ""
for file in "test"; do
pushd ${SCRIPT_DIR}/examples/wolfssl_${file}/ && idf.py fullclean build;
THIS_ERR=$?
popd
if [ $THIS_ERR -ne 0 ]; then
echo ""
echo "Success: Confirmed build fails when wolfSSL found in ESP-IDF and local project."
echo ""
else
echo "Error: build should have failed when wolfSSL found in ESP-IDF and local project."
exit 1
fi
done
else
echo "Skipping ESP-IDF install tests. For these tests, use parameter: --run-setup"
fi


# Show a reminder that wolfSSL was installed as a shared component.
if [[ "$RUN_SETUP" == "--run-setup" ]]; then
echo ""
echo "wolfSSL was installed as an ESP-IDF component. This will be in conflict with any project that has a local component."
echo ""
echo "Delete the installed component before re-running this test."
echo ""
fi

# Done
echo "Completed compileAllExamples in $SCRIPT_DIR"
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32802.440
MinimumVisualStudioVersion = 10.0.40219.1
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_benchmark", "VisualGDB_wolfssl_benchmark.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CF8A8B6E-ECCF-481A-92AC-1E2F432816E8}"
ProjectSection(SolutionItems) = preProject
components\wolfssl\wolfcrypt\benchmark\benchmark.c = components\wolfssl\wolfcrypt\benchmark\benchmark.c
components\wolfssl\wolfcrypt\benchmark\benchmark.h = components\wolfssl\wolfcrypt\benchmark\benchmark.h
..\..\README.md = ..\..\README.md
..\..\UPDATE.md = ..\..\UPDATE.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|VisualGDB = Debug|VisualGDB
Release|VisualGDB = Release|VisualGDB
Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {969EF1DC-F8DA-46B8-A2AC-A7FDC3234245}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_benchmark", "VisualGDB_wolfssl_benchmark.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{51FEFEA9-C2BA-43A1-8B36-9140367E5AAF}"
ProjectSection(SolutionItems) = preProject
..\..\..\..\..\wolfcrypt\benchmark\benchmark.c = ..\..\..\..\..\wolfcrypt\benchmark\benchmark.c
..\..\..\..\..\wolfcrypt\benchmark\benchmark.h = ..\..\..\..\..\wolfcrypt\benchmark\benchmark.h
components\wolfssl\CMakeLists.txt = components\wolfssl\CMakeLists.txt
..\..\..\..\..\include\user_settings.h = ..\..\..\..\..\include\user_settings.h
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|VisualGDB = Debug|VisualGDB
Release|VisualGDB = Release|VisualGDB
Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {668EEFC0-010C-4688-916F-A628190717D4}
EndGlobalSection
EndGlobal
Loading