[llvm] r259705 - [unittests] Move TargetRegistry test from Support to MC

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 16:12:32 PST 2016


Thanks!

On 3 February 2016 at 16:41, Reid Kleckner via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: rnk
> Date: Wed Feb  3 15:41:24 2016
> New Revision: 259705
>
> URL: http://llvm.org/viewvc/llvm-project?rev=259705&view=rev
> Log:
> [unittests] Move TargetRegistry test from Support to MC
>
> This removes the dependency from SupportTests to all of the LLVM
> backends, and makes it link faster.
>
> Added:
>     llvm/trunk/unittests/MC/TargetRegistry.cpp
>       - copied, changed from r259704, llvm/trunk/unittests/Support/TargetRegistry.cpp
> Removed:
>     llvm/trunk/unittests/Support/TargetRegistry.cpp
> Modified:
>     llvm/trunk/unittests/MC/CMakeLists.txt
>     llvm/trunk/unittests/Support/CMakeLists.txt
>
> Modified: llvm/trunk/unittests/MC/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/MC/CMakeLists.txt?rev=259705&r1=259704&r2=259705&view=diff
> ==============================================================================
> --- llvm/trunk/unittests/MC/CMakeLists.txt (original)
> +++ llvm/trunk/unittests/MC/CMakeLists.txt Wed Feb  3 15:41:24 2016
> @@ -9,5 +9,6 @@ add_llvm_unittest(MCTests
>    Disassembler.cpp
>    DwarfLineTables.cpp
>    StringTableBuilderTest.cpp
> +  TargetRegistry.cpp
>    YAMLTest.cpp
>    )
>
> Copied: llvm/trunk/unittests/MC/TargetRegistry.cpp (from r259704, llvm/trunk/unittests/Support/TargetRegistry.cpp)
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/MC/TargetRegistry.cpp?p2=llvm/trunk/unittests/MC/TargetRegistry.cpp&p1=llvm/trunk/unittests/Support/TargetRegistry.cpp&r1=259704&r2=259705&rev=259705&view=diff
> ==============================================================================
> --- llvm/trunk/unittests/Support/TargetRegistry.cpp (original)
> +++ llvm/trunk/unittests/MC/TargetRegistry.cpp Wed Feb  3 15:41:24 2016
> @@ -1,4 +1,4 @@
> -//===- unittests/Support/TargetRegistry.cpp - -----------------------------===//
> +//===- unittests/MC/TargetRegistry.cpp ------------------------------------===//
>  //
>  //                     The LLVM Compiler Infrastructure
>  //
> @@ -7,6 +7,10 @@
>  //
>  //===----------------------------------------------------------------------===//
>
> +// The target registry code lives in Support, but it relies on linking in all
> +// LLVM targets. We keep this test with the MC tests, which already do that, to
> +// keep the SupportTests target small.
> +
>  #include "llvm/Support/TargetRegistry.h"
>  #include "llvm/Support/TargetSelect.h"
>  #include "gtest/gtest.h"
>
> Modified: llvm/trunk/unittests/Support/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CMakeLists.txt?rev=259705&r1=259704&r2=259705&view=diff
> ==============================================================================
> --- llvm/trunk/unittests/Support/CMakeLists.txt (original)
> +++ llvm/trunk/unittests/Support/CMakeLists.txt Wed Feb  3 15:41:24 2016
> @@ -1,5 +1,4 @@
>  set(LLVM_LINK_COMPONENTS
> -  ${LLVM_TARGETS_TO_BUILD}
>    Support
>    )
>
> @@ -39,7 +38,6 @@ add_llvm_unittest(SupportTests
>    StreamingMemoryObject.cpp
>    StringPool.cpp
>    SwapByteOrderTest.cpp
> -  TargetRegistry.cpp
>    ThreadLocalTest.cpp
>    ThreadPool.cpp
>    TimerTest.cpp
>
> Removed: llvm/trunk/unittests/Support/TargetRegistry.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/TargetRegistry.cpp?rev=259704&view=auto
> ==============================================================================
> --- llvm/trunk/unittests/Support/TargetRegistry.cpp (original)
> +++ llvm/trunk/unittests/Support/TargetRegistry.cpp (removed)
> @@ -1,42 +0,0 @@
> -//===- unittests/Support/TargetRegistry.cpp - -----------------------------===//
> -//
> -//                     The LLVM Compiler Infrastructure
> -//
> -// This file is distributed under the University of Illinois Open Source
> -// License. See LICENSE.TXT for details.
> -//
> -//===----------------------------------------------------------------------===//
> -
> -#include "llvm/Support/TargetRegistry.h"
> -#include "llvm/Support/TargetSelect.h"
> -#include "gtest/gtest.h"
> -
> -using namespace llvm;
> -
> -namespace {
> -
> -TEST(TargetRegistry, TargetHasArchType) {
> -  // Presence of at least one target will be asserted when done with the loop,
> -  // else this would pass by accident if InitializeAllTargetInfos were omitted.
> -  int Count = 0;
> -
> -  llvm::InitializeAllTargetInfos();
> -
> -  for (const Target &T : TargetRegistry::targets()) {
> -    StringRef Name = T.getName();
> -    // There is really no way (at present) to ask a Target whether it targets
> -    // a specific architecture, because the logic for that is buried in a
> -    // predicate.
> -    // We can't ask the predicate "Are you a function that always returns
> -    // false?"
> -    // So given that the cpp backend truly has no target arch, it is skipped.
> -    if (Name != "cpp") {
> -      Triple::ArchType Arch = Triple::getArchTypeForLLVMName(Name);
> -      EXPECT_NE(Arch, Triple::UnknownArch);
> -      ++Count;
> -    }
> -  }
> -  ASSERT_NE(Count, 0);
> -}
> -
> -} // end namespace
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list