]> granicus.if.org Git - check/commitdiff
* introduce HAVE_WORKING_SETENV to protect tc_timeout_env usage
authorcpickett <cpickett@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Wed, 31 Dec 2008 23:45:29 +0000 (23:45 +0000)
committercpickett <cpickett@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Wed, 31 Dec 2008 23:45:29 +0000 (23:45 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@514 64e312b2-a51f-0410-8e61-82d0ca0eb02a

lib/libcompat.h
tests/check_check_sub.c

index 69612172046f77adf29f426fd017d3ac31d2d4f1..e0085c66fbbd54a3dea24174d0a200a7bc8cb313 100644 (file)
@@ -79,6 +79,13 @@ int putenv (const char *string);
 int setenv (const char *name, const char *value, int overwrite);
 #endif /* !HAVE_DECL_SETENV */
 
+/* our setenv implementation is currently broken */
+#if !HAVE_SETENV
+#define HAVE_WORKING_SETENV 0
+#else
+#define HAVE_WORKING_SETENV 1
+#endif
+
 #if !HAVE_DECL_SLEEP
 unsigned int sleep (unsigned int seconds);
 #endif /* !HAVE_DECL_SLEEP */
index 905ee7d597b547b81d77c95108ea46959545e17f..09f843e4503ee83033e6d89b9335aaf40e4d3535 100644 (file)
@@ -472,7 +472,9 @@ Suite *make_sub_suite(void)
   TCase *tc_simple;
   TCase *tc_signal;
 #if TIMEOUT_TESTS_ENABLED
+#if HAVE_WORKING_SETENV
   TCase *tc_timeout_env;
+#endif /* HAVE_WORKING_SETENV */
   TCase *tc_timeout;
   TCase *tc_timeout_usr;
 #endif
@@ -484,9 +486,11 @@ Suite *make_sub_suite(void)
   tc_simple = tcase_create("Simple Tests");
   tc_signal = tcase_create("Signal Tests");
 #if TIMEOUT_TESTS_ENABLED
+#if HAVE_WORKING_SETENV
   setenv("CK_DEFAULT_TIMEOUT", "6", 1);
   tc_timeout_env = tcase_create("Environment Timeout Tests");
   unsetenv("CK_DEFAULT_TIMEOUT");
+#endif /* HAVE_WORKING_SETENV */
   tc_timeout = tcase_create("Timeout Tests");
   tc_timeout_usr = tcase_create("User Timeout Tests");
 #endif
@@ -496,7 +500,9 @@ Suite *make_sub_suite(void)
   suite_add_tcase (s, tc_simple);
   suite_add_tcase (s, tc_signal);
 #if TIMEOUT_TESTS_ENABLED
+#if HAVE_WORKING_SETENV
   suite_add_tcase (s, tc_timeout_env);
+#endif /* HAVE_WORKING_SETENV */
   suite_add_tcase (s, tc_timeout);
   suite_add_tcase (s, tc_timeout_usr);
   /* Add a second time to make sure tcase_set_timeout doesn't contaminate it. */
@@ -545,10 +551,12 @@ Suite *make_sub_suite(void)
   tcase_add_test (tc_signal, test_mark_point);
 
 #if TIMEOUT_TESTS_ENABLED
+#if HAVE_WORKING_SETENV
   tcase_add_test (tc_timeout_env, test_eternal);
   tcase_add_test (tc_timeout_env, test_sleep2);
   tcase_add_test (tc_timeout_env, test_sleep5);
   tcase_add_test (tc_timeout_env, test_sleep8);
+#endif /* HAVE_WORKING_SETENV */
 
   tcase_add_test (tc_timeout, test_eternal);
   tcase_add_test (tc_timeout, test_sleep2);