r253486 - Removing the AST matcher test for thread_local storage duration. Not all platforms support TLS, and on platforms that do not support it, use of thread_local causes an error. Since there's no way to determine whether the testing platform supports TLS, there's no way to know whether the test is safe to run or not. I will explore ways to enable this test, but this will appease at least one more build bot.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 18 11:15:56 PST 2015


On Wed, Nov 18, 2015 at 2:08 PM, Jonathan Roelofs
<jonathan at codesourcery.com> wrote:
>
>
> On 11/18/15 11:37 AM, Aaron Ballman via cfe-commits wrote:
>>
>> Author: aaronballman
>> Date: Wed Nov 18 12:37:29 2015
>> New Revision: 253486
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=253486&view=rev
>> Log:
>> Removing the AST matcher test for thread_local storage duration. Not all
>> platforms support TLS, and on platforms that do not support it, use of
>> thread_local causes an error. Since there's no way to determine whether the
>> testing platform supports TLS, there's no way to know whether the test is
>> safe to run or not. I will explore ways to enable this test, but this will
>> appease at least one more build bot.
>
>
> Can you break it out in its own file, and then XFAIL on those platforms that
> don't support it?

Not easily -- these are tests run by gtest, not lit. What's more, the
"platforms that don't support it" is an unknown to me. Each individual
target gets to specify whether it supports TLS or not, so this would
be a fragile thing. Ideally, the unit testing framework would have
some information about the target platform it is being run on so that
I could decide dynamically whether to run the test or not.

Worst-case, I will white-list a few platforms where I know TLS is
supported, and only run the positive tests on those platforms.

~Aaron

>
>
> Jon
>
>
>>
>> Modified:
>>      cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
>>
>> Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=253486&r1=253485&r2=253486&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
>> +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Wed Nov 18
>> 12:37:29 2015
>> @@ -1357,22 +1357,22 @@ TEST(Matcher, VarDecl_Storage) {
>>
>>   TEST(Matcher, VarDecl_StorageDuration) {
>>     std::string T =
>> -      "void f() { int x; static int y; thread_local int z; } int a;";
>> +      "void f() { int x; static int y; } int a;";
>>
>>     EXPECT_TRUE(matches(T, varDecl(hasName("x"),
>> hasAutomaticStorageDuration())));
>>     EXPECT_TRUE(
>>         notMatches(T, varDecl(hasName("y"),
>> hasAutomaticStorageDuration())));
>>     EXPECT_TRUE(
>> -      notMatches(T, varDecl(hasName("z"),
>> hasAutomaticStorageDuration())));
>> -  EXPECT_TRUE(
>>         notMatches(T, varDecl(hasName("a"),
>> hasAutomaticStorageDuration())));
>>
>>     EXPECT_TRUE(matches(T, varDecl(hasName("y"),
>> hasStaticStorageDuration())));
>>     EXPECT_TRUE(matches(T, varDecl(hasName("a"),
>> hasStaticStorageDuration())));
>>     EXPECT_TRUE(notMatches(T, varDecl(hasName("x"),
>> hasStaticStorageDuration())));
>> -  EXPECT_TRUE(notMatches(T, varDecl(hasName("z"),
>> hasStaticStorageDuration())));
>>
>> -  EXPECT_TRUE(matches(T, varDecl(hasName("z"),
>> hasThreadStorageDuration())));
>> +  // FIXME: It is really hard to test with thread_local itself because
>> not all
>> +  // targets support TLS, which causes this to be an error depending on
>> what
>> +  // platform the test is being run on. We do not have access to the
>> TargetInfo
>> +  // object to be able to test whether the platform supports TLS or not.
>>     EXPECT_TRUE(notMatches(T, varDecl(hasName("x"),
>> hasThreadStorageDuration())));
>>     EXPECT_TRUE(notMatches(T, varDecl(hasName("y"),
>> hasThreadStorageDuration())));
>>     EXPECT_TRUE(notMatches(T, varDecl(hasName("a"),
>> hasThreadStorageDuration())));
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
> --
> Jon Roelofs
> jonathan at codesourcery.com
> CodeSourcery / Mentor Embedded


More information about the cfe-commits mailing list