Testing

Testing

12 July 2024 seperator dot louisej

This section details how we test our builds internally using unit testing and test utilities.

Contents

 

Credential Manager Testing

Unit Tests

The Credential Manager has a suite of unit tests to allow us to exercise its functionality without the need for a DDKG or a KeyScaler. This is especially useful for asset processing source code as it allows injection of data into these processors to test positive and negative cases.

The DeviceAuthority object provides access to DDKG related functionality such as generating Dynamic Device Keys (DDK). This object is abstracted to allow for tests to run with a simulated DDKG, however, for some tests a real DDK library is still required so it must be included in the library search path (LD_LIBRARY_PATH / PATH).

Unit testing in Credential Manager uses gtest https://github.com/google/googletest. These gtest libraries must also be on the library search path (LD_LIBRARY_PATH / PATH).

How to run

Our Makefiles support building and running the tests. Simply run:

make runtests -j8

You may need to include a path for the gtest and DDKG libraries. This can be achieved by running:

LD_LIBRARY_PATH=/path/to/DDKG:/path/to/gtest/ make runtests -j8

Note that the LD_LIBRARY_PATH paths must be colon delimited. Declaring this in-line with the runtests command ensures it does not change this property for any other commands within your session window.

 

[Back to Top]

DDKG Testing

DDKDemo

We build an application that exercises the attribute getters built into a DDKG library. This allows us to run the DDKG code within a simple application that prints the data gathered from a device to the terminal.

This utility is very useful for early identification of issues reading attributes from a device. If an external DDKG is being used this tool also displays any virtual attributes reported by a third-party library.

To build DDKDemo we provide a Makefile and associated source code.

How to run

To run DDKGDemo simply run:

./ddkdemo -o raw

This outputs the data collected from the host machine in a human readable format. Without this -o switch it will only print yay or nay indicating whether the property has been successfully read from the host machine.

 

[Back to Top]