Skip to content
Snippets Groups Projects
  • Nadav Har'El's avatar
    d0b56169
    tst-wake: test for wake_with() · d0b56169
    Nadav Har'El authored
    Added a test for wake_with(). It tries to ensure that the problematic
    case solved by wake_with() actually happens quickly, by:
     1. Spin a long time between the setting of the flag and t->wake()
     2. Do a spurious wake() to ensure that the waiting thread is woken
        up right after setting the flag, before the intended wake.
     3. Use mprotect() to ensure that working with an already join()ed
        thread crashes immediately, instead of just maybe crashing.
    
    This test fails when wake_with() doesn't use ref()/unref(), and succeeds
    with the full wake_with().
    
    tst-wake contains a second test, which does the same thing but without
    the additional measures we used to show the bug (spinning, spurious
    wake and mprotect). Without these additional measures the test iteration
    is much faster, which allows us to stress wake/join much more.
    d0b56169
    History
    tst-wake: test for wake_with()
    Nadav Har'El authored
    Added a test for wake_with(). It tries to ensure that the problematic
    case solved by wake_with() actually happens quickly, by:
     1. Spin a long time between the setting of the flag and t->wake()
     2. Do a spurious wake() to ensure that the waiting thread is woken
        up right after setting the flag, before the intended wake.
     3. Use mprotect() to ensure that working with an already join()ed
        thread crashes immediately, instead of just maybe crashing.
    
    This test fails when wake_with() doesn't use ref()/unref(), and succeeds
    with the full wake_with().
    
    tst-wake contains a second test, which does the same thing but without
    the additional measures we used to show the bug (spinning, spurious
    wake and mprotect). Without these additional measures the test iteration
    is much faster, which allows us to stress wake/join much more.
bootfs.manifest 6.10 KiB