1//===-- Unittests for x86_64 syscalls -------------------------------------===//
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-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "src/__support/CPP/functional.h"
10#include "src/__support/OSUtil/syscall.h"
11#include "test/UnitTest/Test.h"
12
13TEST(LlvmLibcX86_64_SyscallTest, APITest) {
14 // We only do a signature test here. Actual functionality tests are
15 // done by the unit tests of the syscall wrappers like mmap.
16
17 using LIBC_NAMESPACE::cpp::function;
18
19 function<long(long)> f(
20 [](long n) { return LIBC_NAMESPACE::syscall_impl<long>(number: n); });
21 function<long(long, long)> f1([](long n, long a1) {
22 return LIBC_NAMESPACE::syscall_impl<long>(number: n, ts: a1);
23 });
24 function<long(long, long, long)> f2([](long n, long a1, long a2) {
25 return LIBC_NAMESPACE::syscall_impl<long>(number: n, ts: a1, ts: a2);
26 });
27 function<long(long, long, long, long)> f3(
28 [](long n, long a1, long a2, long a3) {
29 return LIBC_NAMESPACE::syscall_impl<long>(number: n, ts: a1, ts: a2, ts: a3);
30 });
31 function<long(long, long, long, long, long)> f4(
32 [](long n, long a1, long a2, long a3, long a4) {
33 return LIBC_NAMESPACE::syscall_impl<long>(number: n, ts: a1, ts: a2, ts: a3, ts: a4);
34 });
35 function<long(long, long, long, long, long, long)> f5(
36 [](long n, long a1, long a2, long a3, long a4, long a5) {
37 return LIBC_NAMESPACE::syscall_impl<long>(number: n, ts: a1, ts: a2, ts: a3, ts: a4, ts: a5);
38 });
39 function<long(long, long, long, long, long, long, long)> f6(
40 [](long n, long a1, long a2, long a3, long a4, long a5, long a6) {
41 return LIBC_NAMESPACE::syscall_impl<long>(number: n, ts: a1, ts: a2, ts: a3, ts: a4, ts: a5, ts: a6);
42 });
43
44 function<long(long, void *)> not_long_type([](long n, void *a1) {
45 return LIBC_NAMESPACE::syscall_impl<long>(number: n, ts: a1);
46 });
47}
48

source code of libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp