* Rename to use Config, rather than StateHandle/Globals/Backend * Make Backend a type on Config that contains the address space management implementation * Make Ranges part of the Backend configuration, so we can reuse code for different ways of managing memory * Pull the common chains of range definitions into separate files for reuse. * Move PagemapEntry to CommonConfig * Expose Pagemap through backend, so frontend doesn't see Pagemap directly * Remove global Pal and use DefaultPal, where one is not pass explicitly. Co-authored-by: David Chisnall <davidchisnall@users.noreply.github.com> Co-authored-by: Nathaniel Filardo <105816689+nwf-msr@users.noreply.github.com>
40 lines
902 B
C++
40 lines
902 B
C++
#pragma once
|
|
#ifdef _MSC_VER
|
|
# define __PRETTY_FUNCTION__ __FUNCSIG__
|
|
#endif
|
|
|
|
namespace snmalloc
|
|
{
|
|
/**
|
|
* The name of the function under test. This is set in the START_TEST macro
|
|
* and used for error reporting in EXPECT.
|
|
*/
|
|
const char* current_test = "";
|
|
|
|
/**
|
|
* Log that the test started.
|
|
*/
|
|
#define START_TEST(msg, ...) \
|
|
do \
|
|
{ \
|
|
current_test = __PRETTY_FUNCTION__; \
|
|
MessageBuilder<1024> mb{"Starting test: " msg "\n", ##__VA_ARGS__}; \
|
|
DefaultPal::message(mb.get_message()); \
|
|
} while (0)
|
|
|
|
/**
|
|
* An assertion that fires even in debug builds. Uses the value set by
|
|
* START_TEST.
|
|
*/
|
|
#define EXPECT(x, msg, ...) \
|
|
SNMALLOC_CHECK_MSG(x, " in test {} " msg "\n", current_test, ##__VA_ARGS__)
|
|
|
|
#define INFO(msg, ...) \
|
|
do \
|
|
{ \
|
|
MessageBuilder<1024> mb{msg "\n", ##__VA_ARGS__}; \
|
|
DefaultPal::message(mb.get_message()); \
|
|
} while (0)
|
|
|
|
}
|