w*s 发帖数: 7227 | 1 our product is OS, so provide these IPC calls,
can i generate random tests for them ?
say i generate random number of threads,
thread 1 creates and gets a mutex,
thread 2 has to wait for it.
The above case is simple, how about nested case,
thread 1 creates and gets a mutex, then i has to wait for an event from
another thread...
Q1: what are the constrains ? the only one i know is thread 2 has to wait
for
the mutex, only after mutex gets created.
Q2: How complicate can this go ? inside mutex block , there's a semphore ...
thanks ! | b******n 发帖数: 592 | 2 I had same issues before. It is very difficult to really test mutex.
valgrind may help. My solution was to mock mutexes, and hand craft 'senarios
' for testing. Then have a very long test with random executions.
【在 w*s 的大作中提到】 : our product is OS, so provide these IPC calls, : can i generate random tests for them ? : say i generate random number of threads, : thread 1 creates and gets a mutex, : thread 2 has to wait for it. : The above case is simple, how about nested case, : thread 1 creates and gets a mutex, then i has to wait for an event from : another thread... : Q1: what are the constrains ? the only one i know is thread 2 has to wait : for
|
|