Skip to content

Adding test runs to Azure Pipelines. #899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 30 additions & 58 deletions Release/tests/functional/http/client/compression_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ SUITE(compression_tests)
if (_done)
{
input_bytes_processed = 0;
if (*done)
if (done)
{
*done = true;
}
Expand Down Expand Up @@ -127,7 +127,7 @@ SUITE(compression_tests)
if (_done)
{
input_bytes_processed = 0;
if (*done)
if (done)
{
*done = true;
}
Expand Down Expand Up @@ -203,7 +203,6 @@ SUITE(compression_tests)
std::vector<uint8_t> dcmp_buffer;
web::http::compression::operation_result r;
std::vector<size_t> chunk_sizes;
pplx::task_status result;
size_t csize;
size_t dsize;
size_t i;
Expand Down Expand Up @@ -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);
Expand All @@ -265,30 +260,24 @@ 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;
} while (csize == cmpsize);
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
Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -352,26 +334,19 @@ 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);

// 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);

Expand All @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'