blob: 89f5d695c0ab9ce92719c2bb02a4b6a2f11c3499 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "gtest/gtest.h"
#include "tools/kazoo/outputs.h"
#include "tools/kazoo/syscall_library.h"
#include "tools/kazoo/test_ir_test_vdsowrappers.test.h"
namespace {
TEST(VdsoWrappersOutput, NormalAndException) {
SyscallLibrary library;
ASSERT_TRUE(SyscallLibraryLoader::FromJson(k_test_vdsowrappers, &library));
StringWriter writer;
ASSERT_TRUE(VdsoWrappersOutput(library, &writer));
EXPECT_EQ(writer.Out(),
R"(// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// WARNING: THIS FILE IS MACHINE GENERATED BY //tools/kazoo. DO NOT EDIT.
zx_status_t _zx_syscall_blocking_write(zx_handle_t handle, const void* buffer, size_t buffer_size, uint64_t offset) {
zx_status_t ret;
do {
ret = SYSCALL_zx_syscall_blocking_write(handle, buffer, buffer_size, offset);
} while (unlikely(ret == ZX_ERR_INTERNAL_INTR_RETRY));
return ret;
}
VDSO_INTERFACE_FUNCTION(zx_syscall_blocking_write);
zx_status_t _zx_syscall_test_wrapper(int32_t a, int32_t b, int32_t c) {
zx_status_t ret;
if (a < 0 || b < 0 || c < 0) return ZX_ERR_INVALID_ARGS;
ret = SYSCALL_zx_syscall_test_wrapper(a, b, c);
if (ret > 50) return ZX_ERR_OUT_OF_RANGE;
return ret;
}
VDSO_INTERFACE_FUNCTION(zx_syscall_test_wrapper);
)");
}
} // namespace