diff --git a/Release/tests/functional/http/client/compression_tests.cpp b/Release/tests/functional/http/client/compression_tests.cpp index 256c174c69..10e37186fa 100644 --- a/Release/tests/functional/http/client/compression_tests.cpp +++ b/Release/tests/functional/http/client/compression_tests.cpp @@ -62,7 +62,7 @@ SUITE(compression_tests) if (_done) { input_bytes_processed = 0; - if (*done) + if (done) { *done = true; } @@ -127,7 +127,7 @@ SUITE(compression_tests) if (_done) { input_bytes_processed = 0; - if (*done) + if (done) { *done = true; } @@ -203,7 +203,6 @@ SUITE(compression_tests) std::vector dcmp_buffer; web::http::compression::operation_result r; std::vector chunk_sizes; - pplx::task_status result; size_t csize; size_t dsize; size_t i; @@ -240,15 +239,11 @@ SUITE(compression_tests) cmp_buffer.resize(buffer_size); // pessimistic (or not, for non-compressible data) for (i = 0; i < buffer_size; i += chunk_size) { - result = compressor - ->compress(input_buffer.data() + i, - std::min(chunk_size, buffer_size - i), - cmp_buffer.data() + csize, - std::min(chunk_size, buffer_size - csize), - web::http::compression::operation_hint::has_more) - .then([&r](web::http::compression::operation_result x) { r = x; }) - .wait(); - VERIFY_ARE_EQUAL(result, pplx::task_status::completed); + r = compressor->compress(input_buffer.data() + i, + std::min(chunk_size, buffer_size - i), + cmp_buffer.data() + csize, + std::min(chunk_size, buffer_size - csize), + web::http::compression::operation_hint::has_more).get(); VERIFY_ARE_EQUAL(r.input_bytes_processed, std::min(chunk_size, buffer_size - i)); VERIFY_ARE_EQUAL(r.done, false); chunk_sizes.push_back(r.output_bytes_produced); @@ -265,15 +260,11 @@ SUITE(compression_tests) cmpsize += std::min(chunk_size, (size_t)200); cmp_buffer.resize(cmpsize); } - result = compressor - ->compress(NULL, + r = compressor->compress(NULL, 0, cmp_buffer.data() + csize, std::min(chunk_size, cmpsize - csize), - web::http::compression::operation_hint::is_last) - .then([&r](web::http::compression::operation_result x) { r = x; }) - .wait(); - VERIFY_ARE_EQUAL(result, pplx::task_status::completed); + web::http::compression::operation_hint::is_last).get(); VERIFY_ARE_EQUAL(r.input_bytes_processed, 0); chunk_sizes.push_back(r.output_bytes_produced); csize += r.output_bytes_produced; @@ -281,14 +272,12 @@ SUITE(compression_tests) VERIFY_ARE_EQUAL(r.done, true); // once more with no input, to assure no error and done - result = compressor->compress(NULL, 0, NULL, 0, web::http::compression::operation_hint::is_last) - .then([&r](web::http::compression::operation_result x) { r = x; }) - .wait(); - VERIFY_ARE_EQUAL(result, pplx::task_status::completed); + r = compressor->compress(NULL, 0, NULL, 0, web::http::compression::operation_hint::is_last).get(); VERIFY_ARE_EQUAL(r.input_bytes_processed, 0); VERIFY_ARE_EQUAL(r.output_bytes_produced, 0); VERIFY_ARE_EQUAL(r.done, true); } + cmp_buffer.resize(csize); // actual // decompress in as-compressed chunks @@ -304,15 +293,12 @@ SUITE(compression_tests) { hint = web::http::compression::operation_hint::is_last; } - result = decompressor - ->decompress(cmp_buffer.data() + nn, - *it, - dcmp_buffer.data() + dsize, - std::min(chunk_size, buffer_size - dsize), - hint) - .then([&r](web::http::compression::operation_result x) { r = x; }) - .wait(); - VERIFY_ARE_EQUAL(result, pplx::task_status::completed); + + r = decompressor->decompress(cmp_buffer.data() + nn, + *it, + dcmp_buffer.data() + dsize, + std::min(chunk_size, buffer_size - dsize), + hint).get(); nn += *it; dsize += r.output_bytes_produced; } @@ -332,15 +318,11 @@ SUITE(compression_tests) size_t n = std::min(chunk_size, csize - nn); do { - result = decompressor - ->decompress(cmp_buffer.data() + nn, - n, - dcmp_buffer.data() + dsize, - std::min(chunk_size, buffer_size - dsize), - web::http::compression::operation_hint::has_more) - .then([&r](web::http::compression::operation_result x) { r = x; }) - .wait(); - VERIFY_ARE_EQUAL(result, pplx::task_status::completed); + r = decompressor->decompress(cmp_buffer.data() + nn, + n, + dcmp_buffer.data() + dsize, + std::min(chunk_size, buffer_size - dsize), + web::http::compression::operation_hint::has_more).get(); dsize += r.output_bytes_produced; nn += r.input_bytes_processed; n -= r.input_bytes_processed; @@ -352,10 +334,7 @@ SUITE(compression_tests) VERIFY_IS_TRUE(r.done); // once more with no input, to assure no error and done - result = decompressor->decompress(NULL, 0, NULL, 0, web::http::compression::operation_hint::has_more) - .then([&r](web::http::compression::operation_result x) { r = x; }) - .wait(); - VERIFY_ARE_EQUAL(result, pplx::task_status::completed); + r = decompressor->decompress(NULL, 0, NULL, 0, web::http::compression::operation_hint::has_more).get(); VERIFY_ARE_EQUAL(r.input_bytes_processed, 0); VERIFY_ARE_EQUAL(r.output_bytes_produced, 0); VERIFY_IS_TRUE(r.done); @@ -363,15 +342,11 @@ SUITE(compression_tests) // decompress all at once decompressor->reset(); memset(dcmp_buffer.data(), 0, dcmp_buffer.size()); - result = decompressor - ->decompress(cmp_buffer.data(), - csize, - dcmp_buffer.data(), - dcmp_buffer.size(), - web::http::compression::operation_hint::is_last) - .then([&r](web::http::compression::operation_result x) { r = x; }) - .wait(); - VERIFY_ARE_EQUAL(result, pplx::task_status::completed); + r = decompressor->decompress(cmp_buffer.data(), + csize, + dcmp_buffer.data(), + dcmp_buffer.size(), + web::http::compression::operation_hint::is_last).get(); VERIFY_ARE_EQUAL(r.output_bytes_produced, buffer_size); VERIFY_ARE_EQUAL(input_buffer, dcmp_buffer); @@ -385,14 +360,11 @@ SUITE(compression_tests) nn = 0; try { - result = decompressor - ->decompress(cmp_buffer.data(), + r = decompressor->decompress(cmp_buffer.data(), csize, dcmp_buffer.data(), dcmp_buffer.size(), - web::http::compression::operation_hint::is_last) - .then([&nn](web::http::compression::operation_result x) { nn++; }) - .wait(); + web::http::compression::operation_hint::is_last).get(); nn++; } catch (std::runtime_error) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f49e5ecdbc..d984c4094e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,6 +20,10 @@ jobs: cd build.debug ninja -j 4 displayName: 'Run ninja' + - script: | + cd build.debug/Release/Binaries + ./test_runner *test.so + displayName: 'Run Tests' - job: Ubuntu_1604_Apt_Release pool: vmImage: 'Ubuntu 16.04' @@ -39,6 +43,10 @@ jobs: cd build.release ninja -j 4 displayName: 'Run ninja' + - script: | + cd build.release/Release/Binaries + ./test_runner *test.so + displayName: 'Run Tests' - job: MacOS_Debug pool: vmImage: 'macOS-10.13' @@ -55,6 +63,10 @@ jobs: cd build.debug ninja -j 4 displayName: 'Run ninja' + - script: | + cd build.debug/Release/Binaries + ./test_runner *test.dylib + displayName: 'Run Tests' - job: MacOS_Release pool: vmImage: 'macOS-10.13' @@ -71,3 +83,7 @@ jobs: cd build.release ninja -j 4 displayName: 'Run ninja' + - script: | + cd build.release/Release/Binaries + ./test_runner *test.dylib + displayName: 'Run Tests'