summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/xray/tests
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2018-09-19 22:29:56 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2018-09-19 22:29:56 +0000
commit09e7f243f1f922b8969505cc4e920029e3c90fc9 (patch)
tree0be8b26a3360ae5a35f7a4655ebc821ad14f9b70 /compiler-rt/lib/xray/tests
parent0bda919870c8689ca00885c32d76ec3399df1e0b (diff)
downloadbcm5719-llvm-09e7f243f1f922b8969505cc4e920029e3c90fc9.tar.gz
bcm5719-llvm-09e7f243f1f922b8969505cc4e920029e3c90fc9.zip
Revert "[XRay][compiler-rt] FDRLogWriter Abstraction" and 1 more.
Revert the following 2 commits to fix standalone compiler-rt build: * r342523 [XRay] Detect terminfo library * r342518 [XRay][compiler-rt] FDRLogWriter Abstraction llvm-svn: 342596
Diffstat (limited to 'compiler-rt/lib/xray/tests')
-rw-r--r--compiler-rt/lib/xray/tests/CMakeLists.txt20
-rw-r--r--compiler-rt/lib/xray/tests/unit/CMakeLists.txt4
-rw-r--r--compiler-rt/lib/xray/tests/unit/fdr_log_writer_test.cc92
3 files changed, 4 insertions, 112 deletions
diff --git a/compiler-rt/lib/xray/tests/CMakeLists.txt b/compiler-rt/lib/xray/tests/CMakeLists.txt
index 3b33f78a125..11f373167d2 100644
--- a/compiler-rt/lib/xray/tests/CMakeLists.txt
+++ b/compiler-rt/lib/xray/tests/CMakeLists.txt
@@ -19,13 +19,9 @@ set(XRAY_UNITTEST_CFLAGS
${XRAY_CFLAGS}
${COMPILER_RT_UNITTEST_CFLAGS}
${COMPILER_RT_GTEST_CFLAGS}
- ${COMPILER_RT_GMOCK_CFLAGS}
-I${COMPILER_RT_SOURCE_DIR}/include
-I${COMPILER_RT_SOURCE_DIR}/lib/xray
- -I${COMPILER_RT_SOURCE_DIR}/lib
- -I${LLVM_MAIN_SRC_DIR}/include
- -I${LLVM_INCLUDE_DIR}
- )
+ -I${COMPILER_RT_SOURCE_DIR}/lib)
function(add_xray_lib library)
add_library(${library} STATIC ${ARGN})
@@ -54,11 +50,6 @@ if (NOT APPLE)
append_list_if(COMPILER_RT_HAS_LIBRT -lrt XRAY_UNITTEST_LINK_FLAGS)
append_list_if(COMPILER_RT_HAS_LIBDL -ldl XRAY_UNITTEST_LINK_FLAGS)
append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread XRAY_UNITTEST_LINK_FLAGS)
-
- # Needed by LLVMSupport.
- append_list_if(
- COMPILER_RT_HAS_TERMINFO
- -l${COMPILER_RT_TERMINFO_LIB} XRAY_UNITTEST_LINK_FLAGS)
endif()
macro(add_xray_unittest testname)
@@ -77,14 +68,11 @@ macro(add_xray_unittest testname)
COMPILE_DEPS ${TEST_SOURCES} ${COMPILER_RT_GTEST_SOURCE}
${XRAY_HEADERS} ${XRAY_ALL_SOURCE_FILES_ABS_PATHS}
RUNTIME "${XRAY_RUNTIME_LIBS}"
- DEPS gtest xray llvm-xray LLVMXRay LLVMTestingSupport
+ DEPS gtest xray llvm-xray
CFLAGS ${XRAY_UNITTEST_CFLAGS}
- LINK_FLAGS ${TARGET_LINK_FLAGS} ${XRAY_UNITTEST_LINK_FLAGS}
- -lLLVMXRay -lLLVMSupport -lLLVMTestingSupport
- )
+ LINK_FLAGS ${TARGET_LINK_FLAGS} ${XRAY_UNITTEST_LINK_FLAGS})
set_target_properties(XRayUnitTests
- PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endforeach()
endif()
endmacro()
diff --git a/compiler-rt/lib/xray/tests/unit/CMakeLists.txt b/compiler-rt/lib/xray/tests/unit/CMakeLists.txt
index b1ead627e8c..63c46e41c4d 100644
--- a/compiler-rt/lib/xray/tests/unit/CMakeLists.txt
+++ b/compiler-rt/lib/xray/tests/unit/CMakeLists.txt
@@ -8,7 +8,3 @@ add_xray_unittest(XRayFunctionCallTrieTest SOURCES
function_call_trie_test.cc xray_unit_test_main.cc)
add_xray_unittest(XRayProfileCollectorTest SOURCES
profile_collector_test.cc xray_unit_test_main.cc)
-
-add_xray_unittest(XRayFDRLoggingTest SOURCES
- fdr_log_writer_test.cc
- xray_unit_test_main.cc)
diff --git a/compiler-rt/lib/xray/tests/unit/fdr_log_writer_test.cc b/compiler-rt/lib/xray/tests/unit/fdr_log_writer_test.cc
deleted file mode 100644
index 3a2138cd821..00000000000
--- a/compiler-rt/lib/xray/tests/unit/fdr_log_writer_test.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-//===-- fdr_log_writer_test.cc --------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file is a part of XRay, a function call tracing system.
-//
-//===----------------------------------------------------------------------===//
-#include <time.h>
-
-#include "xray/xray_records.h"
-#include "xray_fdr_log_writer.h"
-#include "llvm/Support/DataExtractor.h"
-#include "llvm/Testing/Support/Error.h"
-#include "llvm/XRay/Trace.h"
-#include "gmock/gmock.h"
-#include "gtest/gtest.h"
-
-namespace __xray {
-namespace {
-
-static constexpr size_t kSize = 4096;
-
-using ::llvm::HasValue;
-using ::testing::Eq;
-using ::testing::SizeIs;
-
-// Exercise the common code path where we initialize a buffer and are able to
-// write some records successfully.
-TEST(FdrLogWriterTest, WriteSomeRecords) {
- bool Success = false;
- BufferQueue Buffers(kSize, 1, Success);
- BufferQueue::Buffer B;
- ASSERT_EQ(Buffers.getBuffer(B), BufferQueue::ErrorCode::Ok);
-
- FDRLogWriter Writer(B);
- MetadataRecord Preamble[] = {
- createMetadataRecord<MetadataRecord::RecordKinds::NewBuffer>(int32_t{1}),
- createMetadataRecord<MetadataRecord::RecordKinds::WalltimeMarker>(
- int64_t{1}, int32_t{2}),
- createMetadataRecord<MetadataRecord::RecordKinds::Pid>(int32_t{1}),
- };
- ASSERT_THAT(Writer.writeMetadataRecords(Preamble),
- Eq(sizeof(MetadataRecord) * 3));
- ASSERT_TRUE(Writer.writeMetadata<MetadataRecord::RecordKinds::NewCPUId>(1));
- ASSERT_TRUE(
- Writer.writeFunction(FDRLogWriter::FunctionRecordKind::Enter, 1, 1));
- ASSERT_TRUE(
- Writer.writeFunction(FDRLogWriter::FunctionRecordKind::Exit, 1, 1));
- ASSERT_EQ(Buffers.releaseBuffer(B), BufferQueue::ErrorCode::Ok);
- ASSERT_EQ(B.Data, nullptr);
- ASSERT_EQ(Buffers.finalize(), BufferQueue::ErrorCode::Ok);
-
- // We then need to go through each element of the Buffers, and re-create a
- // flat buffer that we would see if they were laid out in a file. This also
- // means we need to write out the header manually.
- // TODO: Isolate the file header writing.
- std::string Serialized;
- std::aligned_storage<sizeof(XRayFileHeader), alignof(XRayFileHeader)>::type
- HeaderStorage;
- auto *Header = reinterpret_cast<XRayFileHeader *>(&HeaderStorage);
- new (Header) XRayFileHeader();
- Header->Version = 3;
- Header->Type = FileTypes::FDR_LOG;
- Header->CycleFrequency = 3e9;
- Header->ConstantTSC = 1;
- Header->NonstopTSC = 1;
- Serialized.append(reinterpret_cast<const char *>(&HeaderStorage),
- sizeof(XRayFileHeader));
- size_t BufferCount = 0;
- Buffers.apply([&](const BufferQueue::Buffer &B) {
- ++BufferCount;
- auto Size = atomic_load_relaxed(&B.Extents);
- auto Extents =
- createMetadataRecord<MetadataRecord::RecordKinds::BufferExtents>(Size);
- Serialized.append(reinterpret_cast<const char *>(&Extents),
- sizeof(Extents));
- Serialized.append(reinterpret_cast<const char *>(B.Data), Size);
- });
- ASSERT_EQ(BufferCount, 1u);
-
- llvm::DataExtractor DE(Serialized, true, 8);
- auto TraceOrErr = llvm::xray::loadTrace(DE);
- EXPECT_THAT_EXPECTED(TraceOrErr, HasValue(SizeIs(2)));
-}
-
-} // namespace
-} // namespace __xray
OpenPOWER on IntegriCloud