|
1 |
| -## My Project |
| 1 | +# Device Defender Client Library |
2 | 2 |
|
3 |
| -TODO: Fill this README out! |
| 3 | +This repository contains the Device Defender client library for interacting with |
| 4 | +the [AWS IoT Device Defender Service](https://aws.amazon.com/iot-device-defender/). |
| 5 | +This library has no dependencies on any additional libraries other than the |
| 6 | +standard C library, and therefore, can be used with any MQTT client library. |
| 7 | +This library is distributed under the [MIT Open Source License](LICENSE). |
4 | 8 |
|
5 |
| -Be sure to: |
| 9 | +This library has gone through code quality checks including verification that no |
| 10 | +function has a [GNU Complexity](https://www.gnu.org/software/complexity/manual/complexity.html) |
| 11 | +score over 8. |
6 | 12 |
|
7 |
| -* Change the title in this README |
8 |
| -* Edit your repository description on GitHub |
| 13 | +## Device Defender Config File |
9 | 14 |
|
10 |
| -## Security |
| 15 | +The Device Defender client library exposes build configuration macros that are |
| 16 | +required for building the library. A list of all the configurations and their |
| 17 | +default values are defined in |
| 18 | +[defender_config_defaults.h](source/include/defender_config_defaults.h). |
| 19 | +To provide custom values for the configuration macros, a config file named |
| 20 | +`defender_config.h` can be provided by the application to the library. |
11 | 21 |
|
12 |
| -See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. |
| 22 | +By default, a `defender_config.h` config file is required to build the library. |
| 23 | +To disable this requirement and build the library with default configuration |
| 24 | +values, provide `DEFENDER_DO_NOT_USE_CUSTOM_CONFIG` as a compile time |
| 25 | +preprocessor macro. |
13 | 26 |
|
14 |
| -## License |
| 27 | +**Thus, the Device Defender client library can be built by either**: |
| 28 | +* Defining a `defender_config.h` file in the application, and adding it to the |
| 29 | +include directories list of the library. |
15 | 30 |
|
16 |
| -This library is licensed under the MIT-0 License. See the LICENSE file. |
| 31 | +**OR** |
17 | 32 |
|
| 33 | +* Defining the `DEFENDER_DO_NOT_USE_CUSTOM_CONFIG` preprocessor macro for the |
| 34 | +library build. |
| 35 | + |
| 36 | +## Building the Library |
| 37 | + |
| 38 | +The [defenderFilePaths.cmake](defenderFilePaths.cmake) file contains the |
| 39 | +information of all source files and the header include paths required to build |
| 40 | +the Device Defender client library. |
| 41 | + |
| 42 | +As mentioned in the previous section, either a custom config file |
| 43 | +(i.e. `defender_config.h`) or `DEFENDER_DO_NOT_USE_CUSTOM_CONFIG` macro needs to |
| 44 | +be provided to build the Device Defender client library. |
| 45 | + |
| 46 | +For a CMake example of building the Device Defender client library with the |
| 47 | +`defenderFilePaths.cmake` file, refer to the `coverity_analysis` library target |
| 48 | +in [test/CMakeLists.txt](test/CMakeLists.txt) file. |
| 49 | + |
| 50 | +## Building Unit Tests |
| 51 | + |
| 52 | +### Platform Prerequisites |
| 53 | + |
| 54 | +- For running unit tests: |
| 55 | + - **C90 compiler** like gcc. |
| 56 | + - **CMake 3.13.0 or later**. |
| 57 | + - **Ruby 2.0.0 or later** is additionally required for the CMock test framework (that we use). |
| 58 | +- For running the coverage target, **gcov** and **lcov** are additionally required. |
| 59 | + |
| 60 | +### Steps to build **Unit Tests** |
| 61 | + |
| 62 | +1. Go to the root directory of this repository. |
| 63 | + |
| 64 | +1. Run the *cmake* command: `cmake -S test -B build -DBUILD_CLONE_SUBMODULES=ON`. |
| 65 | + |
| 66 | +1. Run this command to build the library and unit tests: `make -C build all`. |
| 67 | + |
| 68 | +1. The generated test executables will be present in `build/bin/tests` folder. |
| 69 | + |
| 70 | +1. Run `cd build && ctest` to execute all tests and view the test run summary. |
0 commit comments