• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    visibility = ["//visibility:public"],
31    deps = [
32        "//pw_build/py:pw_build",
33        "//pw_env_setup/py:pw_env_setup",
34        "@python_packages//psutil",
35        "@python_packages//pyserial",
36    ],
37)
38
39pw_py_test(
40    name = "cli_test",
41    srcs = [
42        "tests/cli_test.py",
43    ],
44    imports = ["."],
45    main = "tests/cli_test.py",
46    # TODO: b/348410988 - Test relies on PW_ROOT
47    tags = ["manual"],
48    deps = [
49        ":config_helper",
50        ":mock_emu_frontend",
51        ":pw_emu",
52    ],
53)
54
55pw_py_test(
56    name = "core_test",
57    srcs = [
58        "tests/core_test.py",
59    ],
60    data = [":mock_emu"],
61    main = "tests/core_test.py",
62    # TODO: b/348410988 - Test relies on gdb in environment
63    tags = ["manual"],
64    deps = [
65        ":config_helper",
66        ":mock_emu_frontend",
67        ":pw_emu",
68    ],
69)
70
71pw_py_test(
72    name = "frontend_test",
73    srcs = [
74        "tests/frontend_test.py",
75    ],
76    data = [":mock_emu"],
77    main = "tests/frontend_test.py",
78    # TODO: b/348410988 - Test relies on gdb in environment
79    tags = ["manual"],
80    deps = [
81        ":config_helper",
82        ":mock_emu_frontend",
83        ":pw_emu",
84    ],
85)
86
87pw_py_test(
88    name = "qemu_test",
89    srcs = [
90        "tests/qemu_test.py",
91    ],
92    data = [":mock_emu"],
93    main = "tests/qemu_test.py",
94    # TODO: b/348410988 - Test relies on PW_ROOT
95    tags = ["manual"],
96    deps = [
97        ":config_helper",
98        ":mock_emu_frontend",
99        ":pw_emu",
100    ],
101)
102
103pw_py_test(
104    name = "renode_test",
105    srcs = [
106        "tests/renode_test.py",
107    ],
108    data = [":mock_emu"],
109    main = "tests/renode_test.py",
110    # TODO: b/348410988 - Test relies on PW_ROOT
111    tags = ["manual"],
112    deps = [
113        ":config_helper",
114        ":mock_emu_frontend",
115        ":pw_emu",
116    ],
117)
118
119pw_py_binary(
120    name = "mock_emu",
121    srcs = ["mock_emu.py"],
122)
123
124py_library(
125    name = "config_helper",
126    srcs = ["tests/config_helper.py"],
127    imports = ["tests"],
128)
129
130py_library(
131    name = "mock_emu_frontend",
132    srcs = ["mock_emu_frontend.py"],
133    imports = ["."],
134    deps = ["//pw_env_setup/py:pw_env_setup"],
135)
136