/* * Copyright (C) 2017 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/ext/base/utils.h" #include "perfetto/base/build_config.h" #if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) #include <Windows.h> #else #include <fcntl.h> #include <signal.h> #include <unistd.h> #endif #include <stdint.h> #include <algorithm> #include <random> #include <thread> #include "perfetto/ext/base/file_utils.h" #include "perfetto/ext/base/pipe.h" #include "perfetto/ext/base/temp_file.h" #include "test/gtest_and_gmock.h" namespace perfetto { namespace base { namespace { TEST(UtilsTest, ArraySize) { … } TEST(UtilsTest, PipeBlockingRW) { … } // Tests that WriteAllHandle and ReadPlatformHandle work as advertised. // TODO(primiano): normalize File handling on Windows. Right now some places // use POSIX-compat APIs that use "int" file descriptors (_open, _read, _write), // some other places use WINAPI files (CreateFile(), ReadFile()), where the file // is a HANDLE. TEST(UtilsTest, ReadWritePlatformHandle) { … } // Fuchsia doesn't currently support sigaction(), see // https://fxbug.dev/42105390 . #if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \ PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE) TEST(UtilsTest, EintrWrapper) { … } #endif // LINUX | ANDROID | APPLE TEST(UtilsTest, Align) { … } TEST(UtilsTest, HexDump) { … } } // namespace } // namespace base } // namespace perfetto