Skip to content

Commit

Permalink
pw_emu: Add bazel python build
Browse files Browse the repository at this point in the history
Change-Id: I5486b14072315c25e7e4df2d59f98d523ced8068
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/217053
Lint: Lint 🤖 <[email protected]>
Presubmit-Verified: CQ Bot Account <[email protected]>
Reviewed-by: Ted Pudlik <[email protected]>
Commit-Queue: Austin Foxley <[email protected]>
Reviewed-by: Octavian Purdila <[email protected]>
  • Loading branch information
afoxley authored and CQ Bot Account committed Jun 20, 2024
1 parent d65c4f2 commit b1a86a0
Showing 1 changed file with 134 additions and 0 deletions.
134 changes: 134 additions & 0 deletions pw_emu/py/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Copyright 2024 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

load("@rules_python//python:defs.bzl", "py_binary", "py_library")
load("//pw_build:python.bzl", "pw_py_test")

py_library(
name = "pw_emu",
srcs = [
"pw_emu/__init__.py",
"pw_emu/__main__.py",
"pw_emu/core.py",
"pw_emu/frontend.py",
"pw_emu/pigweed_emulators.py",
"pw_emu/qemu.py",
"pw_emu/renode.py",
],
imports = ["."],
deps = [
"//pw_build/py:pw_build",
"//pw_env_setup/py:pw_env_setup",
"@python_packages_psutil//:pkg",
"@python_packages_pyserial//:pkg",
],
)

pw_py_test(
name = "cli_test",
srcs = [
"tests/cli_test.py",
],
imports = ["."],
main = "tests/cli_test.py",
# TODO: b/348410988 - Test relies on PW_ROOT
tags = ["manual"],
deps = [
":config_helper",
":mock_emu_frontend",
":pw_emu",
],
)

pw_py_test(
name = "core_test",
srcs = [
"tests/core_test.py",
],
data = [":mock_emu"],
main = "tests/core_test.py",
# TODO: b/348410988 - Test relies on gdb in environment
tags = ["manual"],
deps = [
":config_helper",
":mock_emu_frontend",
":pw_emu",
],
)

pw_py_test(
name = "frontend_test",
srcs = [
"tests/frontend_test.py",
],
data = [":mock_emu"],
main = "tests/frontend_test.py",
# TODO: b/348410988 - Test relies on gdb in environment
tags = ["manual"],
deps = [
":config_helper",
":mock_emu_frontend",
":pw_emu",
],
)

pw_py_test(
name = "qemu_test",
srcs = [
"tests/qemu_test.py",
],
data = [":mock_emu"],
main = "tests/qemu_test.py",
# TODO: b/348410988 - Test relies on PW_ROOT
tags = ["manual"],
deps = [
":config_helper",
":mock_emu_frontend",
":pw_emu",
],
)

pw_py_test(
name = "renode_test",
srcs = [
"tests/renode_test.py",
],
data = [":mock_emu"],
main = "tests/renode_test.py",
# TODO: b/348410988 - Test relies on PW_ROOT
tags = ["manual"],
deps = [
":config_helper",
":mock_emu_frontend",
":pw_emu",
],
)

py_binary(
name = "mock_emu",
srcs = ["mock_emu.py"],
)

py_library(
name = "config_helper",
srcs = ["tests/config_helper.py"],
imports = ["tests"],
)

py_library(
name = "mock_emu_frontend",
srcs = ["mock_emu_frontend.py"],
imports = ["."],
deps = ["//pw_env_setup/py:pw_env_setup"],
)

0 comments on commit b1a86a0

Please sign in to comment.