mercredi 14 août 2019

How to run py_binary to produce input files before testing

I have a py_binary rule like this:

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

and a cc_test like this:

cc_test(
  name = "test",
  src = ["test.cc"],
  data = [":testInputs"],
)

test.cc needs an input file next to it (say input.txt) that is generated by testInputs.py. I want testInputs to get run and provide the input file to the test.

As mentioned here, I tried to to depend on testInputs in the data section. But the test doesn't find the input file nearby. Result of tree bazel-out | grep input.txt shows that even testInput rule has not run at all - since input.txt file not exists at all.

Aucun commentaire:

Enregistrer un commentaire