-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Enforce EventSetup products can be obtained only with ESGetToken #35588
Conversation
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-35588/25840
Code check has found code style and quality issues which could be resolved by applying following patch(s)
|
Remove all tests of the deprecated API for which tests for the new API exist, and migrate the rest.
ddf4586
to
5538699
Compare
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-35588/25841
|
A new Pull Request was created by @makortel (Matti Kortelainen) for master. It involves the following packages:
@cmsbuild, @smuzaffar, @Dr15Jones, @makortel can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
test parameters:
|
@cmsbuild, please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pointed out the checks in eventsetuprecord_t
test that fail currently. I've been focusing on proxyResetTest()
, and transientTest()
looks somewhat similar. I have not looked to getExepTest()
much yet.
CPPUNIT_ASSERT(&myDummy == &(*hDummy)); | ||
CPPUNIT_ASSERT(!workingProxy->invalidateCalled()); | ||
CPPUNIT_ASSERT(!workingProxy->invalidateTransientCalled()); | ||
|
||
dummyProvider->resetProxies(); | ||
CPPUNIT_ASSERT(workingProxy->invalidateCalled()); | ||
CPPUNIT_ASSERT(workingProxy->invalidateTransientCalled()); | ||
dummyRecord.get(hDummy); | ||
hDummy = dummyRecord.getHandle(token); | ||
CPPUNIT_ASSERT(&myDummy2 == &(*hDummy)); | ||
CPPUNIT_ASSERT(!workingProxy->invalidateCalled()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check fails.
|
||
dummyRecord.get(hDummy); | ||
hDummy = dummyRecord.getHandleImpl<edm::ESHandle>(token); | ||
CPPUNIT_ASSERT(&myDummy2 == &(*hDummy)); | ||
nonConstDummyRecordImpl.resetIfTransientInProxies(); | ||
CPPUNIT_ASSERT(workingProxy->invalidateCalled() == false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check fails.
dummyRecord.setImpl(&dummyRecordImpl, 0, nullptr, &eventSetupImpl_, &pc, false); | ||
dummyRecord.get(dummyPtr); | ||
dummyRecord.setImpl(&dummyRecordImpl, 0, getTokenIndices.data(), &eventSetupImpl_, &pc); | ||
ESHandle<Dummy> dummyPtr = dummyRecord.getHandle(token); | ||
//CPPUNIT_ASSERT_THROW(dummyRecord.get(dummyPtr), ExceptionType); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test expects edm::eventsetup::MakeDataException
to be thrown, but it isn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That exception originates from
cmssw/FWCore/Framework/src/DataProxy.cc
Lines 93 to 95 in d310d6e
if UNLIKELY (nullptr == cache_) { | |
throwMakeException(iRecord, iKey); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FailingDummyProxy
returns a nullptr
from its functions that generate the ES product. That should definitely trigger the exception. What happens of you try to dereference the handle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So a big difference is calling EventSetupRecord::get(edm::ESHandle<....>....)
will trigger running the DataProxy, while EventSetupRecord::getHandle
will not. So I think you need to explicitly trigger the DataProxy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dr15Jones Is this getExepTest()
actually useful given
cmssw/FWCore/Framework/test/eventsetuprecord_t.cppunit.cc
Lines 278 to 297 in 5538699
void testEventsetupRecord::getHandleTest() { | |
FailingDummyProxy dummyProxy; | |
const DataKey dummyDataKey(DataKey::makeTypeTag<FailingDummyProxy::value_type>(), ""); | |
ESHandle<Dummy> dummyPtr; | |
{ | |
DummyDataConsumer consumer{edm::ESInputTag("", "")}; | |
SetupRecord sr{consumer, dummyRecordKey_, eventSetupImpl_, &activityRegistry, {}}; | |
DummyRecord dummyRecord = sr.makeRecord(); | |
CPPUNIT_ASSERT(not dummyRecord.getHandle(consumer.m_token)); | |
dummyPtr = dummyRecord.getHandle(consumer.m_token); | |
CPPUNIT_ASSERT(not dummyPtr.isValid()); | |
CPPUNIT_ASSERT(not dummyPtr); | |
CPPUNIT_ASSERT(dummyPtr.failedToGet()); | |
CPPUNIT_ASSERT_THROW(*dummyPtr, NoDataExceptionType); | |
CPPUNIT_ASSERT_THROW(makeESValid(dummyPtr), cms::Exception); | |
} |
@smuzaffar Does the bot run tests for draft PRs? |
Yes it does |
Please test |
-1 Failed Tests: UnitTests RelVals AddOn Unit TestsI found errors in the following unit tests: ---> test test_MuonGeometryDBConverter had ERRORS ---> test TestDQMOnlineClient-hcalreco_dqm_sourceclient had ERRORS ---> test TestDQMOnlineClient-l1tstage2emulator_dqm_sourceclient had ERRORS ---> test TestDQMOnlineClient-mutracking_dqm_sourceclient had ERRORS and more ... RelVals
Expand to see more relval errors ...AddOn Tests
Expand to see more addon errors ...
|
I collected the EDModules causing the failures to https://docs.google.com/spreadsheets/d/1cUypk2EK4xVcEpFGtaNqXrWZEoFz_E9l4gNN3YoBQH4/edit#gid=72982552 |
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @qliphy (and backports should be raised in the release meeting by the corresponding L2) |
please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-cea191/21208/summary.html CMS deprecated warnings: 39 CMS deprecated warnings found, see summary page for details. Comparison SummarySummary:
|
enable threading |
please test |
-1 Failed Tests: UnitTests CMS deprecated warnings: 39 CMS deprecated warnings found, see summary page for details. Unit TestsI found errors in the following unit tests: ---> test testCondToolsSiStripBuildersReaders had ERRORS Comparison SummarySummary:
|
the unit test failure is not related to this PR: |
+1
|
merge |
PR description:
This PR is intended only for 12_3_X, but is opened already now to find test code outside of framework that would fail with it so we can start migrating those.
This PR changes the deprecated
EventSetupRecord::get()
function to throw an exception, causing all code accessing EventSetup products without ESGetToken.Resolves cms-sw/framework-team#96
PR validation:
Framework unit tests
except three (that I will discuss below)succeed.