proxygen
|
#include <algorithm>
#include <array>
#include <iterator>
#include <sstream>
#include <string>
#include <vector>
#include <boost/filesystem.hpp>
#include <folly/Conv.h>
#include <folly/Format.h>
#include <folly/Random.h>
#include <folly/String.h>
#include <folly/Subprocess.h>
#include <folly/lang/Bits.h>
#include <folly/portability/GTest.h>
#include <folly/portability/Unistd.h>
#include <folly/tracing/StaticTracepoint.h>
#include <folly/tracing/test/StaticTracepointTestModule.h>
Go to the source code of this file.
Classes | |
struct | testStruct |
Functions | |
static uint8_t | hexToInt (const std::string &hex) |
static int | get4BytesValue (const std::vector< uint8_t > &v, size_t &pos) |
static void | align4Bytes (size_t &pos) |
static int | getNextZero (const std::vector< uint8_t > &v, const size_t curPos, const size_t limit) |
static intptr_t | getAddr (const std::vector< uint8_t > &v, size_t &pos) |
static std::string | getStr (const std::vector< uint8_t > &v, size_t &pos, const size_t len) |
static std::string | getExe () |
static std::string | getNoteRawContent (const std::string &fileName) |
static std::vector< uint8_t > | readNote (const std::string &fileName) |
template<std::size_t SIZE> | |
static void | checkTracepointArguments (const std::string &arguments, std::array< int, SIZE > &expectedSize) |
static bool | getTracepointArguments (const std::string &expectedProvider, const std::string &expectedProbe, const uintptr_t expectedSemaphore, std::string &arguments) |
static uint32_t | arrayTestFunc () |
TEST (StaticTracepoint, TestArray) | |
static uint32_t | pointerTestFunc () |
TEST (StaticTracepoint, TestPointer) | |
static void | emptyTestFunc () |
TEST (StaticTracepoint, TestEmpty) | |
static uint32_t | manyArgTypesTestFunc () |
TEST (StaticTracepoint, TestManyArgTypes) | |
static FOLLY_ALWAYS_INLINE uint32_t | alwaysInlineTestFunc () |
TEST (StaticTracepoint, TestAlwaysInline) | |
static void | branchTestFunc () |
TEST (StaticTracepoint, TestBranch) | |
static void | structTestFunc () |
TEST (StaticTracepoint, TestStruct) | |
TEST (StaticTracepoint, TestSemaphoreLocal) | |
FOLLY_SDT_DECLARE_SEMAPHORE (folly, test_semaphore_extern) | |
TEST (StaticTracepoint, TestSemaphoreExtern) | |
Variables | |
static const std::string | kUSDTSubsectionName = FOLLY_SDT_NOTE_NAME |
static const int | kUSDTNoteType = FOLLY_SDT_NOTE_TYPE |
static const size_t | kAddrWidth = sizeof(void*) |
|
static |
Definition at line 52 of file StaticTracepointTest.cpp.
Referenced by getTracepointArguments().
|
static |
Definition at line 335 of file StaticTracepointTest.cpp.
References a, b, FOLLY_SDT, folly::Random::rand32(), and uint32_t.
Referenced by TEST().
|
static |
Definition at line 239 of file StaticTracepointTest.cpp.
References a, FOLLY_SDT, folly::Random::rand32(), uint32_t, and uint64_t.
Referenced by TEST().
|
static |
Definition at line 352 of file StaticTracepointTest.cpp.
References a, b, FOLLY_SDT, max, folly::Random::rand32(), and uint32_t.
Referenced by TEST().
|
static |
Definition at line 148 of file StaticTracepointTest.cpp.
References folly::empty(), EXPECT_EQ, EXPECT_FALSE, EXPECT_LT, EXPECT_NE, i, folly::size(), folly::split(), and string.
Referenced by TEST().
|
static |
Definition at line 277 of file StaticTracepointTest.cpp.
References FOLLY_SDT.
Referenced by TEST().
|
static |
Definition at line 47 of file StaticTracepointTest.cpp.
References folly::Endian::little().
Referenced by getTracepointArguments().
|
static |
Definition at line 69 of file StaticTracepointTest.cpp.
References kAddrWidth, folly::Endian::little(), and string.
Referenced by getTracepointArguments().
|
static |
Definition at line 89 of file StaticTracepointTest.cpp.
References folly::sformat().
Referenced by getTracepointArguments().
|
static |
Definition at line 58 of file StaticTracepointTest.cpp.
Referenced by getTracepointArguments().
|
static |
Definition at line 94 of file StaticTracepointTest.cpp.
References kUSDTSubsectionName, gmock_output_test::output, folly::Subprocess::Options::pipeStdout(), gmock_test_utils::Subprocess, and folly::Subprocess::Options::usePath().
Referenced by readNote().
|
static |
|
static |
This helper reads the .note.stapsdt section of the currently running binary, checks if the tracepoints listed there are properly formatted, and return the arguments layout description string for the expected provider and probe combination if it exists.
Definition at line 170 of file StaticTracepointTest.cpp.
References align4Bytes(), exe, get4BytesValue(), getAddr(), getExe(), getNextZero(), getStr(), folly::recordio_helpers::headerSize(), kAddrWidth, kUSDTNoteType, kUSDTSubsectionName, readNote(), and string.
Referenced by TEST().
|
static |
Definition at line 40 of file StaticTracepointTest.cpp.
References uint8_t, and value.
Referenced by readNote().
|
static |
Definition at line 292 of file StaticTracepointTest.cpp.
References a, b, FOLLY_SDT, FOLLY_SDT_WITH_SEMAPHORE, folly::Random::rand32(), and uint32_t.
Referenced by TEST().
|
static |
Definition at line 258 of file StaticTracepointTest.cpp.
References a, FOLLY_SDT, folly::Random::rand32(), string, and uint32_t.
Referenced by TEST().
|
static |
Definition at line 110 of file StaticTracepointTest.cpp.
References getNoteRawContent(), hexToInt(), i, kUSDTSubsectionName, folly::gen::lines(), folly::size(), folly::split(), and string.
Referenced by getTracepointArguments().
|
static |
Definition at line 384 of file StaticTracepointTest.cpp.
References testStruct::a, testStruct::b, FOLLY_SDT, folly::Random::rand32(), s, and folly::pushmi::detail::t.
Referenced by TEST().
TEST | ( | StaticTracepoint | , |
TestArray | |||
) |
Definition at line 248 of file StaticTracepointTest.cpp.
References arrayTestFunc(), ASSERT_TRUE, checkTracepointArguments(), getTracepointArguments(), int64_t, and string.
TEST | ( | StaticTracepoint | , |
TestPointer | |||
) |
Definition at line 267 of file StaticTracepointTest.cpp.
References ASSERT_TRUE, checkTracepointArguments(), getTracepointArguments(), pointerTestFunc(), and string.
TEST | ( | StaticTracepoint | , |
TestEmpty | |||
) |
Definition at line 281 of file StaticTracepointTest.cpp.
References ASSERT_TRUE, emptyTestFunc(), EXPECT_TRUE, FOLLY_SDT_DEFINE_SEMAPHORE, getTracepointArguments(), and string.
TEST | ( | StaticTracepoint | , |
TestManyArgTypes | |||
) |
Definition at line 316 of file StaticTracepointTest.cpp.
References ASSERT_TRUE, checkTracepointArguments(), getTracepointArguments(), manyArgTypesTestFunc(), string, and uint32_t.
TEST | ( | StaticTracepoint | , |
TestAlwaysInline | |||
) |
Definition at line 342 of file StaticTracepointTest.cpp.
References alwaysInlineTestFunc(), ASSERT_TRUE, checkTracepointArguments(), getTracepointArguments(), string, and uint32_t.
TEST | ( | StaticTracepoint | , |
TestBranch | |||
) |
Definition at line 362 of file StaticTracepointTest.cpp.
References ASSERT_TRUE, branchTestFunc(), checkTracepointArguments(), getTracepointArguments(), string, and uint32_t.
TEST | ( | StaticTracepoint | , |
TestStruct | |||
) |
Definition at line 393 of file StaticTracepointTest.cpp.
References ASSERT_TRUE, checkTracepointArguments(), getTracepointArguments(), string, and structTestFunc().
TEST | ( | StaticTracepoint | , |
TestSemaphoreLocal | |||
) |
Definition at line 403 of file StaticTracepointTest.cpp.
References ASSERT_TRUE, checkTracepointArguments(), EXPECT_FALSE, FOLLY_SDT_DECLARE_SEMAPHORE(), FOLLY_SDT_IS_ENABLED, FOLLY_SDT_SEMAPHORE, getTracepointArguments(), manyArgTypesTestFunc(), and string.
TEST | ( | StaticTracepoint | , |
TestSemaphoreExtern | |||
) |
Definition at line 419 of file StaticTracepointTest.cpp.
References EXPECT_FALSE, FOLLY_SDT_IS_ENABLED, folly::Random::rand32(), and folly::test::staticTracepointTestFunc().
|
static |
Definition at line 38 of file StaticTracepointTest.cpp.
Referenced by getAddr(), and getTracepointArguments().
|
static |
Definition at line 37 of file StaticTracepointTest.cpp.
Referenced by getTracepointArguments().
|
static |
Definition at line 36 of file StaticTracepointTest.cpp.
Referenced by getNoteRawContent(), getTracepointArguments(), and readNote().