summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2019-08-25 16:53:31 +0100
committerLaurent Bigonville <bigon@debian.org>2020-03-15 15:49:35 +0000
commit5060cb7395717970686630affd0b9d4c0260d107 (patch)
tree9a75841981af3ce1bdd17aed902acb800bc88230
parent2e259535a624acbd7ec0132def5fbb90f1ff2b5c (diff)
Normally skip tests that are not expected to succeed
If a test is not expected to succeed, then running it could be considered to be a waste of resources, particularly if the failure might manifest as an indefinite hang (see !11), or if the test is likely to dump core and trigger "expensive" crash-reporting mechanisms like systemd-coredump, corekeeper, abrt or apport. Skip the tests that are expected to fail. They can still be requested via an environment variable, which can be set after fixing a bug to check which tests are now passing. Signed-off-by: Simon McVittie <smcv@debian.org> Forwarded: https://gitlab.gnome.org/GNOME/cogl/-/merge_requests/15 Gbp-Pq: Name Normally-skip-tests-that-are-not-expected-to-succeed.patch
-rw-r--r--test-fixtures/test-utils.c4
-rw-r--r--test-fixtures/test-utils.h2
-rw-r--r--tests/conform/test-conform-main.c15
-rw-r--r--tests/unit/test-unit-main.c18
4 files changed, 27 insertions, 12 deletions
diff --git a/test-fixtures/test-utils.c b/test-fixtures/test-utils.c
index faa9e1f7..d6c592cf 100644
--- a/test-fixtures/test-utils.c
+++ b/test-fixtures/test-utils.c
@@ -129,7 +129,7 @@ is_boolean_env_set (const char *variable)
return ret;
}
-void
+CoglBool
test_utils_init (TestFlags requirement_flags,
TestFlags known_failure_flags)
{
@@ -213,6 +213,8 @@ test_utils_init (TestFlags requirement_flags,
g_print ("WARNING: Missing required feature[s] for this test\n");
else if (known_failure)
g_print ("WARNING: Test is known to fail\n");
+
+ return (!missing_requirement && !known_failure);
}
void
diff --git a/test-fixtures/test-utils.h b/test-fixtures/test-utils.h
index 9c3ced9b..e59163c8 100644
--- a/test-fixtures/test-utils.h
+++ b/test-fixtures/test-utils.h
@@ -69,7 +69,7 @@ typedef enum {
extern CoglContext *test_ctx;
extern CoglFramebuffer *test_fb;
-void
+CoglBool
test_utils_init (TestFlags requirement_flags,
TestFlags known_failure_flags);
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index ee668999..63ae15f9 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -15,10 +15,17 @@
extern void FUNC (void); \
if (strcmp (#FUNC, argv[1]) == 0) \
{ \
- test_utils_init (REQUIREMENTS, KNOWN_FAIL_REQUIREMENTS); \
- FUNC (); \
- test_utils_fini (); \
- exit (0); \
+ if (test_utils_init (REQUIREMENTS, KNOWN_FAIL_REQUIREMENTS) \
+ || g_getenv ("COGL_TEST_TRY_EVERYTHING") != NULL) \
+ { \
+ FUNC (); \
+ test_utils_fini (); \
+ exit (0); \
+ } \
+ else \
+ { \
+ exit (1); \
+ } \
} \
} G_STMT_END
diff --git a/tests/unit/test-unit-main.c b/tests/unit/test-unit-main.c
index b1f78645..6065b083 100644
--- a/tests/unit/test-unit-main.c
+++ b/tests/unit/test-unit-main.c
@@ -36,10 +36,16 @@ main (int argc, char **argv)
return 1;
}
- test_utils_init (unit_test->requirement_flags,
- unit_test->known_failure_flags);
- unit_test->run ();
- test_utils_fini ();
-
- return 0;
+ if (test_utils_init (unit_test->requirement_flags,
+ unit_test->known_failure_flags)
+ || g_getenv ("COGL_TEST_TRY_EVERYTHING") != NULL)
+ {
+ unit_test->run ();
+ test_utils_fini ();
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
}