diff --git a/app/tests.h b/app/tests.h index 0f783fa483..c331064421 100644 --- a/app/tests.h +++ b/app/tests.h @@ -18,6 +18,16 @@ #ifndef __TESTS_H__ #define __TESTS_H__ +/* Automake doc says: + "When no test protocol is in use, an exit status of 0 from a test + script will denote a success, an exit status of 77 a skipped test, + an exit status of 99 an hard error, and any other exit status will + denote a failure." + + Unfortunately glib returns a SUCCESS when you skip tests, which is + not a reliable test feedback. So we hard-code the SKIPPED return + value. */ +#define GIMP_EXIT_TEST_SKIPPED 77 Gimp * gimp_init_for_testing (void); Gimp * gimp_init_for_gui_testing (gboolean show_gui); diff --git a/app/tests/test-session-2-6-compatibility.c b/app/tests/test-session-2-6-compatibility.c index 8d27a23ace..0333655f38 100644 --- a/app/tests/test-session-2-6-compatibility.c +++ b/app/tests/test-session-2-6-compatibility.c @@ -30,6 +30,9 @@ #define ADD_TEST(function) \ g_test_add_func ("/gimp-session-2-6-compatibility/" #function, function); +#define SKIP_TEST(function) \ + g_test_add_func ("/gimp-session-2-6-compatibility/subprocess/" #function, function); + /** * Tests that a sessionrc and dockrc from GIMP 2.6 is loaded and @@ -50,8 +53,16 @@ int main(int argc, char **argv) gimp_test_bail_if_no_display (); gtk_test_init (&argc, &argv, NULL); +#ifdef HAVE_XVFB_RUN ADD_TEST (read_and_write_session_files); +#else + SKIP_TEST (read_and_write_session_files); +#endif /* Don't bother freeing stuff, the process is short-lived */ +#ifdef HAVE_XVFB_RUN return g_test_run (); +#else + return GIMP_EXIT_TEST_SKIPPED; +#endif } diff --git a/app/tests/test-session-2-8-compatibility-multi-window.c b/app/tests/test-session-2-8-compatibility-multi-window.c index c72398e329..c46341f3cb 100644 --- a/app/tests/test-session-2-8-compatibility-multi-window.c +++ b/app/tests/test-session-2-8-compatibility-multi-window.c @@ -31,6 +31,10 @@ g_test_add_func ("/gimp-session-2-8-compatibility-multi-window/" #function, \ function); +#define SKIP_TEST(function) \ + g_test_add_func ("/gimp-session-2-8-compatibility-multi-window/subprocess/" #function, \ + function); + /** * Tests that a single-window sessionrc in GIMP 2.8 format is loaded @@ -51,8 +55,16 @@ int main(int argc, char **argv) gimp_test_bail_if_no_display (); gtk_test_init (&argc, &argv, NULL); +#ifdef HAVE_XVFB_RUN ADD_TEST (read_and_write_session_files); +#else + SKIP_TEST (read_and_write_session_files); +#endif /* Don't bother freeing stuff, the process is short-lived */ +#ifdef HAVE_XVFB_RUN return g_test_run (); +#else + return GIMP_EXIT_TEST_SKIPPED; +#endif } diff --git a/app/tests/test-session-2-8-compatibility-single-window.c b/app/tests/test-session-2-8-compatibility-single-window.c index a9811d52ce..3f566441e8 100644 --- a/app/tests/test-session-2-8-compatibility-single-window.c +++ b/app/tests/test-session-2-8-compatibility-single-window.c @@ -31,6 +31,9 @@ g_test_add_func ("/gimp-session-2-8-compatibility-single-window/" #function, \ function); +#define SKIP_TEST(function) \ + g_test_add_func ("/gimp-session-2-8-compatibility-single-window/subprocess/" #function, \ + function); /** * Tests that a multi-window sessionrc in GIMP 2.8 format is loaded @@ -51,8 +54,16 @@ int main(int argc, char **argv) gimp_test_bail_if_no_display (); gtk_test_init (&argc, &argv, NULL); +#ifdef HAVE_XVFB_RUN ADD_TEST (read_and_write_session_files); +#else + SKIP_TEST (read_and_write_session_files); +#endif /* Don't bother freeing stuff, the process is short-lived */ +#ifdef HAVE_XVFB_RUN return g_test_run (); +#else + return GIMP_EXIT_TEST_SKIPPED; +#endif } diff --git a/configure.ac b/configure.ac index 48e9c15546..a56aa9f762 100644 --- a/configure.ac +++ b/configure.ac @@ -1960,6 +1960,7 @@ if test "x$with_xvfb_run" != "xno"; then AC_PATH_PROG(XVFB_RUN, xvfb-run, no) if test "x$XVFB_RUN" != "xno"; then have_xvfb_run="yes" + AC_DEFINE(HAVE_XVFB_RUN, 1, [Define to 1 if xvfb-run is available]) else have_xvfb_run="no (not found)" fi