blob: ca8e36221649dbf42e053cc7456373e107fba4db [file]
# Copyright 2026 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.
load(
"//build/bazel/rules/components:fx_component.bzl",
"fx_component_manifest",
"fx_test_component",
)
load("//build/bazel/rules/packages:fx_package.bzl", "fx_package")
load(
"//build/bazel/rules/packages:fx_packaged_binary.bzl",
"fx_packaged_binary",
)
load("//build/bazel/rules/rust:rustc_library.bzl", "rustc_library")
load("//build/bazel/rules/rust:rustc_test.bzl", "rustc_test")
load("//build/bazel/rules/testing:fx_test.bzl", "fx_test")
package(default_applicable_licenses = ["//:license"])
rustc_library(
name = "syscalls",
srcs = [
"lib.rs",
"misc.rs",
"reboot.rs",
],
crate_name = "starnix_modules_syscalls",
crate_root = "lib.rs",
edition = "2024",
lint_config = "//src/starnix/build:kernel_library_config",
visibility = ["//src/starnix/kernel/syscall_loop:__pkg__"],
deps = [
"//sdk/fidl/fuchsia.buildinfo:fuchsia.buildinfo_rust",
"//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol_rust",
"//sdk/rust/zx",
"//src/lib/fuchsia-component",
"//src/starnix/kernel/core",
"//src/starnix/lib/linux_uapi",
"//src/starnix/lib/starnix_crypto",
"//src/starnix/lib/starnix_logging",
"//src/starnix/lib/starnix_sync",
"//src/starnix/lib/starnix_syscalls",
"//src/starnix/lib/starnix_types",
"//src/starnix/lib/starnix_uapi",
"//third_party/rust_crates/vendor:bstr",
"//third_party/rust_crates/vendor:zerocopy",
],
)
rustc_test(
name = "syscalls_test",
crate = ":syscalls",
crate_name = "starnix_modules_syscalls_lib_test",
edition = "2024",
lint_config = "//src/starnix/build:kernel_library_config",
# TODO(https://fxbug.dev/42059075): Re-enable starnix in these environments.
tags = [
"exclude_toolchain_tags=asan",
"exclude_toolchain_tags=hwasan",
],
)
fx_packaged_binary(
name = "syscalls_test_packaged_bin",
testonly = True,
binary = ":syscalls_test",
binary_name = "starnix_modules_syscalls_lib_test",
)
fx_component_manifest(
name = "starnix-syscalls-tests-manifest",
testonly = True,
component_name = "starnix-syscalls-tests",
includes = [
"//sdk/lib/inspect:client.shard",
"//sdk/lib/syslog:client.shard",
"//src/sys/test_runners/starnix:unit_test.shard.cml",
],
manifest = "meta/starnix_syscalls_tests.cml",
)
fx_test_component(
name = "starnix-syscalls-tests-component",
compiled_manifest = ":starnix-syscalls-tests-manifest",
test_type = "starnix",
deps = [
":syscalls_test_packaged_bin",
# In GN, //src/starnix/kernel/vdso is a resource() propagated through
# //src/starnix/kernel/core's deps.
"//src/starnix/kernel/vdso",
],
)
fx_package(
name = "starnix-syscalls-tests-package",
package_name = "starnix-syscalls-tests",
test_components = [":starnix-syscalls-tests-component"],
)
fx_test(
name = "starnix-syscalls-tests",
package = ":starnix-syscalls-tests-package",
)