AWS IoT Device SDK C: Main
Return to main page ↑
Global Test Configuration

Configuration settings that affect all tests.

Configuration settings are C pre-processor constants. They can be set with a #define in the config file (iot_config.h) or by using a compiler option such as -D in gcc. If a configuration setting is not defined, the library will use a "sensible" default value (unless otherwise noted). Because they are compile-time constants, a library must be rebuilt if a configuration setting is changed.

configpagemarker

IOT_BUILD_TESTS

Specifies that the tests are being built.

This setting modifies the behavior of the libraries under test. For example, it may expose internal variables or functions for testing.

IOT_BUILD_TESTS will be automatically configured during build and generally does not need to be defined.

Possible values: 1 (tests are being built) or 0 (tests are not being built)
Recommended values: This must always be set to 1 if building any test files. Otherwise, it should be set to 0.
Default value (if undefined): 0

IOT_TEST_SECURED_CONNECTION

Determines if the tests use a TLS-secured connection with the remote host.

When this setting is true, all test applications will use a TLS-secured connection. The credentials for connections are IOT_TEST_ROOT_CA, IOT_TEST_CLIENT_CERT, and IOT_TEST_PRIVATE_KEY. Any connection with AWS IoT must be secured.

Possible values: true (secured connection) or false (unsecured connection)
Recommended values: When testing against AWS IoT, connections must be secured. Therefore, the recommended value for this setting is true.
Default value (if undefined): true

IOT_TEST_SERVER

The remote host to use in the tests.

Tests using the network will open TCP connections to this host. When testing against AWS IoT, this should be set to the AWS account's custom IoT endpoint. This custom endpoint can be found under the Settings tab of the AWS IoT console. It has a format of ABCDEFG1234567.iot.us-east-2.amazonaws.com, where ABCDEFG1234567 is a placeholder subdomain and us-east-2 is the region.

No default value is provided for this setting. If this setting is undefined, the tests will fail to compile.

Possible values: Any string representing a hostname, such as

  • ABCDEFG1234567.iot.us-east-2.amazonaws.com
  • 192.168.1.1
  • localhost

IOT_TEST_PORT

The remote port to use in the tests.

Tests using the network will open TCP connections to IOT_TEST_SERVER on this port. When testing against AWS IoT, this should be set to either 443 or 8883. Port 8883 provides a standard encrypted MQTT connection, while port 443 provides a secured MQTT connection using ALPN.

No default value is provided for this setting. If this setting is undefined, the tests will fail to compile.

Possible values: Any positive integer below 65536.
Recommended values: When testing against AWS IoT, port 443 is recommended.

IOT_TEST_ROOT_CA

The path to the trusted server root certificate to use in the tests.

A trusted server root certificate only needs to be set for secured connections. See this page for more information about AWS IoT server certificates.

No default value is provided for this setting. If this setting is undefined, tests requiring secured connections will fail to compile.

Possible values: Any string representing a filesystem path to a PEM-encoded trusted server root certificate.
Recommended values: When testing against AWS IoT, one of these root certificates should be used.

IOT_TEST_CLIENT_CERT

The path to the client certificate to use in the tests.

A client certificate only needs to be set for secured connections. See this page for a tutorial on how to set up client certificates with AWS IoT.

No default value is provided for this setting. If this setting is undefined, tests requiring secured connections will fail to compile.

Possible values: Any string representing a filesystem path to a PEM-encoded client certificate.

IOT_TEST_PRIVATE_KEY

The path to the client certificate private key to use in the tests.

A client certificate private key only needs to be set for secured connections. This private key must match the client certificate.

No default value is provided for this setting. If this setting is undefined, tests requiring secured connections will fail to compile.

Possible values: Any string representing a filesystem path to a PEM-encoded private key matching the client certificate.