Xen Test Framework
Macros | Enumerations | Functions | Variables
report.c File Reference
#include <xtf/lib.h>
#include <xtf/report.h>
#include <xtf/hypercall.h>
+ Include dependency graph for report.c:

Go to the source code of this file.

Macros

#define STA(x)   [STATUS_ ## x] = #x
 

Enumerations

enum  test_status {
  STATUS_RUNNING, STATUS_SUCCESS, STATUS_SKIP, STATUS_ERROR,
  STATUS_FAILURE
}
 

Functions

static void set_status (enum test_status s)
 
void xtf_success (const char *fmt,...)
 Report test success. More...
 
void xtf_warning (const char *fmt,...)
 Report a test warning. More...
 
void xtf_skip (const char *fmt,...)
 Report a test skip. More...
 
void xtf_error (const char *fmt,...)
 Report a test error. More...
 
void xtf_failure (const char *fmt,...)
 Report a test failure. More...
 
void xtf_report_status (void)
 Print a status report. More...
 
bool xtf_status_reported (void)
 Query whether a status has already been reported. More...
 
void xtf_exit (void)
 Exit the test early. More...
 

Variables

static enum test_status status
 Current status of this test. More...
 
static bool warnings
 Whether a warning has occurred. More...
 
static const char * status_to_str []
 

Macro Definition Documentation

◆ STA

#define STA (   x)    [STATUS_ ## x] = #x

Enumeration Type Documentation

◆ test_status

Enumerator
STATUS_RUNNING 

Test not yet completed.

STATUS_SUCCESS 

Test was successful.

STATUS_SKIP 

Test cannot be completed.

STATUS_ERROR 

Issue with the test itself.

STATUS_FAILURE 

Issue with the tested matter.

Definition at line 5 of file report.c.

Function Documentation

◆ set_status()

static void set_status ( enum test_status  s)
static

Definition at line 32 of file report.c.

+ Here is the caller graph for this function:

◆ xtf_success()

void xtf_success ( const char *  fmt,
  ... 
)

Report test success.

Definition at line 38 of file report.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xtf_warning()

void xtf_warning ( const char *  fmt,
  ... 
)

Report a test warning.

Does not count against a test success, but does indicate that some problem was encountered.

Definition at line 52 of file report.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xtf_skip()

void xtf_skip ( const char *  fmt,
  ... 
)

Report a test skip.

Indicates that the test cannot be completed. This may count as a success or failure, depending on the opinion of the tester.

Definition at line 66 of file report.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xtf_error()

void xtf_error ( const char *  fmt,
  ... 
)

Report a test error.

Indicates an error with the test code, or environment, and not with the subject matter under test.

Definition at line 80 of file report.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xtf_failure()

void xtf_failure ( const char *  fmt,
  ... 
)

Report a test failure.

Indicates that the subject matter under test has failed to match expectation.

Definition at line 94 of file report.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xtf_report_status()

void xtf_report_status ( void  )

Print a status report.

If a report has not yet been set, an error will occur.

Definition at line 108 of file report.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xtf_status_reported()

bool xtf_status_reported ( void  )

Query whether a status has already been reported.

Definition at line 119 of file report.c.

+ Here is the caller graph for this function:

◆ xtf_exit()

void xtf_exit ( void  )

Exit the test early.

Reports the current status. Does not return.

Definition at line 124 of file report.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ status

enum test_status status
static

Current status of this test.

Definition at line 14 of file report.c.

◆ warnings

bool warnings
static

Whether a warning has occurred.

Definition at line 17 of file report.c.

◆ status_to_str

const char* status_to_str[]
static
Initial value:
=
{
#define STA(x)
STA(RUNNING),
STA(SUCCESS),
STA(SKIP),
STA(ERROR),
STA(FAILURE),
}
#define STA(x)

Definition at line 19 of file report.c.