You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@serf.apache.org by br...@apache.org on 2018/05/01 17:17:32 UTC
svn commit: r1830691 - in /serf/trunk: SConstruct test/test_buckets.c
Author: brane
Date: Tue May 1 17:17:32 2018
New Revision: 1830691
URL: http://svn.apache.org/viewvc?rev=1830691&view=rev
Log:
Fix a compiler warning about an unused function in tests.
* SConstruct (ENABLE_SLOW_TESTS): New configuration variable.
If set, enable the test_deflate_4GBplus_buckets() test case.
* test/test_buckets.c (test_deflate_4GBplus_buckets): Only define
this function if SERF_TEST_DEFLATE_4GBPLUS_BUCKETS is defined.
(test_buckets): Use the same condition to add it to the test suite.
Modified:
serf/trunk/SConstruct
serf/trunk/test/test_buckets.c
Modified: serf/trunk/SConstruct
URL: http://svn.apache.org/viewvc/serf/trunk/SConstruct?rev=1830691&r1=1830690&r2=1830691&view=diff
==============================================================================
--- serf/trunk/SConstruct (original)
+++ serf/trunk/SConstruct Tue May 1 17:17:32 2018
@@ -115,6 +115,9 @@ opts.AddVariables(
BoolVariable('DISABLE_LOGGING',
"Disable the logging framework at compile time",
False),
+ BoolVariable('ENABLE_SLOW_TESTS',
+ "Enable long-running unit tests",
+ False),
RawListVariable('CC', "Command name or path of the C compiler", None),
RawListVariable('CFLAGS', "Extra flags for the C compiler (space-separated)",
None),
@@ -570,6 +573,10 @@ env.Alias('install', ['install-lib', 'in
tenv = env.Clone()
+# Check if long-running tests should be enabled
+if tenv.get('ENABLE_SLOW_TESTS', None):
+ tenv.Append(CPPDEFINES=['SERF_TEST_DEFLATE_4GBPLUS_BUCKETS'])
+
# MockHTTP requires C99 standard, so use it for the test suite.
cflags = tenv['CFLAGS']
tenv.Replace(CFLAGS = [f.replace('-std=c89', '-std=c99') for f in cflags])
Modified: serf/trunk/test/test_buckets.c
URL: http://svn.apache.org/viewvc/serf/trunk/test/test_buckets.c?rev=1830691&r1=1830690&r2=1830691&view=diff
==============================================================================
--- serf/trunk/test/test_buckets.c (original)
+++ serf/trunk/test/test_buckets.c Tue May 1 17:17:32 2018
@@ -2089,6 +2089,7 @@ create_gzip_deflate_bucket(serf_bucket_t
return defbkt;
}
+#ifdef SERF_TEST_DEFLATE_4GBPLUS_BUCKETS
/* Test for issue #152: the trailers of gzipped data only store the 4 most
significant bytes of the length, so when the compressed data is >4GB
we can't just compare actual length with expected length. */
@@ -2125,6 +2126,7 @@ static void test_deflate_4GBplus_buckets
}
#endif
+ printf("\n");
actual_size = 0;
for (i = 0; i < NR_OF_LOOPS; i++) {
const char *data;
@@ -2132,8 +2134,11 @@ static void test_deflate_4GBplus_buckets
apr_size_t read_len;
apr_status_t status;
- if (i % 1000 == 0)
- printf("%d\n", i);
+ if (i % 1000 == 0) {
+ printf("\rtest_deflate_4GBplus_buckets: %d of %d",
+ i, NR_OF_LOOPS);
+ fflush(stdout);
+ }
status = apr_generate_random_bytes(uncompressed, BUFSIZE);
CuAssertIntEquals(tc, APR_SUCCESS, status);
@@ -2166,6 +2171,7 @@ static void test_deflate_4GBplus_buckets
actual_size += read_len;
}
+ printf("\n");
put_32bit(&gzip_trailer[0], unc_crc);
put_32bit(&gzip_trailer[4], unc_length);
@@ -2193,6 +2199,7 @@ static void test_deflate_4GBplus_buckets
#undef NR_OF_LOOPS
#undef BUFSIZE
}
+#endif /* SERF_TEST_DEFLATE_4GBPLUS_BUCKETS */
/* Basic test for serf_linebuf_fetch(). */
static void test_linebuf_fetch_crlf(CuTest *tc)
@@ -3348,7 +3355,7 @@ CuSuite *test_buckets(void)
SUITE_ADD_TEST(suite, test_brotli_decompress_bucket_garbage_at_end);
SUITE_ADD_TEST(suite, test_brotli_decompress_response_body);
}
-#if 0
+#ifdef SERF_TEST_DEFLATE_4GBPLUS_BUCKETS
/* This test for issue #152 takes a lot of time generating 4GB+ of random
data so it's disabled by default. */
SUITE_ADD_TEST(suite, test_deflate_4GBplus_buckets);