Skip to content

build: allow disabling metamorphic constants with tag#77423

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
darinpp:metamorphic-disable-tag
Mar 8, 2022
Merged

build: allow disabling metamorphic constants with tag#77423
craig[bot] merged 1 commit intocockroachdb:masterfrom
darinpp:metamorphic-disable-tag

Conversation

@darinpp
Copy link
Copy Markdown
Contributor

@darinpp darinpp commented Mar 7, 2022

Previously #76309 added the ability to disable metamorphic constants
with env variable COCKROACH_INTERNAL_DISABLE_METAMORPHIC_TESTING which
disabled the metamorphic constants when set to true. For some tools
however (execgen, roachpb/gen) setting an evironment variable may not
be always possible. So this PR adds the ability to disable the
metamorphic testing through tag metamorphic_disable. It would seem
that similar thing could be achieved by using the crdb_test_off tag
instead. With bazel however this tag is ignored.

Fixes #76363

Release justification: Non-production code changes
Release note: None

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@darinpp darinpp force-pushed the metamorphic-disable-tag branch from 0984499 to 37aafa1 Compare March 7, 2022 16:10
Previously cockroachdb#76309 added the ability to disable metamorphic constants
with env variable COCKROACH_INTERNAL_DISABLE_METAMORPHIC_TESTING which
disabled the metamorphic constants when set to true. For some tools
however (execgen, roachpb/gen) setting an evironment variable may not
be always possible. So this PR adds the ability to disable the
metamorphic testing through tag `metamorphic_disable`. It would seem
that similar thing could be achieved by using the crdb_test_off tag
instead. With bazel however this tag is ignored.

Fixes cockroachdb#76363

Release justification: Non-production code changes
Release note: None
@darinpp darinpp force-pushed the metamorphic-disable-tag branch from 37aafa1 to 633a677 Compare March 7, 2022 17:57
go_binary(
name = "gen",
embed = [":gen_lib"],
gotags = ["metamorphic_disable"],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the way gotags works, this change would require re-compiling all the stuff that pkg/roachpb/gen and execgen depend on including the entire Go standard library with the new gotags. I suspect this would have a bigger performance impact than we want considering how small this conditional branch is.

I would expect instead that we set the environment variable wherever it needs to be set -- i.e. in the env attribute of the call to ctx.actions.run() in pkg/roachpb/gen.bzl and in the various places we call into execgen as part of the build. Is there a reason we haven't done that?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We went over this in DM and I don't think this is anything to be concerned about for now, we can follow-up on it if it turns out to be relevant.

@rickystewart rickystewart self-requested a review March 7, 2022 18:20
go_binary(
name = "gen",
embed = [":gen_lib"],
gotags = ["metamorphic_disable"],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We went over this in DM and I don't think this is anything to be concerned about for now, we can follow-up on it if it turns out to be relevant.

@darinpp
Copy link
Copy Markdown
Contributor Author

darinpp commented Mar 7, 2022

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 8, 2022

Build succeeded:

@craig craig bot merged commit 1b7bcfa into cockroachdb:master Mar 8, 2022
@darinpp darinpp deleted the metamorphic-disable-tag branch March 9, 2022 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bazel: log spam from metamorphic constants during code generations

3 participants