| # Copyright 2023 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. |
| |
| import("//build/components.gni") |
| import("//build/rust/rustc_library.gni") |
| import( |
| "//src/lib/testing/expectation/fuchsia_test_component_with_expectations.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":starnix-ebpf-tests" ] |
| } |
| |
| rustc_library("ebpf") { |
| edition = "2024" |
| |
| sources = [ |
| "src/api.rs", |
| "src/conformance.rs", |
| "src/converter.rs", |
| "src/error.rs", |
| "src/executor.rs", |
| "src/lib.rs", |
| "src/maps.rs", |
| "src/memio/${current_cpu}.rs", |
| "src/memio/mod.rs", |
| "src/program.rs", |
| "src/scalar_value.rs", |
| "src/verifier.rs", |
| "src/visitor.rs", |
| ] |
| deps = [ |
| "//src/lib/fuchsia-sync", |
| "//src/starnix/lib/linux_uapi", |
| "//third_party/rust_crates:bitflags", |
| "//third_party/rust_crates:byteorder", |
| "//third_party/rust_crates:derivative", |
| "//third_party/rust_crates:paste", |
| "//third_party/rust_crates:smallvec", |
| "//third_party/rust_crates:static_assertions", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:zerocopy", |
| ] |
| |
| configs += [ "//src/starnix/build:kernel_library_config" ] |
| |
| with_unit_tests = true |
| |
| test_deps = [ |
| "//sdk/rust/zx", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/test_util", |
| "//third_party/rust_crates:libc", |
| "//third_party/rust_crates:pest", |
| "//third_party/rust_crates:pest_derive", |
| "//third_party/rust_crates:test-case", |
| ] |
| |
| inputs = [ |
| "src/test_grammar.pest", |
| "src/tests/access_with_check.data", |
| "src/tests/context_parameter.data", |
| "src/tests/mem_oob_underflow.data", |
| "src/tests/div_by_range_with_zero.data", |
| "src/tests/err_context_parameter.data", |
| "src/tests/err_offset_overflow.data", |
| "src/tests/err_read_only_helper.data", |
| "src/tests/err_write_r10.data", |
| "src/tests/exponential_verification.data", |
| "src/tests/forget_release.data", |
| "src/tests/malloc_double_free.data", |
| "src/tests/malloc_use_free.data", |
| "src/tests/map_type_allowed.data", |
| "src/tests/map_type_prohibited.data", |
| "src/tests/null_checks_multiple.data", |
| "src/tests/null_checks_propagated.data", |
| "src/tests/packet_access.data", |
| "src/tests/range_narrowing_with_conditional_jump.data", |
| "src/tests/read_only_helper.data", |
| "src/tests/repro_bpf_mod_mismatch.data", |
| "src/tests/shifts.data", |
| "src/tests/stack_access.data", |
| "src/tests/write_only_helper.data", |
| "//third_party/ubpf/src/tests/add64.data", |
| "//third_party/ubpf/src/tests/add.data", |
| "//third_party/ubpf/src/tests/alu64-arith.data", |
| "//third_party/ubpf/src/tests/alu64-bit.data", |
| "//third_party/ubpf/src/tests/alu64.data", |
| "//third_party/ubpf/src/tests/alu-arith.data", |
| "//third_party/ubpf/src/tests/alu-bit.data", |
| "//third_party/ubpf/src/tests/alu.data", |
| "//third_party/ubpf/src/tests/arsh32-high-shift.data", |
| "//third_party/ubpf/src/tests/arsh64.data", |
| "//third_party/ubpf/src/tests/arsh.data", |
| "//third_party/ubpf/src/tests/arsh-reg.data", |
| "//third_party/ubpf/src/tests/be16.data", |
| "//third_party/ubpf/src/tests/be16-high.data", |
| "//third_party/ubpf/src/tests/be32.data", |
| "//third_party/ubpf/src/tests/be32-high.data", |
| "//third_party/ubpf/src/tests/be64.data", |
| "//third_party/ubpf/src/tests/call.data", |
| "//third_party/ubpf/src/tests/call-memfrob.data", |
| "//third_party/ubpf/src/tests/call-save.data", |
| "//third_party/ubpf/src/tests/call_unwind.data", |
| "//third_party/ubpf/src/tests/call_unwind_fail.data", |
| "//third_party/ubpf/src/tests/div32-by-zero-reg.data", |
| "//third_party/ubpf/src/tests/div32-high-divisor.data", |
| "//third_party/ubpf/src/tests/div32-imm.data", |
| "//third_party/ubpf/src/tests/div32-reg.data", |
| "//third_party/ubpf/src/tests/div64-by-zero-imm.data", |
| "//third_party/ubpf/src/tests/div64-by-zero-reg.data", |
| "//third_party/ubpf/src/tests/div64-imm.data", |
| "//third_party/ubpf/src/tests/div64-negative-imm.data", |
| "//third_party/ubpf/src/tests/div64-negative-reg.data", |
| "//third_party/ubpf/src/tests/div64-reg.data", |
| "//third_party/ubpf/src/tests/div-by-zero-imm.data", |
| "//third_party/ubpf/src/tests/div-by-zero-reg.data", |
| "//third_party/ubpf/src/tests/early-exit.data", |
| "//third_party/ubpf/src/tests/err-call-bad-imm.data", |
| "//third_party/ubpf/src/tests/err-call-unreg.data", |
| "//third_party/ubpf/src/tests/err-endian-size.data", |
| "//third_party/ubpf/src/tests/err-incomplete-lddw2.data", |
| "//third_party/ubpf/src/tests/err-incomplete-lddw.data", |
| "//third_party/ubpf/src/tests/err-infinite-loop.data", |
| "//third_party/ubpf/src/tests/err-invalid-reg-dst.data", |
| "//third_party/ubpf/src/tests/err-invalid-reg-src.data", |
| "//third_party/ubpf/src/tests/err-jmp-lddw.data", |
| "//third_party/ubpf/src/tests/err-jmp-out.data", |
| "//third_party/ubpf/src/tests/err-lddw-invalid-src.data", |
| "//third_party/ubpf/src/tests/err-stack-oob.data", |
| "//third_party/ubpf/src/tests/err-too-many-instructions.data", |
| "//third_party/ubpf/src/tests/err-unknown-opcode.data", |
| "//third_party/ubpf/src/tests/exit.data", |
| "//third_party/ubpf/src/tests/exit-not-last.data", |
| "//third_party/ubpf/src/tests/ja.data", |
| "//third_party/ubpf/src/tests/jeq-imm.data", |
| "//third_party/ubpf/src/tests/jeq-reg.data", |
| "//third_party/ubpf/src/tests/jge-imm.data", |
| "//third_party/ubpf/src/tests/jgt-imm.data", |
| "//third_party/ubpf/src/tests/jgt-reg.data", |
| "//third_party/ubpf/src/tests/jit-bounce.data", |
| "//third_party/ubpf/src/tests/jle-imm.data", |
| "//third_party/ubpf/src/tests/jle-reg.data", |
| "//third_party/ubpf/src/tests/jlt-imm.data", |
| "//third_party/ubpf/src/tests/jlt-reg.data", |
| "//third_party/ubpf/src/tests/jmp.data", |
| "//third_party/ubpf/src/tests/jne-reg.data", |
| "//third_party/ubpf/src/tests/jset-imm.data", |
| "//third_party/ubpf/src/tests/jset-reg.data", |
| "//third_party/ubpf/src/tests/jsge-imm.data", |
| "//third_party/ubpf/src/tests/jsge-reg.data", |
| "//third_party/ubpf/src/tests/jsgt-imm.data", |
| "//third_party/ubpf/src/tests/jsgt-reg.data", |
| "//third_party/ubpf/src/tests/jsle-imm.data", |
| "//third_party/ubpf/src/tests/jsle-reg.data", |
| "//third_party/ubpf/src/tests/jslt-imm.data", |
| "//third_party/ubpf/src/tests/jslt-reg.data", |
| "//third_party/ubpf/src/tests/lddw2.data", |
| "//third_party/ubpf/src/tests/lddw.data", |
| "//third_party/ubpf/src/tests/ldxb-all.data", |
| "//third_party/ubpf/src/tests/ldxb.data", |
| "//third_party/ubpf/src/tests/ldx.data", |
| "//third_party/ubpf/src/tests/ldxdw.data", |
| "//third_party/ubpf/src/tests/ldxh-all2.data", |
| "//third_party/ubpf/src/tests/ldxh-all.data", |
| "//third_party/ubpf/src/tests/ldxh.data", |
| "//third_party/ubpf/src/tests/ldxh-same-reg.data", |
| "//third_party/ubpf/src/tests/ldxw-all.data", |
| "//third_party/ubpf/src/tests/ldxw.data", |
| "//third_party/ubpf/src/tests/le16.data", |
| "//third_party/ubpf/src/tests/le32.data", |
| "//third_party/ubpf/src/tests/le64.data", |
| "//third_party/ubpf/src/tests/lsh-reg.data", |
| "//third_party/ubpf/src/tests/mem-len.data", |
| "//third_party/ubpf/src/tests/mod32.data", |
| "//third_party/ubpf/src/tests/mod64-by-zero-imm.data", |
| "//third_party/ubpf/src/tests/mod64-by-zero-reg.data", |
| "//third_party/ubpf/src/tests/mod64.data", |
| "//third_party/ubpf/src/tests/mod-by-zero-imm.data", |
| "//third_party/ubpf/src/tests/mod-by-zero-reg.data", |
| "//third_party/ubpf/src/tests/mod.data", |
| "//third_party/ubpf/src/tests/mov64-sign-extend.data", |
| "//third_party/ubpf/src/tests/mov.data", |
| "//third_party/ubpf/src/tests/mul32-imm.data", |
| "//third_party/ubpf/src/tests/mul32-reg.data", |
| "//third_party/ubpf/src/tests/mul32-reg-overflow.data", |
| "//third_party/ubpf/src/tests/mul64-imm.data", |
| "//third_party/ubpf/src/tests/mul64-reg.data", |
| "//third_party/ubpf/src/tests/mul-loop.data", |
| "//third_party/ubpf/src/tests/mul-loop-memory-iterations.data", |
| "//third_party/ubpf/src/tests/neg64.data", |
| "//third_party/ubpf/src/tests/neg.data", |
| "//third_party/ubpf/src/tests/prime.data", |
| "//third_party/ubpf/src/tests/reload.data", |
| "//third_party/ubpf/src/tests/rsh32.data", |
| "//third_party/ubpf/src/tests/rsh-reg.data", |
| "//third_party/ubpf/src/tests/stack2.data", |
| "//third_party/ubpf/src/tests/stack3.data", |
| "//third_party/ubpf/src/tests/stack.data", |
| "//third_party/ubpf/src/tests/stb.data", |
| "//third_party/ubpf/src/tests/st.data", |
| "//third_party/ubpf/src/tests/stdw.data", |
| "//third_party/ubpf/src/tests/sth.data", |
| "//third_party/ubpf/src/tests/string-stack.data", |
| "//third_party/ubpf/src/tests/stw.data", |
| "//third_party/ubpf/src/tests/stxb-all2.data", |
| "//third_party/ubpf/src/tests/stxb-all.data", |
| "//third_party/ubpf/src/tests/stxb-chain.data", |
| "//third_party/ubpf/src/tests/stxb.data", |
| "//third_party/ubpf/src/tests/stx.data", |
| "//third_party/ubpf/src/tests/stxdw.data", |
| "//third_party/ubpf/src/tests/stxh.data", |
| "//third_party/ubpf/src/tests/stxw.data", |
| "//third_party/ubpf/src/tests/subnet.data", |
| "//third_party/ubpf/src/tests/unload_reload.data", |
| ] |
| } |
| |
| fuchsia_test_component_with_expectations("starnix-ebpf-tests-component") { |
| manifest = "meta/ebpf_tests.cml" |
| deps = [ ":ebpf_test" ] |
| expectations = "expectations.json5" |
| } |
| |
| fuchsia_test_package("starnix-ebpf-tests") { |
| test_components = [ ":starnix-ebpf-tests-component" ] |
| } |