[compiler-rt] r177499 - tsan: fix incorrect test

Dmitry Vyukov dvyukov at google.com
Wed Mar 20 08:02:20 PDT 2013


Hi,

Most of tsan tests use sleep(1), because we need to ensure particular
thread ordering w/o using any synchronization.
This test needs it doubly, because __tsan_java_mutex_read_lock() is
not actually a mutex, it's just an annotation for Java mutexes, so the
test needs to arrange that the critical sections do not run
concurrently.



On Wed, Mar 20, 2013 at 6:48 PM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
> Sorry, why is the sleep needed? Having a test that takes one second to
> run is unfortunate.
>
> On 20 March 2013 05:21, Dmitry Vyukov <dvyukov at google.com> wrote:
>> Author: dvyukov
>> Date: Wed Mar 20 04:21:49 2013
>> New Revision: 177499
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=177499&view=rev
>> Log:
>> tsan: fix incorrect test
>>
>> Modified:
>>     compiler-rt/trunk/lib/tsan/lit_tests/java_rwlock.cc
>>
>> Modified: compiler-rt/trunk/lib/tsan/lit_tests/java_rwlock.cc
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/java_rwlock.cc?rev=177499&r1=177498&r2=177499&view=diff
>> ==============================================================================
>> --- compiler-rt/trunk/lib/tsan/lit_tests/java_rwlock.cc (original)
>> +++ compiler-rt/trunk/lib/tsan/lit_tests/java_rwlock.cc Wed Mar 20 04:21:49 2013
>> @@ -1,10 +1,12 @@
>>  // RUN: %clangxx_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s
>>  #include "java.h"
>> +#include <unistd.h>
>>
>>  jptr varaddr;
>>  jptr lockaddr;
>>
>>  void *Thread(void *p) {
>> +  sleep(1);
>>    __tsan_java_mutex_read_lock(lockaddr);
>>    *(int*)varaddr = 42;
>>    __tsan_java_mutex_read_unlock(lockaddr);
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list