Crinit -- Configurable Rootfs Init
|
Implementation of a regression test if default values for all global options are present and intialized. More...
#include <string.h>
#include "common.h"
#include "confmap.h"
#include "globopt.h"
#include "logio.h"
#include "unit_test.h"
#include "utest-globopt-defaults.h"
Macros | |
#define | CRINIT_BIT_TEST_PATTERN 0xAA |
#define | CRINIT_FAKE_POINTER 0xC001C0D3Lu |
Functions | |
void | crinitGlobDefRegressionTest (void **state) |
Implementation of a regression test if default values for all global options are present and intialized.
#define CRINIT_BIT_TEST_PATTERN 0xAA |
The test pattern to pre-init the global option struct with.
#define CRINIT_FAKE_POINTER 0xC001C0D3Lu |
A pointer to be returned by allocation functions, different from CRINIT_BIT_TEST_PATTERN and NULL.
void crinitGlobDefRegressionTest | ( | void ** | state | ) |
Regression test for default initialization of global options.
Pre-Initializes the global option struct using a unique bit pattern (different from all defaults) and then checks if parts of the pattern remain after crinitGlobOptInitDefault() which would indicate an uninitialized value, i.e. a missing default.
Allocation functions are mocked such that there is no ambiguity between the test pattern and a calloc() or strdup() return value. memset() is mocked to a no-op, so that crinitGlobOptDefault() does not zero-out the test pattern before initializing elements.