Browse Source

Unit test: set timeout using 'tcase_set_timeout'

bel 10 năm trước cách đây
mục cha
commit
c27d976160
1 tập tin đã thay đổi với 5 bổ sung5 xóa
  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;
 	int i;
 	for (i = 0; i < 100; i++) {
 	for (i = 0; i < 100; i++) {
-        /* printf("Waiting for response ... %i\n", i); */s
 		test_sleep(1);
 		test_sleep(1);
 		if (*data != NULL) {
 		if (*data != NULL) {
-            /* printf("Waiting for response ... %i (done)\n", i); */
 			return 1;
 			return 1;
 		}
 		}
 	}
 	}
-    /* printf("Waiting for response ... %i (failed)\n", i); */
 	return 0;
 	return 0;
 }
 }
 
 
@@ -1017,6 +1014,7 @@ Suite *make_public_server_suite(void)
 	suite_add_tcase(suite, startstophttps);
 	suite_add_tcase(suite, startstophttps);
 
 
 	tcase_add_test(serverrequests, test_request_handlers);
 	tcase_add_test(serverrequests, test_request_handlers);
+    tcase_set_timeout(serverrequests, 120);
 	suite_add_tcase(suite, serverrequests);
 	suite_add_tcase(suite, serverrequests);
 
 
 	return suite;
 	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 _mark_point(const char *file, int line) { chk_ok++; }
 
 
 void tcase_fn_start(const char *fname, const char *file, int line) {}
 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,
 void _tcase_add_test(TCase *tc,
                      TFun tf,
                      TFun tf,
                      const char *fname,
                      const char *fname,
                      int _signal,
                      int _signal,
                      int allowed_exit_value,
                      int allowed_exit_value,
                      int start,
                      int start,
-                     int end){};
+                     int end) {};
 TCase *tcase_create(const char *name) { return NULL; };
 TCase *tcase_create(const char *name) { return NULL; };
 Suite *suite_create(const char *name) { return NULL; };
 Suite *suite_create(const char *name) { return NULL; };
+void tcase_set_timeout(TCase * tc, double timeout) {};
+
 #endif
 #endif