Selaa lähdekoodia

Remove unit test for file in memory if MG_USE_OPEN_FILE is not set or NO_FILES is set

bel 8 vuotta sitten
vanhempi
commit
2ba7a82e9c
2 muutettua tiedostoa jossa 14 lisäystä ja 14 poistoa
  1. 4 4
      src/civetweb.c
  2. 10 10
      test/public_server.c

+ 4 - 4
src/civetweb.c

@@ -5003,10 +5003,10 @@ pull_all(FILE *fp, struct mg_connection *conn, char *buf, int len)
 		timeout = atoi(conn->ctx->config[REQUEST_TIMEOUT]) / 1000.0;
 		clock_gettime(CLOCK_MONOTONIC, &start_time);
 	} else {
-        /* The variable is not used, but if it is left uninitialized,
-         * we get a spurious warning. */
-        memset(&start_time, 0, sizeof(start_time));
-    }
+		/* The variable is not used, but if it is left uninitialized,
+		 * we get a spurious warning. */
+		memset(&start_time, 0, sizeof(start_time));
+	}
 
 	while (len > 0 && conn->ctx->stop_flag == 0) {
 		n = pull_inner(fp, conn, buf + nread, len, timeout);

+ 10 - 10
test/public_server.c

@@ -3838,7 +3838,7 @@ START_TEST(test_large_file)
 END_TEST
 
 
-#if !defined(NO_FILES)
+#if defined(MG_USE_OPEN_FILE) && !defined(NO_FILES)
 
 #define FILE_IN_MEM_SIZE (1024 * 100)
 static char *file_in_mem_data;
@@ -3859,13 +3859,10 @@ test_file_in_memory_open_file(const struct mg_connection *conn,
 		return NULL;
 	}
 }
-#endif
 
 
 START_TEST(test_file_in_memory)
 {
-#if defined(MG_USE_OPEN_FILE)
-#if !defined(NO_FILES)
 	/* Server var */
 	struct mg_context *ctx;
 	struct mg_callbacks callbacks;
@@ -3966,16 +3963,19 @@ START_TEST(test_file_in_memory)
 	/* Free test data */
 	free(file_in_mem_data);
 	file_in_mem_data = NULL;
-#else
-	/* This test is not meaningful, if NO_FILES is set */
-	ck_assert_uint_eq(mg_check_feature(1), 0);
-#endif
-#else
+}
+END_TEST
+
+#else /* defined(MG_USE_OPEN_FILE) */
+
+START_TEST(test_file_in_memory)
+{
 	mark_point();
-#endif
 }
 END_TEST
 
+#endif
+
 
 static void
 minimal_http_client_impl(const char *server, uint16_t port, const char *uri)