1# system/ulib/test-utils
2
3This library contains wrappers and utilities to simplify writing tests.
4As a general rule one needs to check the result of every system call
5or library call. It's important, but it's also a pain.
6The wrappers here check the result and only return upon success.
7E.g., tu_malloc() only returns if malloc succeeded.
8If the call fails the process is terminated.
9It's possible to be a bit more clever but for the particular
10things that are wrapped, if the call fails there's not much point
11in continuing the test. And if there is a point to continuing
12the test then don't use these wrappers.
13Note that that means that these calls aren't to be
14used willy-nilly. If you're testing, say, memory exhaustion with malloc
15then you do want to verify that malloc returns NULL and thus you do not
16want to use the tu_malloc wrapper for this.
17