netskink
netskink

Reputation: 4539

How to specify a bazel test env setting for a cc_test?

I'm trying to specify a env variable for a bazel test. I've tried the following but it fails:

cc_test(
    name = "some_test",
    size = "small",
    deps = ["some_thing"],
    srcs = ["test.cc"],
    env = ["ENVVAR=foo"],
}

Upvotes: 2

Views: 1326

Answers (1)

netskink
netskink

Reputation: 4539

I could not find this documented and I found it by trial and error. This works.

cc_test(
    name = "some_test",
    size = "small",
    deps = ["some_thing"],
    srcs = ["test.cc"],
    env = {"ENVVAR":"foo"},
}

Upvotes: 3

Related Questions