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

Windows support for AWS IoT Client #460

Open
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

prilepski
Copy link

Motivation

The current version/codebase of AWS IoT Client only claims Linux support. However, there are cases when Windows support is needed. Or when it is necessary to introduce a cross-platform IoT client. Such cases arise when migrating old/existing products to the modern cloud stack. Especially in the MedTech industry. A prototype supporting Linux and Windows will add extra points to using AWS IoT as a foundation for IoT solutions. The existing codebase is not too much Linux-specific. So, I decided to contribute the necessary changes to introduce Windows support into the AWS IoT Client.

Modifications

Change summary

Multiple commits were required to introduce Windows support in AWS IoT Client. However, all changes can be grouped in the following way:

  • build process changes. Several changes/additions were made to main CMakeLists.txt abd CMakeLists.txt of the google test project. Changes to turn off Sensor Publish feature in Windows as it will require time to migrate it from POSIX to Windows API sockets. Addition of win32 folder and sources for Windows. Copying OpenSSL DLLs to the executables and a few minor changes for Windows only.
  • Linux-specific POSIX methods and definitions that are not present in Windows. win32 folder with a Windows version of such definitions and methods was introduced.
  • very few AWS Client Methods have been redefined for Winsows as those had Linux-specific implementation. Examples are: FleetProvisioning::CollectNetworkInformation() or JobEngine::exec_cmd(...)
  • several changes in goole tests. Mostly to accommodate Linux-specific test data definition. However, it was needed to fix AWS IoT Library initialization as it was missing in several tests. It somehow worked in Linux (probably due to differences in memory management), but it did not work in Windows.
  • Windows-specific setup script has been introduced (setup.ps1). it generally mimics the setup.sh.
  • A couple of sample Job-actions have been ported to Windows (they were placed to Win32 folder in sample-job-handlers
  • Documentation has been updated to reflect Windows support and to introduce Windows-specifics.

What was not done due to an attempt to minimize initial pull request:

  • no support to run AWS IoT Client as a Windows Service has been implemented.
  • Sensor Publish sample is turned off in Windows as migration to Windows API has not been done there.

Revision diff summary

refer to Change Summary

Testing

The branch has been tested in both Linux and Windows in the following ways:

  • Tests have been executed (see Windows test summary in the attached file)
  • All supported features were enabled and configured (manually or via setup script) and manual end-to-end tests have been conducted.

(I saw a request to provide CI test run, but I do not see anything in the repository or in the Contribution document referring to CI hooks or actions)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
win_test_results.txt

…as configuration file generation powershell script. But it is not yet tested and no text coverate provided.
…alizeConfigTestFixture, LogQueueTest, Logging, EnvUtils, TestFeatureRegistry, FileUtils, LockFileTestFixture, MqttUtils, SharedResourceManagerTest, StringUtils, UniqueString, EphemeralPromise, JobDocument, TestJobEngine
…alizeAllocator to initialize memory allocator before member variables are allocated.
…p method to initialize AWS SDK for each test and to eliminate memory allocation failures.
…edCrtResourceManager instance to get initialized prior to memory allocation for a member variable (which leads to an assertion as memory allocator structure is NULL prior to initialization.
…sted against GTests. These fixes address Linux compilation problems and make sure that test pass rate on Linux in "Windows" branch is identical to the main branch.
…rted and working all the way to atempting to connect to MQTT. No further testing beyond that is done for now.
…s that may result in less characters/bytes in the ifstream than what file size reported.
…rue. It makes it compatible with existing test and with default config template that does not reveal this parameter.
…ead of cmd, sample job templates for Windows and several sample job handlers for Windows.
…up script adjustment to match the configuration steps: running under administrator and specifying username under which AWS IoT Device Client will be running.
@RogerZhongAWS
Copy link
Contributor

Hey @prilepski , thank you so much for opening this PR. This is a huge win for Windows users. Apologies for the long turnaround as we need to allocate some time and resources to approve this, but do rest assured that this is on our radar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants