mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 22:33:37 +01:00
Update to the latest tinytest version
This cleans up some whitespace consistency issues and, more importantly, gives you the ability to skip tests from the command line.
This commit is contained in:
parent
c05c8dbd78
commit
608d1614b9
@ -1,4 +1,4 @@
|
|||||||
/* tinytest.c -- Copyright 2009 Nick Mathewson
|
/* tinytest.c -- Copyright 2009-2010 Nick Mathewson
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -40,6 +40,9 @@
|
|||||||
#define __attribute__(x)
|
#define __attribute__(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef TINYTEST_LOCAL
|
||||||
|
#include "tinytest_local.h"
|
||||||
|
#endif
|
||||||
#include "tinytest.h"
|
#include "tinytest.h"
|
||||||
#include "tinytest_macros.h"
|
#include "tinytest_macros.h"
|
||||||
|
|
||||||
@ -270,6 +273,7 @@ usage(struct testgroup_t *groups, int list_groups)
|
|||||||
{
|
{
|
||||||
puts("Options are: [--verbose|--quiet|--terse] [--no-fork]");
|
puts("Options are: [--verbose|--quiet|--terse] [--no-fork]");
|
||||||
puts(" Specify tests by name, or using a prefix ending with '..'");
|
puts(" Specify tests by name, or using a prefix ending with '..'");
|
||||||
|
puts(" To skip a test, list give its name prefixed with a colon.");
|
||||||
puts(" Use --list-tests for a list of tests.");
|
puts(" Use --list-tests for a list of tests.");
|
||||||
if (list_groups) {
|
if (list_groups) {
|
||||||
puts("Known tests are:");
|
puts("Known tests are:");
|
||||||
@ -309,9 +313,16 @@ tinytest_main(int c, const char **v, struct testgroup_t *groups)
|
|||||||
printf("Unknown option %s. Try --help\n",v[i]);
|
printf("Unknown option %s. Try --help\n",v[i]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
const char *test = v[i];
|
||||||
|
int flag = _TT_ENABLED;
|
||||||
|
if (test[0] == ':') {
|
||||||
|
++test;
|
||||||
|
flag = TT_SKIP;
|
||||||
} else {
|
} else {
|
||||||
++n;
|
++n;
|
||||||
if (!_tinytest_set_flag(groups, v[i], _TT_ENABLED)) {
|
}
|
||||||
|
if (!_tinytest_set_flag(groups, test, flag)) {
|
||||||
printf("No such test as %s!\n", v[i]);
|
printf("No such test as %s!\n", v[i]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* tinytest.h -- Copyright 2009 Nick Mathewson
|
/* tinytest.h -- Copyright 2009-2010 Nick Mathewson
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* tinytest_macros.h -- Copyright 2009 Nick Mathewson
|
/* tinytest_macros.h -- Copyright 2009-2010 Nick Mathewson
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
/* Helpers for defining statement-like macros */
|
/* Helpers for defining statement-like macros */
|
||||||
#define TT_STMT_BEGIN do {
|
#define TT_STMT_BEGIN do {
|
||||||
#define TT_STMT_END } while(0)
|
#define TT_STMT_END } while (0)
|
||||||
|
|
||||||
/* Redefine this if your test functions want to abort with something besides
|
/* Redefine this if your test functions want to abort with something besides
|
||||||
* "goto end;" */
|
* "goto end;" */
|
||||||
|
Loading…
Reference in New Issue
Block a user