From bfa2014b78561616482a06838b4a8f5a0f0eab58 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 7 May 2018 08:30:18 +0000 Subject: Revert r331622 "[llvm-exegesis] Add a library to cluster benchmark results." Breaks build over llvm::Error copy construction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331623 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/tools/llvm-exegesis/CMakeLists.txt | 1 - unittests/tools/llvm-exegesis/ClusteringTest.cpp | 86 ------------------------ 2 files changed, 87 deletions(-) delete mode 100644 unittests/tools/llvm-exegesis/ClusteringTest.cpp (limited to 'unittests/tools') diff --git a/unittests/tools/llvm-exegesis/CMakeLists.txt b/unittests/tools/llvm-exegesis/CMakeLists.txt index 6f12bb1c163..a08d569ac5e 100644 --- a/unittests/tools/llvm-exegesis/CMakeLists.txt +++ b/unittests/tools/llvm-exegesis/CMakeLists.txt @@ -12,7 +12,6 @@ set(LLVM_LINK_COMPONENTS add_llvm_unittest(LLVMExegesisTests BenchmarkResultTest.cpp - ClusteringTest.cpp OperandGraphTest.cpp PerfHelperTest.cpp ) diff --git a/unittests/tools/llvm-exegesis/ClusteringTest.cpp b/unittests/tools/llvm-exegesis/ClusteringTest.cpp deleted file mode 100644 index b89c277b694..00000000000 --- a/unittests/tools/llvm-exegesis/ClusteringTest.cpp +++ /dev/null @@ -1,86 +0,0 @@ -//===-- ClusteringTest.cpp --------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "Clustering.h" -#include "BenchmarkResult.h" -#include "llvm/Support/Error.h" -#include "llvm/Support/raw_ostream.h" -#include "gmock/gmock.h" -#include "gtest/gtest.h" - -namespace exegesis { - -namespace { - -using testing::Field; -using testing::UnorderedElementsAre; -using testing::UnorderedElementsAreArray; - -TEST(ClusteringTest, Clusters3D) { - std::vector Points(6); - - // Cluster around (x=0, y=1, z=2): points {0, 3}. - Points[0].Measurements = {{"x", 0.01, ""}, {"y", 1.02, ""}, {"z", 1.98, "A"}}; - Points[3].Measurements = {{"x", -0.01, ""}, {"y", 1.02, ""}, {"z", 1.98, ""}}; - // Cluster around (x=1, y=1, z=2): points {1, 4}. - Points[1].Measurements = {{"x", 1.01, ""}, {"y", 1.02, ""}, {"z", 1.98, ""}}; - Points[4].Measurements = {{"x", 0.99, ""}, {"y", 1.02, ""}, {"z", 1.98, ""}}; - // Cluster around (x=0, y=0, z=0): points {5}, marked as noise. - Points[5].Measurements = {{"x", 0.0, ""}, {"y", 0.01, ""}, {"z", -0.02, ""}}; - // Error cluster: points {2} - Points[2].Error = "oops"; - - auto HasPoints = [](const std::vector &Indices) { - return Field(&InstructionBenchmarkClustering::Cluster::PointIndices, - UnorderedElementsAreArray(Indices)); - }; - - auto Clustering = InstructionBenchmarkClustering::create(Points, 2, 0.25); - ASSERT_TRUE((bool)Clustering); - EXPECT_THAT(Clustering.get().getValidClusters(), - UnorderedElementsAre(HasPoints({0, 3}), HasPoints({1, 4}))); - EXPECT_THAT(Clustering.get().getCluster( - InstructionBenchmarkClustering::ClusterId::noise()), - HasPoints({5})); - EXPECT_THAT(Clustering.get().getCluster( - InstructionBenchmarkClustering::ClusterId::error()), - HasPoints({2})); - - EXPECT_EQ(Clustering.get().getClusterIdForPoint(2), - InstructionBenchmarkClustering::ClusterId::error()); - EXPECT_EQ(Clustering.get().getClusterIdForPoint(5), - InstructionBenchmarkClustering::ClusterId::noise()); - EXPECT_EQ(Clustering.get().getClusterIdForPoint(0), - Clustering.get().getClusterIdForPoint(3)); - EXPECT_EQ(Clustering.get().getClusterIdForPoint(1), - Clustering.get().getClusterIdForPoint(4)); -} - -TEST(ClusteringTest, Clusters3D_InvalidSize) { - std::vector Points(6); - Points[0].Measurements = {{"x", 0.01, ""}, {"y", 1.02, ""}, {"z", 1.98, ""}}; - Points[1].Measurements = {{"y", 1.02, ""}, {"z", 1.98, ""}}; - auto Error = - InstructionBenchmarkClustering::create(Points, 2, 0.25).takeError(); - ASSERT_TRUE((bool)Error); - consumeError(std::move(Error)); -} - -TEST(ClusteringTest, Clusters3D_InvalidOrder) { - std::vector Points(6); - Points[0].Measurements = {{"x", 0.01, ""}, {"y", 1.02, ""}}; - Points[1].Measurements = {{"y", 1.02, ""}, {"x", 1.98, ""}}; - auto Error = - InstructionBenchmarkClustering::create(Points, 2, 0.25).takeError(); - ASSERT_TRUE((bool)Error); - consumeError(std::move(Error)); -} - -} // namespace -} // namespace exegesis -- cgit v1.2.3