mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 05:27:44 +00:00
Add okv function to the TAP test library
Add an okv() varient of the ok() function that takes the arguments as a va_list instead of as a variable argument list. This makes it easier to reuse ok() when writing other tests. Change-Id: Icaeaaf9d6bd9d54bfd886a75961d98367ee0fb9a Reviewed-on: http://gerrit.openafs.org/2098 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
53304359a7
commit
74a332e7ee
@ -175,6 +175,21 @@ ok(int success, const char *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Same as ok(), but takes the format arguments as a va_list.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
okv(int success, const char *format, va_list args)
|
||||||
|
{
|
||||||
|
printf("%sok %lu", success ? "" : "not ", testnum++);
|
||||||
|
if (!success)
|
||||||
|
_failed++;
|
||||||
|
if (format != NULL)
|
||||||
|
print_desc(format, args);
|
||||||
|
putchar('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip a test.
|
* Skip a test.
|
||||||
*/
|
*/
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#ifndef TAP_BASIC_H
|
#ifndef TAP_BASIC_H
|
||||||
#define TAP_BASIC_H 1
|
#define TAP_BASIC_H 1
|
||||||
|
|
||||||
|
#include <stdarg.h> /* va_list */
|
||||||
#include <sys/types.h> /* pid_t */
|
#include <sys/types.h> /* pid_t */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -72,9 +73,14 @@ void plan_lazy(void);
|
|||||||
void skip_all(const char *format, ...)
|
void skip_all(const char *format, ...)
|
||||||
__attribute__((__noreturn__, __format__(printf, 1, 2)));
|
__attribute__((__noreturn__, __format__(printf, 1, 2)));
|
||||||
|
|
||||||
/* Basic reporting functions. */
|
/*
|
||||||
|
* Basic reporting functions. The okv() function is the same as ok() but
|
||||||
|
* takes the test description as a va_list to make it easier to reuse the
|
||||||
|
* reporting infrastructure when writing new tests.
|
||||||
|
*/
|
||||||
void ok(int success, const char *format, ...)
|
void ok(int success, const char *format, ...)
|
||||||
__attribute__((__format__(printf, 2, 3)));
|
__attribute__((__format__(printf, 2, 3)));
|
||||||
|
void okv(int success, const char *format, va_list args);
|
||||||
void skip(const char *reason, ...)
|
void skip(const char *reason, ...)
|
||||||
__attribute__((__format__(printf, 1, 2)));
|
__attribute__((__format__(printf, 1, 2)));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user