1# Copyright 2024 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15load("@rules_python//python:defs.bzl", "py_library") 16load("//pw_build:python.bzl", "pw_py_binary", "pw_py_test") 17 18py_library( 19 name = "pw_emu", 20 srcs = [ 21 "pw_emu/__init__.py", 22 "pw_emu/__main__.py", 23 "pw_emu/core.py", 24 "pw_emu/frontend.py", 25 "pw_emu/pigweed_emulators.py", 26 "pw_emu/qemu.py", 27 "pw_emu/renode.py", 28 ], 29 imports = ["."], 30 deps = [ 31 "//pw_build/py:pw_build", 32 "//pw_env_setup/py:pw_env_setup", 33 "@python_packages//psutil", 34 "@python_packages//pyserial", 35 ], 36) 37 38pw_py_test( 39 name = "cli_test", 40 srcs = [ 41 "tests/cli_test.py", 42 ], 43 imports = ["."], 44 main = "tests/cli_test.py", 45 # TODO: b/348410988 - Test relies on PW_ROOT 46 tags = ["manual"], 47 deps = [ 48 ":config_helper", 49 ":mock_emu_frontend", 50 ":pw_emu", 51 ], 52) 53 54pw_py_test( 55 name = "core_test", 56 srcs = [ 57 "tests/core_test.py", 58 ], 59 data = [":mock_emu"], 60 main = "tests/core_test.py", 61 # TODO: b/348410988 - Test relies on gdb in environment 62 tags = ["manual"], 63 deps = [ 64 ":config_helper", 65 ":mock_emu_frontend", 66 ":pw_emu", 67 ], 68) 69 70pw_py_test( 71 name = "frontend_test", 72 srcs = [ 73 "tests/frontend_test.py", 74 ], 75 data = [":mock_emu"], 76 main = "tests/frontend_test.py", 77 # TODO: b/348410988 - Test relies on gdb in environment 78 tags = ["manual"], 79 deps = [ 80 ":config_helper", 81 ":mock_emu_frontend", 82 ":pw_emu", 83 ], 84) 85 86pw_py_test( 87 name = "qemu_test", 88 srcs = [ 89 "tests/qemu_test.py", 90 ], 91 data = [":mock_emu"], 92 main = "tests/qemu_test.py", 93 # TODO: b/348410988 - Test relies on PW_ROOT 94 tags = ["manual"], 95 deps = [ 96 ":config_helper", 97 ":mock_emu_frontend", 98 ":pw_emu", 99 ], 100) 101 102pw_py_test( 103 name = "renode_test", 104 srcs = [ 105 "tests/renode_test.py", 106 ], 107 data = [":mock_emu"], 108 main = "tests/renode_test.py", 109 # TODO: b/348410988 - Test relies on PW_ROOT 110 tags = ["manual"], 111 deps = [ 112 ":config_helper", 113 ":mock_emu_frontend", 114 ":pw_emu", 115 ], 116) 117 118pw_py_binary( 119 name = "mock_emu", 120 srcs = ["mock_emu.py"], 121) 122 123py_library( 124 name = "config_helper", 125 srcs = ["tests/config_helper.py"], 126 imports = ["tests"], 127) 128 129py_library( 130 name = "mock_emu_frontend", 131 srcs = ["mock_emu_frontend.py"], 132 imports = ["."], 133 deps = ["//pw_env_setup/py:pw_env_setup"], 134) 135