summaryrefslogtreecommitdiff
path: root/test/tinytest.h
diff options
context:
space:
mode:
authorAzat Khuzhin <a3at.mail@gmail.com>2018-11-20 01:06:04 +0300
committerAzat Khuzhin <a3at.mail@gmail.com>2018-11-20 22:56:28 +0300
commit63b065be80d57dfee4688ddc32b8344e922648d9 (patch)
tree4a0c909a8309b2259bf725b676b0efb4f96b8090 /test/tinytest.h
parent57765b23c81a9150ca0f77ed5f4d9b64a43cf30d (diff)
downloadlibevent-63b065be80d57dfee4688ddc32b8344e922648d9.tar.gz
regress: introduce TT_RETRIABLE
We have some tests that has false-positive due to real/CPU time bound, but they are pretty generic and we do not want to skip them by default. TT_RETRIABLE is the flag that will indicate tinytest to retry the test in case of failure, use it to avoid next possible false-positives: - real time-related - CPU time-related Since I guess it is better to see/grepping RETRYING messages over ignoring completely failed builds. No configuration switch for number of retries was done on purpose (only 3 retries and no more). And this is how it looks BTW: $ gcc ../test/tinytest_demo.c ../test/tinytest.c $ ./a.out --verbose --no-fork demo/timeout_retry demo/timeout_retry: FAIL ../test/tinytest_demo.c:201: assert(i != 1): 1 vs 1 [timeout_retry FAILED] [RETRYING timeout_retry (3)] demo/timeout_retry: OK ../test/tinytest_demo.c:201: assert(i != 1): 2 vs 1 OK ../test/tinytest_demo.c:213: assert(t2-t1 >= 4): 5 vs 4 OK ../test/tinytest_demo.c:215: assert(t2-t1 <= 6): 5 vs 6 1 tests ok. (0 skipped)
Diffstat (limited to 'test/tinytest.h')
-rw-r--r--test/tinytest.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/tinytest.h b/test/tinytest.h
index ed07b26b..d321dd46 100644
--- a/test/tinytest.h
+++ b/test/tinytest.h
@@ -34,8 +34,11 @@
#define TT_ENABLED_ (1<<2)
/** Flag for a test that's off by default. */
#define TT_OFF_BY_DEFAULT (1<<3)
+/** Flag for a test that should be runned again in case of failure (but not
+ * more then 3 times). */
+#define TT_RETRIABLE (1<<4)
/** If you add your own flags, make them start at this point. */
-#define TT_FIRST_USER_FLAG (1<<4)
+#define TT_FIRST_USER_FLAG (1<<5)
typedef void (*testcase_fn)(void *);