[llvm] 2d66ed3 - [NFC] Skip PassBuilderCTests if no default triple
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 31 19:25:10 PST 2022
TIL, thanks!
On Mon, Jan 31, 2022 at 4:54 PM Chris Bieneman <chris.bieneman at me.com>
wrote:
> You can actually build with no targets too… so, not necessarily.
>
> -Chris
>
> On Jan 31, 2022, at 5:45 PM, Arthur Eubanks <aeubanks at google.com> wrote:
>
>
> Would LLVMGetFirstTarget() work?
>
> On Mon, Jan 31, 2022 at 2:25 PM Chris Bieneman via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>>
>> Author: Chris Bieneman
>> Date: 2022-01-31T16:24:42-06:00
>> New Revision: 2d66ed370a4065faa6347c5811c5ede92a1dea38
>>
>> URL:
>> https://github.com/llvm/llvm-project/commit/2d66ed370a4065faa6347c5811c5ede92a1dea38
>> DIFF:
>> https://github.com/llvm/llvm-project/commit/2d66ed370a4065faa6347c5811c5ede92a1dea38.diff
>>
>> LOG: [NFC] Skip PassBuilderCTests if no default triple
>>
>> This fixes the unit tests so that it is skipped if there is no default
>> target triple set. Unset default target triple is a supported build
>> configuration for LLVM.
>>
>> Added:
>>
>>
>> Modified:
>> llvm/unittests/Passes/PassBuilderBindingsTest.cpp
>>
>> Removed:
>>
>>
>>
>>
>> ################################################################################
>> diff --git a/llvm/unittests/Passes/PassBuilderBindingsTest.cpp
>> b/llvm/unittests/Passes/PassBuilderBindingsTest.cpp
>> index c55c882e6083c..069c9803cae5e 100644
>> --- a/llvm/unittests/Passes/PassBuilderBindingsTest.cpp
>> +++ b/llvm/unittests/Passes/PassBuilderBindingsTest.cpp
>> @@ -10,13 +10,18 @@
>> #include "llvm-c/Transforms/PassBuilder.h"
>> #include "llvm-c/Types.h"
>> #include "gtest/gtest.h"
>> +#include <string.h>
>>
>> using namespace llvm;
>>
>> class PassBuilderCTest : public testing::Test {
>> void SetUp() override {
>> - LLVMInitializeAllTargetInfos();
>> char *Triple = LLVMGetDefaultTargetTriple();
>> + if (strlen(Triple) == 0) {
>> + GTEST_SKIP();
>> + return;
>> + }
>> + LLVMInitializeAllTargetInfos();
>> char *Err;
>> LLVMTargetRef Target;
>> if (LLVMGetTargetFromTriple(Triple, &Target, &Err)) {
>> @@ -32,6 +37,9 @@ class PassBuilderCTest : public testing::Test {
>> }
>>
>> void TearDown() override {
>> + char *Triple = LLVMGetDefaultTargetTriple();
>> + if (strlen(Triple) == 0)
>> + return; // Skipped, so nothing to tear down
>> LLVMDisposeTargetMachine(TM);
>> LLVMDisposeModule(Module);
>> LLVMContextDispose(Context);
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220131/5b43f9f9/attachment.html>
More information about the llvm-commits
mailing list