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:
Nick Mathewson 2010-09-09 14:34:10 -04:00
parent c05c8dbd78
commit 608d1614b9
3 changed files with 26 additions and 15 deletions

View File

@ -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;
} }

View File

@ -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

View File

@ -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