chromium/third_party/perfetto/src/profiling/symbolizer/local_symbolizer_unittest.cc

/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "perfetto/base/build_config.h"
#include "test/gtest_and_gmock.h"

// This translation unit is built only on Linux and MacOS. See //gn/BUILD.gn.
#if PERFETTO_BUILDFLAG(PERFETTO_LOCAL_SYMBOLIZER)

#include <cstddef>

#include "src/base/test/tmp_dir_tree.h"
#include "src/base/test/utils.h"
#include "src/profiling/symbolizer/elf.h"
#include "src/profiling/symbolizer/local_symbolizer.h"
#include "src/profiling/symbolizer/subprocess.h"

#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) ||   \
    PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
    PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE)
#include <unistd.h>
#endif

namespace perfetto {
namespace profiling {
namespace {

TEST(LocalSymbolizerTest, ParseJsonLine) {}

// Creates a very simple ELF file content with the first 20 bytes of `build_id`
// as build id (if build id is shorter the remainin bytes are zero).
std::string CreateElfWithBuildId(const std::string& build_id) {}

#if defined(MEMORY_SANITIZER)
// fts_read() causes some error under msan.
#define NOMSAN_SimpleTree
#else
#define NOMSAN_SimpleTree
#endif
TEST(LocalBinaryIndexerTest, NOMSAN_SimpleTree) {}

#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) ||   \
    PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
    PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE)

#if defined(MEMORY_SANITIZER)
// fts_read() causes some error under msan.
#define NOMSAN_Symlinks
#else
#define NOMSAN_Symlinks
#endif
TEST(LocalBinaryIndexerTest, NOMSAN_Symlinks) {}

#if defined(MEMORY_SANITIZER)
// fts_read() causes some error under msan.
#define NOMSAN_RecursiveSymlinks
#else
#define NOMSAN_RecursiveSymlinks
#endif
TEST(LocalBinaryIndexerTest, NOMSAN_RecursiveSymlinks) {}

#endif  // PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) ||
        // PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) ||
        // PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE)

TEST(LocalBinaryFinderTest, AbsolutePath) {}

TEST(LocalBinaryFinderTest, AbsolutePathWithoutBaseApk) {}

TEST(LocalBinaryFinderTest, OnlyFilename) {}

TEST(LocalBinaryFinderTest, OnlyFilenameWithoutBaseApk) {}

TEST(LocalBinaryFinderTest, BuildIdSubdir) {}

}  // namespace
}  // namespace profiling
}  // namespace perfetto

#endif