Skip to content

Commit

Permalink
Fix nightlies after datablock merge.
Browse files Browse the repository at this point in the history
---
TYPE: NO_HISTORY
DESC: Fix nightlies after datablock merge.
  • Loading branch information
KiterLuc committed Mar 26, 2024
1 parent d48fea6 commit 6be134e
Showing 1 changed file with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ using NullMover2 = ItemMover<NullPolicy, two_stage, Block>;
TEST_CASE(
"BlocksAndPorts: Create Source and Sink with DataBlock",
"[blocks_and_ports]") {
auto pn = Source<NullMover2, DataBlock>{};
auto cn = Sink<NullMover2, DataBlock>{};
auto pn = Source<NullMover2, DataBlock<>>{};
auto cn = Sink<NullMover2, DataBlock<>>{};

attach(pn, cn);
}
Expand All @@ -69,11 +69,11 @@ TEST_CASE(
*/
TEST_CASE(
"BlocksAndPorts: Manual set source port values", "[blocks_and_ports]") {
auto source = Source<NullMover2, DataBlock>{};
auto sink = Sink<NullMover2, DataBlock>{};
auto source = Source<NullMover2, DataBlock<>>{};
auto sink = Sink<NullMover2, DataBlock<>>{};

DataBlock x{DataBlock::max_size()};
DataBlock y{DataBlock::max_size()};
DataBlock<> x{DataBlock<>::max_size()};
DataBlock<> y{DataBlock<>::max_size()};

SECTION("set source in bound pair") {
attach(source, sink);
Expand All @@ -90,7 +90,7 @@ TEST_CASE(
}
}

bool zeroize(DataBlock& x) {
bool zeroize(DataBlock<>& x) {
for (auto& j : x) {
j = std::byte{0};
}
Expand All @@ -100,15 +100,15 @@ bool zeroize(DataBlock& x) {
return e == x.end();
}

void iotize(DataBlock& x) {
void iotize(DataBlock<>& x) {
std::iota(
reinterpret_cast<uint8_t*>(x.begin()),
reinterpret_cast<uint8_t*>(x.end()),
uint8_t{0});
}

bool check_iotized(DataBlock& x) {
bool ret = [&](DataBlock& z) {
bool check_iotized(DataBlock<>& x) {
bool ret = [&](DataBlock<>& z) {
uint8_t b{0};
for (auto&& j : z) {
if (static_cast<uint8_t>(j) != b) {
Expand All @@ -124,8 +124,8 @@ bool check_iotized(DataBlock& x) {
return ret;
}

bool check_zeroized(DataBlock& x) {
bool ret = [&](DataBlock& z) {
bool check_zeroized(DataBlock<>& x) {
bool ret = [&](DataBlock<>& z) {
uint8_t b{0};
for (auto&& j : z) {
if (static_cast<uint8_t>(j) != b) {
Expand All @@ -144,18 +144,18 @@ bool check_zeroized(DataBlock& x) {
* Test operation of inject and extract.
*/
TEST_CASE("BlocksAndPorts: Manual extract sink values", "[blocks_and_ports]") {
auto source = Source<NullMover2, DataBlock>{};
auto sink = Sink<NullMover2, DataBlock>{};
auto source = Source<NullMover2, DataBlock<>>{};
auto sink = Sink<NullMover2, DataBlock<>>{};

DataBlock x{DataBlock::max_size()};
DataBlock y{DataBlock::max_size()};
DataBlock<> x{DataBlock<>::max_size()};
DataBlock<> y{DataBlock<>::max_size()};

SECTION("set source in unbound pair") {
CHECK_THROWS(sink.extract().has_value() == false);
}
SECTION("set source in bound pair") {
CHECK(x.size() == DataBlock::max_size());
CHECK(y.size() == DataBlock::max_size());
CHECK(x.size() == DataBlock<>::max_size());
CHECK(y.size() == DataBlock<>::max_size());
iotize(x);
zeroize(y);
check_iotized(x);
Expand All @@ -180,11 +180,11 @@ TEST_CASE("BlocksAndPorts: Manual extract sink values", "[blocks_and_ports]") {
TEST_CASE(
"BlocksAndPorts: Manual transfer from Source to Sink",
"[blocks_and_ports]") {
Source<ManualMover2, DataBlock> source;
Sink<ManualMover2, DataBlock> sink;
Source<ManualMover2, DataBlock<>> source;
Sink<ManualMover2, DataBlock<>> sink;

DataBlock x{DataBlock::max_size()};
DataBlock y{DataBlock::max_size()};
DataBlock<> x{DataBlock<>::max_size()};
DataBlock<> y{DataBlock<>::max_size()};

[[maybe_unused]] auto dx = x.data();
[[maybe_unused]] auto dy = y.data();
Expand Down Expand Up @@ -268,11 +268,11 @@ TEST_CASE(
TEST_CASE(
"BlocksAndPorts: Manual transfer from Source to Sink, async policy",
"[blocks_and_ports]") {
Source<AsyncMover2, DataBlock> source;
Sink<AsyncMover2, DataBlock> sink;
Source<AsyncMover2, DataBlock<>> source;
Sink<AsyncMover2, DataBlock<>> sink;

DataBlock x{DataBlock::max_size()};
DataBlock y{DataBlock::max_size()};
DataBlock<> x{DataBlock<>::max_size()};
DataBlock<> y{DataBlock<>::max_size()};

[[maybe_unused]] auto dx = x.data();
[[maybe_unused]] auto dy = y.data();
Expand Down Expand Up @@ -312,11 +312,11 @@ TEST_CASE(
TEST_CASE(
"BlocksAndPorts: Async transfer from Source to Sink",
"[blocks_and_ports]") {
Source<AsyncMover2, DataBlock> source;
Sink<AsyncMover2, DataBlock> sink;
Source<AsyncMover2, DataBlock<>> source;
Sink<AsyncMover2, DataBlock<>> sink;

DataBlock x{DataBlock::max_size()};
DataBlock y{DataBlock::max_size()};
DataBlock<> x{DataBlock<>::max_size()};
DataBlock<> y{DataBlock<>::max_size()};

[[maybe_unused]] auto dx = x.data();
[[maybe_unused]] auto dy = y.data();
Expand All @@ -333,7 +333,7 @@ TEST_CASE(
auto state_machine = sink.get_mover();
CHECK(str(state_machine->state()) == "st_00");

std::optional<DataBlock> b;
std::optional<DataBlock<>> b;

auto source_node = [&]() {
CHECK(source.inject(x) == true);
Expand Down Expand Up @@ -389,8 +389,8 @@ TEST_CASE(
TEST_CASE("BlocksAndPorts: Async pass n blocks", "[blocks_and_ports]") {
[[maybe_unused]] constexpr bool debug = false;

Source<AsyncMover2, DataBlock> source;
Sink<AsyncMover2, DataBlock> sink;
Source<AsyncMover2, DataBlock<>> source;
Sink<AsyncMover2, DataBlock<>> sink;

attach(source, sink);

Expand All @@ -411,7 +411,7 @@ TEST_CASE("BlocksAndPorts: Async pass n blocks", "[blocks_and_ports]") {

CHECK(std::equal(input.begin(), input.end(), output.begin()) == false);

auto p = PoolAllocator<DataBlock::max_size()>{};
auto p = PoolAllocator<DataBlock<>::max_size()>{};
size_t init_allocations = p.num_allocations();

size_t max_allocated = 0;
Expand All @@ -432,7 +432,7 @@ TEST_CASE("BlocksAndPorts: Async pass n blocks", "[blocks_and_ports]") {

std::this_thread::sleep_for(std::chrono::microseconds(random_us(500)));

source.inject(make_data_block(*i++));
source.inject(DataBlock<>{*i++});
max_allocated = std::max(max_allocated, p.num_allocated());

std::this_thread::sleep_for(std::chrono::microseconds(random_us(500)));
Expand Down

0 comments on commit 6be134e

Please sign in to comment.