Skip to content

Conversation

candrews
Copy link
Contributor

@candrews candrews commented Aug 7, 2019

The test suite must always be defined (even when EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED is not defined) so that the test harness doesn't fail due to not being able to find the raii_event_tests test.

This improves upon 95f97f4 actually fixing #9493

@kallewoof
Copy link
Contributor

kallewoof commented Aug 7, 2019

Don't make pull requests into existing releases, make them into master.

Edit: the maintainers pull things into the tagged release versions as appropriate. Pull requests basically always go into master, unless they are specific to some release. Yours seems like a generic fix, although I recognize the gentoo downstream issue.

@candrews candrews force-pushed the patch-1 branch 2 times, most recently from 2728557 to b2c8450 Compare August 7, 2019 16:31
@candrews candrews changed the base branch from 0.18 to master August 7, 2019 16:31
@candrews
Copy link
Contributor Author

candrews commented Aug 7, 2019

Don't make pull requests into existing releases, make them into master.

I've rebased this on master, thank you very much in advance

@maflcko maflcko changed the title Always define the raii_event_tests test suite test: Always define the raii_event_tests test suite Aug 7, 2019
@maflcko
Copy link
Member

maflcko commented Aug 7, 2019

Are there steps to reproduce the bug and see that this commit fixes it?

@candrews
Copy link
Contributor Author

candrews commented Aug 7, 2019

Are there steps to reproduce the bug and see that this commit fixes it?

