Commit Graph

5 Commits

Author SHA1 Message Date
Julien Fischer
2a096e69c9 Update programming style in a test.
tests/hard_coded/thread_barrier_test.m:
tests/hard_coded/thread_test_utils.m:
     As above.
2022-04-14 20:33:29 +10:00
Peter Wang
0ada472e9e Prevent another failure of thread_barrier_test.
tests/hard_coded/thread_barrier_test.exp:
tests/hard_coded/thread_barrier_test.m:
    Prevent failure of thread_barrier_test due to nondeterministic
    output.
2018-08-07 10:20:49 +10:00
Peter Wang
9b6676a307 Avoid thread_barrier_test test failure.
tests/hard_coded/thread_barrier_test.m:
tests/hard_coded/thread_barrier_test.exp:
    The barrier.release sub-test could produce output different from the
    expected output depending on how threads are scheduled.
    Change the expected output to be less sensitive to the order that
    threads are executed.
2018-08-04 16:17:19 +10:00
Zoltan Somogyi
33eb3028f5 Clean up the tests in half the test directories.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the debugger tests,
    specify the new line numbers in .inp files and expect them in .exp files.
2015-02-14 20:14:03 +11:00
Paul Bone
39caed9793 Add a test case for barriers and fix a bug.
This test case is based off Sebastian Godelet's work, which found a bug that
can occur when release/3 is called on a barrier and then other calls to
wait/3 are made.  The final call to wait/3 tries to execute the normal
'unblock the barrier' code and deadlocks there because the barrier is
already unlocked, specifically a value is already present in the "Go" mvar.
Thanks Sebastian for your test case.

library/thread.barrier.m:
    Handle release/3 properly: release/3 now sets the number of remaining
    threads to reach the barrier to zero, and wait/3 will determine why this
    iz zero (it's normally at least one), and if it is because release was
    called then no error is raised.  The other reasion why the number of
    remaining threads may be zero is because wait has been called too many
    times, in this case wait/3 will throw an exception.

tests/hard_coded/Mmakefile:
tests/hard_coded/thread_barrier_test.exp:
tests/hard_coded/thread_barrier_test.m:
    Add new test case.

tests/hard_coded/thread_test_utils.m
    This module contains code that may be useful for other concurrency
    tests.
2014-05-16 20:16:07 +10:00