[PATCH] msvcr120/tests: Add critical section test.

Piotr Caban piotr.caban at gmail.com
Tue Mar 22 09:29:17 CDT 2016


Hi YongHao,

On 03/18/16 17:24, YongHao Hu wrote:
>   dlls/msvcr120/tests/msvcr120.c | 300
> +++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 300 insertions(+)
I don't think this is a good approach for adding tests of 
critical_section class. Executing tons of enter/leave calls is not 
really testing much. Your test_critical_section_lock tests will probably 
pass if you comment all critical section related calls out (it passed on 
my computer in 10 consecutive runs, never failed, probably it's because 
the code was optimized during compilation). Testing 5s/6s timeouts is 
also not a good idea. Because of it the tests are running much longer.

It would be much better if you test following things:
  - just check some basic functionality of enter/leave: enter cs in main 
thread, start new thread that tries to enter it as well, wait for 100ms 
and check that it was not able to enter the cs, then leave cs in main 
thread and wait for thread to enter cs and finish
  - check some basic functionality of try_lock: use it to lock the cs, 
check if it fails on locked cs

Also the tests failed on testbot, I was not checking why.

Thanks,
Piotr



More information about the wine-devel mailing list