Have libevent installed so that EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED is not defined (on Gentoo, that's done by installing dev-libs/libevent with the debug flag unset.).
Then, build bitcoin and run the tests. You'll get this error output:

/var/tmp/portage/net-p2p/bitcoind-0.18.0-r1/work/bitcoin-2472733a24a9364e4c6233ccd04166a26a68cc65/src # test/test_bitcoin -l test_suite -t raii_event_creation
Test setup error: no test cases matching filter or all test cases were disabled

With this change, you don't get such a failure.

@DrahtBot DrahtBot added the Tests label Aug 7, 2019
@luke-jr
Copy link
Member

luke-jr commented Aug 8, 2019

See also #16228

@maflcko
Copy link
Member

maflcko commented Aug 8, 2019

Could you move the #if guard inside the boost_auto_test_case, so that the suite and test case appear only once in the file? Also, this does not compile.

@laanwj
Copy link
Member

laanwj commented Aug 14, 2019

Agree that this is an issue and needs to be fixed, however I don't think running empty tests is the right fix to allow for conditional tests.

@candrews
Copy link
Contributor Author

I agree - I much prefer the approach taken in #16228 - perhaps that can be merged?

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 24, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

Copy link
Member

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

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

Concept ACK

#ifndef EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
BOOST_AUTO_TEST_CASE(raii_event_creation)
{
// dummy; do nothing
Copy link
Member

Choose a reason for hiding this comment

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

Suggest replacing with:

    // It would probably be ideal to report skipped, but boost::test doesn't seem to make that practical (at least not in versions available with common distros)
    BOOST_TEST_MESSAGE("Skipping raii_event_tess: libevent doesn't support event_set_mem_functions");


BOOST_FIXTURE_TEST_SUITE(raii_event_tests, BasicTestingSetup)

#ifndef EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
Copy link
Member

Choose a reason for hiding this comment

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

Maybe consider making this an #else later on (or at least turn the existing #ifdef into an #else if we prefer the skip-test on top)

BOOST_FIXTURE_TEST_SUITE(raii_event_tests, BasicTestingSetup)

#ifndef EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
BOOST_AUTO_TEST_CASE(raii_event_creation)
Copy link
Member

Choose a reason for hiding this comment

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

Also suggest renaming the test to raii_event_tests_SKIPPED

The test suite must always be defined (even when EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED is not defined) so that the test harness doesn't fail due to not being able to find the raii_event_tests test.

This improves upon 95f97f4 actually fixing bitcoin#9493
@luke-jr
Copy link
Member

luke-jr commented Sep 20, 2019

@candrews Here's a branch that can be force-pushed over this one if you like it:

master...luke-jr:raii_event_test_fix-0.14

(Cleanly merges to 0.14.0 through master)

@candrews
Copy link
Contributor Author

@candrews Here's a branch that can be force-pushed over this one if you like it:

master...luke-jr:raii_event_test_fix-0.14

(Cleanly merges to 0.14.0 through master)

Awesome, that looks great!

@maflcko
Copy link
Member

maflcko commented Oct 11, 2019

re-run ci

@maflcko maflcko closed this Oct 11, 2019
@maflcko maflcko reopened this Oct 11, 2019
@laanwj
Copy link
Member

laanwj commented Feb 5, 2020

I'd strongly prefer a solution that doesn't run raii_event_tests (and potentially other test suites) when disabled based on build configuration, instead of working around it by conditionally adding empty tests.

@adamjonas
Copy link
Member

HI @candrews - bumping this to see if you'd like to continue to move this forward towards a solution that doesn't run raii_event_tests as requested above?

@candrews
Copy link
Contributor Author

bumping this to see if you'd like to continue to move this forward towards a solution that doesn't run raii_event_tests as requested above?

If someone has a suggestion as to how to do that, I'd be happy to update this PR to implement it.

@luke-jr
Copy link
Member

luke-jr commented May 18, 2020

IMO we should just merge this until a better solution is implemented

@maflcko
Copy link
Member

maflcko commented May 18, 2020

An alternative would be to kill xenial and use something like this: https://www.boost.org/doc/libs/1_59_0/libs/test/doc/html/boost_test/tests_organization/enabling.html

@maflcko
Copy link
Member

maflcko commented May 18, 2020

@maflcko
Copy link
Member

maflcko commented May 18, 2020

Or another alternative (if raising the minimum version of boost is too controversial), could be to make the test skipable when a recent boost version is available or otherwise just make it mandatory and require EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED? (I am assuming that EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED is defined with xenial libevent?)

@maflcko
Copy link
Member

maflcko commented May 31, 2020

The alternative was closed #16228 (comment), so this seems the best bet right now.

It can be improved upon later by bumping boost #16564 (comment), but that might or might not be controversial.

ACK

@maflcko maflcko closed this May 31, 2020
@maflcko maflcko reopened this May 31, 2020
@maflcko
Copy link
Member

maflcko commented May 31, 2020

Tested ACK:

  • Current master make check fails as if
$ ./src/test/test_bitcoin -t raii_event_tests
Test setup error: no test cases matching filter or all test cases were disabled
  • This pull:
$ ./src/test/test_bitcoin -t raii_event_tests
Running 1 test case...

*** No errors detected

ACK 9a19c9a 🎹

Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

ACK 9a19c9ada53e84d1ee8521b48f656faad48b737a 🎹
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgI0wv/eTNXTgQxxtVBd5iJ83l2Nl0JDo6pKMb1HnS7O+RYBuVywr365x3RuiN5
q+GtEc+od70x0Ln/YcJ3tDYcUYsUg/N39petAgE2vkYnD4hCoGBRuV6ftRWiHSwS
i099iG5luVWByDfpj/Q7/RJU0r22t2Aa5brUjZE2/yFUZx7EmomK5dWMsRCayigW
5hFKbMRXNkJekqOSrGqfP9LgZesgCbl06BFOPLnG74Uue5Bnc8sPfn1HwzFpuRwK
Mrgiha3L4wj3Xvq4czcM1mVMDBQtdEH3fY2j0JlNZCxwP4DRBYq+fsg0xXZEqWbu
w61sW/xKTeAoNTSYqkc1trM1e140xed7Ifc/mle/w2qGrKO0YTrys11z6wDN3lmX
ETR1xVjUwbqZopZNk4iGiEU2t6/hjyL/LQI2KEjHMAO4fX+2FNvdDrS0Sl/Et7N7
1ywk9uKlqamOZZA2tWL9bPJy3/HV5KZHA/O2GHjypQjRVHl2vormBadiVVwYGmAq
Te/qqL3D
=ARMg
-----END PGP SIGNATURE-----

Timestamp of file with hash 10409394f1acc2ff628bcbe5435062c7affa09d444d74bc8b734e1c9f9ba9f87 -

@maflcko maflcko merged commit 091cc4b into bitcoin:master May 31, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 1, 2020
9a19c9a Always define the raii_event_tests test suite (Craig Andrews)

Pull request description:

  The test suite must always be defined (even when EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED is not defined) so that the test harness doesn't fail due to not being able to find the raii_event_tests test.

  This improves upon 95f97f4 actually fixing bitcoin#9493

ACKs for top commit:
  MarcoFalke:
    ACK 9a19c9a 🎹

Tree-SHA512: 3c42f17a9b5d56c8841f3aa9ac19da91c10aff210026266f31f7eb98a62528740d7c518c121452b68e8f801d6c80ecfb627d137ec6ed533289fa3beb08b4f176
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
9a19c9a Always define the raii_event_tests test suite (Craig Andrews)

Pull request description:

  The test suite must always be defined (even when EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED is not defined) so that the test harness doesn't fail due to not being able to find the raii_event_tests test.

  This improves upon 95f97f4 actually fixing bitcoin#9493

ACKs for top commit:
  MarcoFalke:
    ACK 9a19c9a 🎹

Tree-SHA512: 3c42f17a9b5d56c8841f3aa9ac19da91c10aff210026266f31f7eb98a62528740d7c518c121452b68e8f801d6c80ecfb627d137ec6ed533289fa3beb08b4f176
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
9a19c9a Always define the raii_event_tests test suite (Craig Andrews)

Pull request description:

  The test suite must always be defined (even when EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED is not defined) so that the test harness doesn't fail due to not being able to find the raii_event_tests test.

  This improves upon 95f97f4 actually fixing bitcoin#9493

ACKs for top commit:
  MarcoFalke:
    ACK 9a19c9a 🎹

Tree-SHA512: 3c42f17a9b5d56c8841f3aa9ac19da91c10aff210026266f31f7eb98a62528740d7c518c121452b68e8f801d6c80ecfb627d137ec6ed533289fa3beb08b4f176
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
9a19c9a Always define the raii_event_tests test suite (Craig Andrews)

Pull request description:

  The test suite must always be defined (even when EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED is not defined) so that the test harness doesn't fail due to not being able to find the raii_event_tests test.

  This improves upon 95f97f4 actually fixing bitcoin#9493

ACKs for top commit:
  MarcoFalke:
    ACK 9a19c9a 🎹

Tree-SHA512: 3c42f17a9b5d56c8841f3aa9ac19da91c10aff210026266f31f7eb98a62528740d7c518c121452b68e8f801d6c80ecfb627d137ec6ed533289fa3beb08b4f176
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
9a19c9a Always define the raii_event_tests test suite (Craig Andrews)

Pull request description:

  The test suite must always be defined (even when EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED is not defined) so that the test harness doesn't fail due to not being able to find the raii_event_tests test.

  This improves upon 95f97f4 actually fixing bitcoin#9493

ACKs for top commit:
  MarcoFalke:
    ACK 9a19c9a 🎹

Tree-SHA512: 3c42f17a9b5d56c8841f3aa9ac19da91c10aff210026266f31f7eb98a62528740d7c518c121452b68e8f801d6c80ecfb627d137ec6ed533289fa3beb08b4f176
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
9a19c9a Always define the raii_event_tests test suite (Craig Andrews)

Pull request description:

  The test suite must always be defined (even when EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED is not defined) so that the test harness doesn't fail due to not being able to find the raii_event_tests test.

  This improves upon 95f97f4 actually fixing bitcoin#9493

ACKs for top commit:
  MarcoFalke:
    ACK 9a19c9a 🎹

Tree-SHA512: 3c42f17a9b5d56c8841f3aa9ac19da91c10aff210026266f31f7eb98a62528740d7c518c121452b68e8f801d6c80ecfb627d137ec6ed533289fa3beb08b4f176
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 14, 2021
9a19c9a Always define the raii_event_tests test suite (Craig Andrews)

Pull request description:

  The test suite must always be defined (even when EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED is not defined) so that the test harness doesn't fail due to not being able to find the raii_event_tests test.

  This improves upon 95f97f4 actually fixing bitcoin#9493

ACKs for top commit:
  MarcoFalke:
    ACK 9a19c9a 🎹

Tree-SHA512: 3c42f17a9b5d56c8841f3aa9ac19da91c10aff210026266f31f7eb98a62528740d7c518c121452b68e8f801d6c80ecfb627d137ec6ed533289fa3beb08b4f176
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 15, 2021
9a19c9a Always define the raii_event_tests test suite (Craig Andrews)

Pull request description:

  The test suite must always be defined (even when EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED is not defined) so that the test harness doesn't fail due to not being able to find the raii_event_tests test.

  This improves upon 95f97f4 actually fixing bitcoin#9493

ACKs for top commit:
  MarcoFalke:
    ACK 9a19c9a 🎹

Tree-SHA512: 3c42f17a9b5d56c8841f3aa9ac19da91c10aff210026266f31f7eb98a62528740d7c518c121452b68e8f801d6c80ecfb627d137ec6ed533289fa3beb08b4f176
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Aug 25, 2021
Summary:
PR description:
> The test suite must always be defined (even when EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED is not defined) so that the test harness doesn't fail due to not being able to find the raii_event_tests test.
>
> This improves upon 95f97f4 actually fixing bitcoin/bitcoin#9493

Context from issue:
> [[bitcoin/bitcoin#9387 | core#9387]] added a new test that uses libevent's event_set_mem_functions which is sometimes not included with libevent. In particular, Gentoo only enables this when libevent is installed with the "debug" option.
> Currently, this causes the build to simply fail on tests

This is a backport of [[bitcoin/bitcoin#16564 | core#16564]]

Test Plan: `ninja check`

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D9930
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants