| /* |
| * Copyright 2017, Data61 |
| * Commonwealth Scientific and Industrial Research Organisation (CSIRO) |
| * ABN 41 687 119 230. |
| * |
| * This software may be distributed and modified according to the terms of |
| * the BSD 2-Clause license. Note that NO WARRANTY is provided. |
| * See "LICENSE_BSD2.txt" for details. |
| * |
| * @TAG(DATA61_BSD) |
| */ |
| |
| #pragma once |
| |
| /* Include Kconfig variables. */ |
| #include <autoconf.h> |
| #include <sel4test/gen_config.h> |
| |
| #define SEL4TEST_PRINT_BUFFER 200 |
| |
| /** |
| * When running a test suite, we want to output any output from the suite in a |
| * <stdout></stdout> section. But for debugging we do not want this. Therefore |
| * you should *disable* CONFIG_PRINT_XML while debugging tests. |
| */ |
| #ifdef CONFIG_PRINT_XML |
| #include <stdio.h> |
| #define printf(x, ...) do {\ |
| char buffer[SEL4TEST_PRINT_BUFFER];\ |
| snprintf(buffer, SEL4TEST_PRINT_BUFFER, x, ##__VA_ARGS__);\ |
| sel4test_printf(buffer);\ |
| } while(0) |
| #endif /* CONFIG_PRINT_XML */ |
| |
| #define sel4test_case_with_message(condition, message) do {\ |
| if(!(condition)) {\ |
| sel4test_report_error(message);\ |
| }\ |
| } while(0) |
| /** |
| * Like an assert but does not crash the build. |
| */ |
| #define sel4test_case(condition) do {\ |
| if(!(condition)) {\ |
| sel4test_report_error("");\ |
| }\ |
| } while(0) |
| |
| /** |
| * Report an error in the test |
| */ |
| #define sel4test_report_error(x) _sel4test_report_error(x, __FILE__, __LINE__) |
| |
| /** |
| * Report a failure in the test |
| */ |
| #define sel4test_failure(x) _sel4test_failure(x, __FILE__, __LINE__) |