Ver Fonte

CI test: Check error messages of error log file test

bel há 8 anos atrás
pai
commit
394f8ce985
1 ficheiros alterados com 11 adições e 3 exclusões
  1. 11 3
      test/public_server.c

+ 11 - 3
test/public_server.c

@@ -3346,11 +3346,15 @@ START_TEST(test_error_log_file)
 	ck_assert_msg(ok, "Did not find HTTP status code in access log file");
 	ck_assert_msg(ok, "Did not find HTTP status code in access log file");
 
 
 	/* Check error.log */
 	/* Check error.log */
+	memset(buf, 0, sizeof(buf));
 	f = fopen("error.log", "r");
 	f = fopen("error.log", "r");
 	if (f) {
 	if (f) {
+		(void)fgets(buf, sizeof(buf) - 1, f);
 		fclose(f);
 		fclose(f);
 	}
 	}
-	ck_assert_msg(f == NULL, "Should not create error log file on 404");
+	ck_assert_msg(f == NULL,
+	              "Should not create error log file on 404, but got [%s]",
+	              buf);
 
 
 	/* Remove log files */
 	/* Remove log files */
 	(void)remove("error.log");
 	(void)remove("error.log");
@@ -3366,12 +3370,16 @@ START_TEST(test_error_log_file)
 	    "Should not be able to start server with bad port configuration");
 	    "Should not be able to start server with bad port configuration");
 
 
 	/* Check access.log */
 	/* Check access.log */
+	memset(buf, 0, sizeof(buf));
 	f = fopen("access.log", "r");
 	f = fopen("access.log", "r");
 	if (f) {
 	if (f) {
+		(void)fgets(buf, sizeof(buf) - 1, f);
 		fclose(f);
 		fclose(f);
 	}
 	}
-	ck_assert_msg(f == NULL,
-	              "Should not create access log file if start fails");
+	ck_assert_msg(
+	    f == NULL,
+	    "Should not create access log file if start fails, but got [%s]",
+	    buf);
 
 
 	/* Check error.log */
 	/* Check error.log */
 	memset(buf, 0, sizeof(buf));
 	memset(buf, 0, sizeof(buf));