简体   繁体   中英

How can I implement a regression test in bazel?

I have the following test target:

block_test (
    name = "full_test",
    block = ":block_name"
    ...
    params = {
        "PARAM1" : 1,
        "PARAM2" : 2,
        "PARAM3" : 3
    }
)

And I have a struct which defines the possible values of each param:

params_options = {
    "param1" : [1, 2, 34],
    "param2" : [43, 2 ,54],
    "param3" : [3, 5, 6]
}

I would like to have a single target that would run a target like block_test for every possible combination of parameters.

I thought about doing this by creating a macro which will declare a target for every possible combination of parameters, and finally a test target which will depend on those targets.

Is there any better approach? There may be thousands of combinations and so:

  1. I'm afraid I'll get a big mess when querying the build.
  2. I'm afraid that this isn't very performant, with regards to memory utilization.

You can generate a block_test for each set of parameters using list comprehension:

[block_test (
    name = "full_test",
    block = ":block_name"
    ...
    params = p
) for p in [
    {1, 2, 34},
    {43, 2 ,54},
    {3, 5, 6},
]]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM