Skip to content

Idea for Unit Test - Assertion in Failed Branch #51

@LouisJenkinsCS

Description

@LouisJenkinsCS

Since prior to the enhancement, it was possible to create scenarios where the false branch was never taken due to the atomic load falling inside the same superblock as the CAS that depends on it, I should have a simple unit test that asserts that after X minutes it ends up failing.

atomic_int x = ATOMIC_VAR_INIT(0);
atomic_bool running = ATOMIC_VAR_INIT(true);
#pragma omp parallel
while (running) {
   int y = atomic_load(&x);
   assert(atomic_compare_exchange_strong(&x, &y, y + 1));
}

The above should not fail with the old translation but should fail with the new.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BTRBuild, Testing, ReleasePriority:MediumMedium Priority - Should be done as time permits.enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions