瀏覽代碼

Unit test: set timeout using 'tcase_set_timeout'

bel 10 年之前
父節點
當前提交
c27d976160
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      test/public_server.c

+ 5 - 5
test/public_server.c

@@ -74,14 +74,11 @@ static int wait_not_null(void *volatile *data)
 {
 	int i;
 	for (i = 0; i < 100; i++) {
-        /* printf("Waiting for response ... %i\n", i); */s
 		test_sleep(1);
 		if (*data != NULL) {
-            /* printf("Waiting for response ... %i (done)\n", i); */
 			return 1;
 		}
 	}
-    /* printf("Waiting for response ... %i (failed)\n", i); */
 	return 0;
 }
 
@@ -1017,6 +1014,7 @@ Suite *make_public_server_suite(void)
 	suite_add_tcase(suite, startstophttps);
 
 	tcase_add_test(serverrequests, test_request_handlers);
+    tcase_set_timeout(serverrequests, 120);
 	suite_add_tcase(suite, serverrequests);
 
 	return suite;
@@ -1053,14 +1051,16 @@ void _ck_assert_failed(const char *file, int line, const char *expr, ...)
 void _mark_point(const char *file, int line) { chk_ok++; }
 
 void tcase_fn_start(const char *fname, const char *file, int line) {}
-void suite_add_tcase(Suite *s, TCase *tc){};
+void suite_add_tcase(Suite *s, TCase *tc) {};
 void _tcase_add_test(TCase *tc,
                      TFun tf,
                      const char *fname,
                      int _signal,
                      int allowed_exit_value,
                      int start,
-                     int end){};
+                     int end) {};
 TCase *tcase_create(const char *name) { return NULL; };
 Suite *suite_create(const char *name) { return NULL; };
+void tcase_set_timeout(TCase * tc, double timeout) {};
+
 #endif