Skip to content

Commit

Permalink
[Examples] Fixing compilation errors in several examples and adding t…
Browse files Browse the repository at this point in the history
…hem to Actions (#797)

* Fixing compilation errors and warnings in examples

* Adding examples to be built on Linux

* Triggering Actions on other branches to test the changes

* Making sure the workflow with new examples will be triggered to test it

* Marking a variable used only in an ASSERT with a macro VARIABLE_IS_NOT_USED

* Updating the list of examples which should build properly

* Adding necessary dependancies in cmake to make examples compile again

* Renaming to qa_interfaces

* Renaming one more instance of qa_interfaces

* A couple more interfaces to qa_interfaces changes

* Json tests were also moved to qa_interfaces

* Changing each occurrence of Exchange::ITestUtility to the new namespace QualityAssurance::ITestUtility

* Marking a variable used in only an ASSERT with the proper macro

* Making the space namespace and interface changes to TestController

* Adding variable is not used macro

* Removing the client server from being built for now

* One more unused variable

* Triggering Windows Actions on other branches to test the changes

* Actions should trigger only when there are changes on master branch

* Adding a condition to trigger Windows Actions only for pushes to master

* Using the template from master branch

* Getting rid of unnecessary double cast

* Adding PLUGIN_CONFIGUPDATEEXAMPLE to be built in Actions

* Adding TEST_AUTOMATION_TOOLS to be built in Actions

* Making sure there are no warning

* Adding STORE_TEST to be built in Actions

* Making sure the template from the branch will be used instead of the one on master

* Trying to build PLUGIN_OUTOFPROCESS again since it works locally

* Using the template from master since it is ready to be merged

* Sorting the build options alphabetically
  • Loading branch information
VeithMetro authored Jun 5, 2024
1 parent 4b0203f commit d46d41c
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 28 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/Linux build template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,32 @@ jobs:
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror" \
-DCMAKE_INSTALL_PREFIX="${{matrix.build_type}}/install/usr" \
-DCMAKE_MODULE_PATH="${PWD}/${{matrix.build_type}}/install/usr/include/WPEFramework/Modules" \
-DEXAMPLE_COMRPCCLIENT=ON \
-DPLUGIN_CECCONTROL=ON \
-DPLUGIN_COMMANDER=ON \
-DPLUGIN_CONFIGUPDATEEXAMPLE=ON \
-DPLUGIN_DHCPSERVER=ON \
-DPLUGIN_DIALSERVER=ON \
-DPLUGIN_DICTIONARY=ON \
-DPLUGIN_FILETRANSFER=ON \
-DPLUGIN_IOCONNECTOR=ON \
-DPLUGIN_INPUTSWITCH=ON \
-DPLUGIN_IOCONNECTOR=ON \
-DPLUGIN_JSONRPC=ON \
-DPLUGIN_NETWORKCONTROL=ON \
-DPLUGIN_OUTOFPROCESS=ON \
-DPLUGIN_PROCESSMONITOR=ON \
-DPLUGIN_RESOURCEMONITOR=ON \
-DPLUGIN_SYSTEMCOMMANDS=ON \
-DPLUGIN_STATECONTROLLER=ON \
-DPLUGIN_SWITCHBOARD=ON \
-DPLUGIN_SYSTEMCOMMANDS=ON \
-DPLUGIN_TESTCONTROLLER=ON \
-DPLUGIN_TESTUTILITY=ON \
-DPLUGIN_WEBPROXY=ON \
-DPLUGIN_WEBSERVER=ON \
-DPLUGIN_WEBSHELL=ON \
-DPLUGIN_WIFICONTROL=ON \
-DSTORE_TEST=ON \
-DTEST_AUTOMATION_TOOLS=ON \
${{steps.plugins.outputs.first_match}}
cmake --build ${{matrix.build_type}}/build/ThunderNanoServices --target install
Expand Down
3 changes: 3 additions & 0 deletions examples/COMRPCClient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

find_package(WPEFramework)
find_package(${NAMESPACE}COM REQUIRED)
find_package(${NAMESPACE}Core REQUIRED)
find_package(CompileSettingsDebug CONFIG REQUIRED)

add_executable(COMRPCClient COMRPCClient.cpp)
Expand All @@ -28,6 +30,7 @@ set_target_properties(COMRPCClient PROPERTIES
target_link_libraries(COMRPCClient
PRIVATE
${NAMESPACE}COM::${NAMESPACE}COM
${NAMESPACE}Core::${NAMESPACE}Core
CompileSettingsDebug::CompileSettingsDebug
)

Expand Down
4 changes: 2 additions & 2 deletions examples/COMRPCClient/COMRPCClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
#include <interfaces/IDictionary.h>
#include <iostream>

MODULE_NAME_DECLARATION(BUILD_REFERENCE);
MODULE_NAME_DECLARATION(BUILD_REFERENCE)

namespace Thunder;

Expand Down Expand Up @@ -209,7 +209,7 @@ class WorkerPoolImplementation
Thunder::Core::IIPCServer* _announceHandler;
};

int main(int argc, char* argv[])
int main(int /* argc */, char** /* argv */)
{
bool directLink = true;

Expand Down
4 changes: 2 additions & 2 deletions examples/IOConnectorTest/IOConnectorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ namespace Plugin {
~Sink() override = default;

public:
void Activated(Exchange::IExternal* source) override
void Activated(Exchange::IExternal* /* source */) override
{
printf("Sink::Activated called\n");
}
void Deactivated(Exchange::IExternal* source) override
void Deactivated(Exchange::IExternal* /* source */) override
{
printf("Sink::Deactivated called\n");
}
Expand Down
5 changes: 5 additions & 0 deletions examples/JSONRPCClient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

find_package(WPEFramework)
find_package(${NAMESPACE}COM REQUIRED)
find_package(${NAMESPACE}WebSocket REQUIRED)
find_package(${NAMESPACE}Messaging REQUIRED)
find_package(${NAMESPACE}Core REQUIRED)
find_package(securityagent QUIET)
find_package(CompileSettingsDebug CONFIG REQUIRED)

Expand All @@ -31,6 +34,8 @@ target_link_libraries(JSONRPCClient
PRIVATE
${NAMESPACE}COM::${NAMESPACE}COM
${NAMESPACE}WebSocket::${NAMESPACE}WebSocket
${NAMESPACE}Messaging::${NAMESPACE}Messaging
${NAMESPACE}Core::${NAMESPACE}Core
CompileSettingsDebug::CompileSettingsDebug
)

Expand Down
22 changes: 11 additions & 11 deletions examples/JSONRPCClient/JSONRPCClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ static void async_callback(const Data::Response& response)
class Callbacks {
public:
void async_callback_complete(const Data::Response& response, const Core::JSONRPC::Error* result) {
printf("Finally we are triggered. Pointer to: %p @ %s\n", result, Core::Time(response.Time.Value()).ToRFC1123().c_str());
printf("Finally we are triggered. Pointer to: %p @ %s\n", (void*)result, Core::Time(response.Time.Value()).ToRFC1123().c_str());
}
};

Expand Down Expand Up @@ -322,7 +322,7 @@ static void Measure(const TCHAR info[], const uint8_t patternLength, const uint8
subject(length, dataFrame);
}
time = measurement.Elapsed();
printf("Data outbound: [0], inbound: [4]. Total: %llu. Average: %llu\n", time, time / MeasurementLoops);
printf("Data outbound: [0], inbound: [4]. Total: %lu. Average: %lu\n", time, time / MeasurementLoops);

measurement.Reset();
length = 16;
Expand All @@ -331,7 +331,7 @@ static void Measure(const TCHAR info[], const uint8_t patternLength, const uint8
subject(length, dataFrame);
}
time = measurement.Elapsed();
printf("Data outbound: [16], inbound: [4]. Total: %llu. Average: %llu\n", time, time / MeasurementLoops);
printf("Data outbound: [16], inbound: [4]. Total: %lu. Average: %lu\n", time, time / MeasurementLoops);

measurement.Reset();
length = 128;
Expand All @@ -340,47 +340,47 @@ static void Measure(const TCHAR info[], const uint8_t patternLength, const uint8
subject(length, dataFrame);
}
time = measurement.Elapsed();
printf("Data outbound: [128], inbound: [4]. Total: %llu. Average: %llu\n", time, time / MeasurementLoops);
printf("Data outbound: [128], inbound: [4]. Total: %lu. Average: %lu\n", time, time / MeasurementLoops);

measurement.Reset();
length = 256;
for (uint32_t run = 0; run < MeasurementLoops; run++) {
subject(length, dataFrame);
}
time = measurement.Elapsed();
printf("Data outbound: [256], inbound: [4]. Total: %llu. Average: %llu\n", time, time / MeasurementLoops);
printf("Data outbound: [256], inbound: [4]. Total: %lu. Average: %lu\n", time, time / MeasurementLoops);

measurement.Reset();
length = 512;
for (uint32_t run = 0; run < MeasurementLoops; run++) {
subject(length, dataFrame);
}
time = measurement.Elapsed();
printf("Data outbound: [512], inbound: [4]. Total: %llu. Average: %llu\n", time, time / MeasurementLoops);
printf("Data outbound: [512], inbound: [4]. Total: %lu. Average: %lu\n", time, time / MeasurementLoops);

measurement.Reset();
length = 1024;
for (uint32_t run = 0; run < MeasurementLoops; run++) {
subject(length, dataFrame);
}
time = measurement.Elapsed();;
printf("Data outbound: [1024], inbound: [4]. Total: %llu. Average: %llu\n", time, time / MeasurementLoops);
printf("Data outbound: [1024], inbound: [4]. Total: %lu. Average: %lu\n", time, time / MeasurementLoops);

measurement.Reset();
length = 2048;
for (uint32_t run = 0; run < MeasurementLoops; run++) {
subject(length, dataFrame);
}
time = measurement.Elapsed();
printf("Data outbound: [2048], inbound: [4]. Total: %llu. Average: %llu\n", time, time / MeasurementLoops);
printf("Data outbound: [2048], inbound: [4]. Total: %lu. Average: %lu\n", time, time / MeasurementLoops);

measurement.Reset();
length = 1024 * 32;
for (uint32_t run = 0; run < MeasurementLoops; run++) {
subject(length, dataFrame);
}
time = measurement.Elapsed();
printf("Data outbound: [32KB], inbound: [4]. Total: %llu. Average: %llu\n", time, time / MeasurementLoops);
printf("Data outbound: [32KB], inbound: [4]. Total: %lu. Average: %lu\n", time, time / MeasurementLoops);

}

Expand All @@ -403,9 +403,9 @@ void MeasureCOMRPC(Core::ProxyType<RPC::CommunicatorClient>& client)
Core::StopWatch measurement;
Exchange::IPerformance* perf = client->Acquire<Exchange::IPerformance>(2000, _T("JSONRPCPlugin"), ~0);
if (perf == nullptr) {
printf("Instantiation failed. An performance interface was not returned. It took: %lld ticks\n", measurement.Elapsed());
printf("Instantiation failed. An performance interface was not returned. It took: %ld ticks\n", measurement.Elapsed());
} else {
printf("Instantiating and retrieving the interface took: %lld ticks\n", measurement.Elapsed());
printf("Instantiating and retrieving the interface took: %ld ticks\n", measurement.Elapsed());
int measure;
do {
ShowPerformanceMenu();
Expand Down
2 changes: 1 addition & 1 deletion examples/StateController/StateController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace Plugin {
return message;
}

/* virtual */ void StateController::Deinitialize(PluginHost::IShell* service)
/* virtual */ void StateController::Deinitialize(PluginHost::IShell* service VARIABLE_IS_NOT_USED)
{
ASSERT(_service == service);

Expand Down
4 changes: 2 additions & 2 deletions examples/testconsole/testconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ POP_WARNING()
switch (keyPress) {
case 'A': {
provisioningClient.Provision();
/* falls throgh */
[[fallthrough]];
}
case 'B': {
if (openState == true) {
Expand Down Expand Up @@ -633,7 +633,7 @@ POP_WARNING()
printf("Pending message size: %d\n", stressEngines[engine]->Pending());
printf("Error count: %d\n", stressEngines[engine]->Errors());
}
/* falls through */
[[fallthrough]];
}
case 'T': {
printf("Total status: %s\n", Thunder::Core::Time::Now().ToRFC1123(true).c_str());
Expand Down
4 changes: 2 additions & 2 deletions examples/testserver/EchoProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace TestSystem {
// Generate the message
uint16_t index = 0;
uint16_t requiredLength;
Crypto::Random(requiredLength, static_cast<const uint16_t>(8), static_cast<const uint16_t>(2048));
Crypto::Random(requiredLength, static_cast<uint16_t>(8), static_cast<uint16_t>(2048));
string myMessage = Core::NumberType<uint16_t, false, BASE_HEXADECIMAL>(requiredLength).Text();

if (requiredLength < _minLength) {
Expand Down Expand Up @@ -131,7 +131,7 @@ namespace TestSystem {
}
JSONObjectFactory(const JSONObjectFactory&);
JSONObjectFactory& operator=(const JSONObjectFactory&);
~JSONObjectFactory() override = default;
~JSONObjectFactory() = default;

public:
static JSONObjectFactory& Instance()
Expand Down
2 changes: 2 additions & 0 deletions examples/testserver/testserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ namespace TestSystem {
};

char keyPress;
#if 0
bool flagState = false;
#endif

do {
keyPress = toupper(getchar());
Expand Down
10 changes: 5 additions & 5 deletions tests/StoreTest/StoreTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ static void Measure(const string& interface, const string& callSign, Performance
uint64_t freeRamBefore = systemInfo.GetFreeRam();
Thunder::Core::StopWatch measurement;

printf("CPU Load: Before Test: %llu\n", loadBefore);
printf("Free Memory: Before Test: %llu\n", freeRamBefore);
printf("CPU Load: Before Test: %lu\n", loadBefore);
printf("Free Memory: Before Test: %lu\n", freeRamBefore);
uint64_t loadInBetween, loadPeak = loadBefore;
uint64_t freeRamBetween, freeRamPeak = freeRamBefore;
for (uint32_t run = 0; run < MaxLoad; run++) {
Expand All @@ -68,9 +68,9 @@ static void Measure(const string& interface, const string& callSign, Performance
if (loadPeak > loadBefore) {
loadDiff = static_cast<uint64_t>(loadPeak - loadBefore);
}
printf("Performance: Total: %llu. Average: %llu\n", time, time / MaxLoad);
printf("Free Memory: After = %llu, Diff = %llu\n", freeRamPeak, memDiff);
printf("CPU Load: After = %llu, Diff = %llu\n", loadPeak, loadDiff);
printf("Performance: Total: %lu. Average: %lu\n", time, time / MaxLoad);
printf("Free Memory: After = %lu, Diff = %lu\n", freeRamPeak, memDiff);
printf("CPU Load: After = %lu, Diff = %lu\n", loadPeak, loadDiff);
}

class Dictionary : public Thunder::RPC::SmartInterfaceType<Thunder::Exchange::IDictionary > {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
#include <memory>
#include "Module.h"
#include <interfaces/ITestAutomation.h>
#include <qa_interfaces/ITestAutomation.h>

namespace WPEFramework {
namespace Plugin {
Expand Down
1 change: 1 addition & 0 deletions tests/TestUtility/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if(PLUGIN_TESTUTILITY_OUTOFPROCESS STREQUAL "false")
unset(PLUGIN_TESTUTILITY_OUTOFPROCESS CACHE)
endif()

find_package(WPEFramework)
find_package(${NAMESPACE}Plugins REQUIRED)
find_package(${NAMESPACE}Definitions REQUIRED)
find_package(CompileSettingsDebug CONFIG REQUIRED)
Expand Down

0 comments on commit d46d41c

Please sign in to comment.