Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add cpp test of validator into pr checks #33371

Merged
merged 25 commits into from
Mar 23, 2021

Conversation

antiphoton
Copy link
Member

No description provided.

@amp-owners-bot
Copy link

amp-owners-bot bot commented Mar 18, 2021

Hey @rsimha! These files were changed:

.circleci/config.yml
.circleci/install_validator_dependencies.sh
build-system/pr-check/build-targets.js
build-system/pr-check/validator-tests.js

Hey @ampproject/wg-caching! These files were changed:

validator/.gitignore

@antiphoton antiphoton marked this pull request as draft March 18, 2021 20:40
Copy link
Contributor

@rsimha rsimha left a comment

Choose a reason for hiding this comment

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

A couple initial comments. Happy to help in addressing them.

build-system/pr-check/validator-tests.js Outdated Show resolved Hide resolved
build-system/pr-check/validator-tests.js Outdated Show resolved Hide resolved
@danielrozenberg danielrozenberg removed their request for review March 18, 2021 21:39
Copy link
Contributor

@rsimha rsimha left a comment

Choose a reason for hiding this comment

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

Getting closer. A few more suggestions.

amp.js Outdated Show resolved Hide resolved
build-system/tasks/validator.js Outdated Show resolved Hide resolved
build-system/tasks/validator.js Outdated Show resolved Hide resolved
build-system/tasks/validator.js Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
@antiphoton
Copy link
Member Author

During the time the --update-tests are not available for C++, should we make this pr check as optional?

@rsimha
Copy link
Contributor

rsimha commented Mar 19, 2021

During the time the --update-tests are not available for C++, should we make this pr check as optional?

We don't ever run --update-tests during CI. IIUC, It's only run during local development to update expected results when a developer (typically someone on @ampproject/wg-caching?) makes a change to the engine. (David or Greg can keep me honest here.)

So if these tests are stable and won't arbitrarily fail when runtime code changes, I'm in favor of checking them in as is.

@honeybadgerdontcare
Copy link
Contributor

Raghu is correct. --update-tests is developer initiated and shouldn't be initiated elsewhere as that may have unintended consequences.

.circleci/config.yml Outdated Show resolved Hide resolved
@antiphoton antiphoton marked this pull request as ready for review March 22, 2021 02:15
@antiphoton antiphoton marked this pull request as draft March 22, 2021 02:16
@antiphoton antiphoton marked this pull request as ready for review March 22, 2021 02:37
@antiphoton antiphoton requested a review from rsimha March 22, 2021 16:49
@rsimha
Copy link
Contributor

rsimha commented Mar 22, 2021

Nice work in getting this to work @antiphoton! There's one more high-level point that needs to be addressed before this can be checked in.

I'm seeing that we've increased the running time of the Validator Tests job from ~5m to ~19m. I'm also seeing that the CPP tests take ~1 second to run, and that bulk of the time is spent on the build.

Unfortunately, this is going to have a non-trivial effect on CI. Restarting a flaky build will now result in a nearly 20 minutes of additional running time, not to mention the fact that we're now going to run this against almost every new AMP PR.

A couple questions:

  • Is there any way to speed up the CPP build? Can we use parallelism? (For comparison, we build ~170 AMP components and ~300 ad vendor files with closure compiler in about 4 minutes.)
  • Must the Validator CPP tests be triggered for all AMP changes? What if they are triggered only when validator code is changed?

/cc @ampproject/wg-caching

@antiphoton antiphoton marked this pull request as draft March 22, 2021 18:10
@honeybadgerdontcare
Copy link
Contributor

  • Must the Validator CPP tests be triggered for all AMP changes? What if they are triggered only when validator code is changed?

It can be triggered for validator only changes. I think this should cover it, @caoboxiao can you double check that these are the files/folders we'd want tested when changed by the C++ Validator.

validator/cpp/**
validator/testdata/**
validator/**.protoascii
validator/**.proto
extensions/**/validator-**.protoascii
extensions/**/validator-**.html
extensions/**/validator-**.out
extensions/**/validator-**.out.cpponly

@antiphoton
Copy link
Member Author

validator/cpp/**
validator/testdata/**
validator/**.protoascii
validator/**.proto
extensions/**/validator-**.protoascii
extensions/**/validator-**.html
extensions/**/validator-**.out
extensions/**/validator-**.out.cpponly

Yes, this list covers all dependencies of c++ validator tests.

@antiphoton
Copy link
Member Author

  • Must the Validator CPP tests be triggered for all AMP changes? What if they are triggered only when validator code is changed?

I made some changes so that Validator Tests now skips amp validator-cpp when the PR does not change validator files.

@antiphoton antiphoton marked this pull request as ready for review March 22, 2021 20:35
@antiphoton antiphoton marked this pull request as draft March 23, 2021 16:46
.circleci/config.yml Outdated Show resolved Hide resolved
build-system/pr-check/validator-tests.js Show resolved Hide resolved
build-system/pr-check/validator-cpp-test.js Outdated Show resolved Hide resolved
.circleci/config.yml Show resolved Hide resolved
.circleci/install_validator_dependencies.sh Outdated Show resolved Hide resolved
@antiphoton antiphoton marked this pull request as ready for review March 23, 2021 17:46
Copy link
Contributor

@rsimha rsimha left a comment

Choose a reason for hiding this comment

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

Thanks for patiently addressing all comments. With a ~7 minute total running time for all three validator test types, this PR now LGTM!

A future clean up item would be to make the bazel logs less noisy, and only print error messages. I'm okay with handling that via a separate PR.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants