Writing Intel SGX Unit Tests with GoogleTest
No one likes writing unit tests. It’s tedious and people usually do it only to achieve the next milestone in a project (sadly). However, unit tests come in handy when you develop a new algorithm and iteratively improve its performance. You want to make sure that with each iteration not only you improve the performance but also keep the correctness of your solution. This working methodology remains the same for new hardware platforms, such as Intel SGX. However, with the peculiar way SGX programs compile it is non-trivial to integrate them with the existing C/C++ testing frameworks. I have not found any existing solution to this problem and decided to give it try. This post presents my approach to writing unit tests for Intel SGX applications using the GoogleTest framework. The remaining of the post explains step-by-step how I refactored Sample Enclave, one of the sample SGX projects provided by Intel, to work with GoogleTest.
Kajetan Maliszewski