베어 메탈 프로그램을 빌드하는 데 bazel을 사용하고 있습니다. qemu에서 bazel에 의해 생성 된 단위 테스트를 실행하고 싶습니다.Bazel : 출력없이 명령을 실행하십시오.
qemu-system-* -some_args -kernel bazel-bin/whatever/generated.elf
나는 '.bzl' 파일에서 내 자신의 규칙을 만들어 사람들을 실행하려고했지만, 출력은 모든 규칙 작업에 필수 것으로 보인다. 목표 아키텍처에 따라 다른 인수를 사용하여 다른 qemu 명령을 호출해야합니다. 나는 그것들을 규칙에 전달하고 싶다.
출력이없는 셸 명령을 호출하는 방법이 있습니까?
미리 감사드립니다.
필요한 경우, 이것은 내가 지금까지 무엇을 가지고 (아직 bazel는 분석 단계에서 중지로 나는 올바른있는 부분 확실하지 않다) :
# run_tests.bzl
===============
def _impl(ctx):
qemu = ctx.attr.qemu
machine = ctx.attr.machine
cpu = ctx.attr.cpu
target = ctx.attr.target
# The command may only access files declared in inputs.
ctx.actions.run_shell(
arguments = [qemu, machine, cpu, target],
command="$1 -M $2 -cpu $3 -nographic -monitor null -serial null -semihosting -kernel $4")
run_tests = rule(
implementation=_impl,
attrs = {"qemu" : attr.string(),
"machine" : attr.string(),
"cpu" : attr.string(),
"target" : attr.string(),},
executable = True
)
그리고 내 BUILD-파일 :
을# BUILD
=======
load("//make:run_tests.bzl", "run_tests")
run_tests(
name = "portos",
qemu = "qemu-system-arm",
machine = "realview-pbx-a9",
cpu = "cortex-a9",
target = ":test_portos.elf"
)
cc_binary(
name = "test_portos.elf",
srcs = glob(["*.cc"]),
deps = ["//src:portos",
"@unity//:unity"],
copts = ["-Isrc",
"-Iexternal/unity/src",
"-Iexternal/unity/extras/fixture/src"]
)
고마워요, 제가 정확히 찾고있는 것이 었습니다. –