brintos

brintos / llvm-project-archived public Read only

0
0
Text · 894 B · 6452021 Raw
26 lines · cpp
1//===-- Unittests for uname -----------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "src/__support/CPP/string_view.h"10#include "src/__support/macros/properties/architectures.h"11#include "src/sys/utsname/uname.h"12#include "test/UnitTest/ErrnoSetterMatcher.h"13#include "test/UnitTest/Test.h"14 15#include <sys/utsname.h>16 17TEST(LlvmLibcUnameTest, GetMachineName) {18  struct utsname names;19  ASSERT_GE(LIBC_NAMESPACE::uname(&names), 0);20#ifdef LIBC_TARGET_ARCH_IS_X86_6421  ASSERT_STREQ(names.machine, "x86_64");22#elif defined(LIBC_TARGET_ARCH_IS_AARCH64)23  ASSERT_STREQ(names.machine, "aarch64");24#endif25}26