blob: 8a822b5d4352fe9efd5b69e1267aa739f664259c [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 "tools/kazoo/outputs.h"
#include "tools/kazoo/syscall_library.h"
#include "tools/kazoo/test.h"
#include "tools/kazoo/test_ir_test_go_reserved_words.test.h"
#include "tools/kazoo/test_ir_test_selection.test.h"
namespace {
TEST(GoSyscallsStubs, Selection) {
SyscallLibrary library;
ASSERT_TRUE(SyscallLibraryLoader::FromJson(k_test_selection, &library));
Writer writer;
ASSERT_TRUE(GoSyscallsStubs(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.
package zx
import "unsafe"
//go:noescape
//go:nosplit
func Sys_selection_futex_requeue(value_ptr *int32, wake_count uint32, current_value int32, requeue_ptr *int32, requeue_count uint32, new_requeue_owner Handle) Status
//go:noescape
//go:nosplit
func Sys_selection_object_wait_one(handle Handle, signals Signals, deadline Time, observed *Signals) Status
//go:noescape
//go:nosplit
func Sys_selection_ktrace_read(handle Handle, data unsafe.Pointer, offset uint32, data_size uint, actual *uint) Status
//go:noescape
//go:nosplit
func Sys_selection_pci_cfg_pio_rw(handle Handle, bus uint8, dev uint8, funk uint8, offset uint8, val *uint32, width uint, write bool) Status
//go:noescape
//go:nosplit
func Sys_selection_job_set_policy(handle Handle, options uint32, topic uint32, policy unsafe.Pointer, policy_size uint32) Status
//go:noescape
//go:nosplit
func Sys_selection_clock_get(clock_id uint32, out *Time) Status
)");
}
TEST(GoSyscallsStubs, ReservedWords) {
SyscallLibrary library;
ASSERT_TRUE(SyscallLibraryLoader::FromJson(k_test_go_reserved_words, &library));
Writer writer;
ASSERT_TRUE(GoSyscallsStubs(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.
package zx
import "unsafe"
//go:noescape
//go:nosplit
func Sys_reservedwords_my_func(typ uint32, funk uint32, g_ uint32) Status
//go:noescape
//go:nosplit
func Sys_reservedwords_pci_types(bar *uintptr, initarg *uintptr, device_info *uintptr) Status
)");
}
TEST(GoSyscallsAsm, Selection) {
SyscallLibrary library;
ASSERT_TRUE(SyscallLibraryLoader::FromJson(k_test_selection, &library));
Writer writer;
ASSERT_TRUE(GoSyscallsAsm(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.
#include "textflag.h"
// func Sys_selection_futex_requeue(value_ptr *int32, wake_count uint32, current_value int32, requeue_ptr *int32, requeue_count uint32, new_requeue_owner Handle) Status
TEXT ·Sys_selection_futex_requeue(SB),NOSPLIT,$0
JMP runtime·vdsoCall_zx_selection_futex_requeue(SB)
// func Sys_selection_object_wait_one(handle Handle, signals Signals, deadline Time, observed *Signals) Status
TEXT ·Sys_selection_object_wait_one(SB),NOSPLIT,$0
JMP runtime·vdsoCall_zx_selection_object_wait_one(SB)
// func Sys_selection_ktrace_read(handle Handle, data unsafe.Pointer, offset uint32, data_size uint, actual *uint) Status
TEXT ·Sys_selection_ktrace_read(SB),NOSPLIT,$0
JMP runtime·vdsoCall_zx_selection_ktrace_read(SB)
// func Sys_selection_pci_cfg_pio_rw(handle Handle, bus uint8, dev uint8, funk uint8, offset uint8, val *uint32, width uint, write bool) Status
TEXT ·Sys_selection_pci_cfg_pio_rw(SB),NOSPLIT,$0
JMP runtime·vdsoCall_zx_selection_pci_cfg_pio_rw(SB)
// func Sys_selection_job_set_policy(handle Handle, options uint32, topic uint32, policy unsafe.Pointer, policy_size uint32) Status
TEXT ·Sys_selection_job_set_policy(SB),NOSPLIT,$0
JMP runtime·vdsoCall_zx_selection_job_set_policy(SB)
// func Sys_selection_clock_get(clock_id uint32, out *Time) Status
TEXT ·Sys_selection_clock_get(SB),NOSPLIT,$0
JMP runtime·vdsoCall_zx_selection_clock_get(SB)
)");
}
} // namespace