[test] assert fails - all tests passing

This doesn't make a lot of sense to me and seems like new behavior in .35: Running 1 test case... commands: commands.cpp:5: void test_construct(): Assertion `false' failed. *** No errors detected PASS: commands ================== All 1 tests passed ================== Previously, the use of BOOST_ASSERT(xxx) was the method of testing. Is that different now? Previously, I didn't return anything from the function, I just assert. Is that different now? Boost.Test isn't listed in the updated libraries for .35 but this is definitely not the behavior I was getting in .34 Code: #include <boost/test/unit_test.hpp> void test_construct() { BOOST_ASSERT(false); } using namespace boost::unit_test; test_suite * init_unit_test_suite(int,char**) { test_suite * test = BOOST_TEST_SUITE("wumpus commands"); test->add(BOOST_TEST_CASE(&test_construct)); return test; }

Noah Roberts wrote:
This doesn't make a lot of sense to me and seems like new behavior in .35:
Running 1 test case... commands: commands.cpp:5: void test_construct(): Assertion `false' failed.
*** No errors detected PASS: commands ================== All 1 tests passed ==================
Previously, the use of BOOST_ASSERT(xxx) was the method of testing. Is that different now?
Hmm..maybe I'm mistaken and have been using BOOST_CHECK. I switched to that and now I get a linker error for: undefined reference to `boost::test_tools::tt_detail::check_impl I'm liking to the unit-test-framework-s library. Is there another req? I tried to link to the only other test library I could find and that was obviously a conflict. Thanks.

Noah Roberts wrote:
Noah Roberts wrote:
This doesn't make a lot of sense to me and seems like new behavior in .35:
Running 1 test case... commands: commands.cpp:5: void test_construct(): Assertion `false' failed.
*** No errors detected PASS: commands ================== All 1 tests passed ==================
Previously, the use of BOOST_ASSERT(xxx) was the method of testing. Is that different now?
Hmm..maybe I'm mistaken and have been using BOOST_CHECK. I switched to that and now I get a linker error for:
undefined reference to `boost::test_tools::tt_detail::check_impl
I'm liking to the unit-test-framework-s library. Is there another req? I tried to link to the only other test library I could find and that was obviously a conflict.
Check your link line. The only way to get this kind of error is to either link with wrong library or no library at all. Gennadiy

Noah Roberts <roberts.noah <at> gmail.com> writes:
Check your link line. The only way to get this kind of error is to either link with wrong library or no library at all.
Sorry, I must be imagining things again. It must be building and I just can't see past my own delusion to see that.
So, it works now? Gennadiy

Gennadiy Rozental wrote:
Noah Roberts <roberts.noah <at> gmail.com> writes:
Check your link line. The only way to get this kind of error is to either link with wrong library or no library at all. Sorry, I must be imagining things again. It must be building and I just can't see past my own delusion to see that.
So, it works now?
Well, since it can't possibly not...it must. I just can't see it. From my OP: "I'm liking to the unit-test-framework-s library."

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 16 May 2008 13:46 pm, Noah Roberts wrote:
Gennadiy Rozental wrote:
Noah Roberts <roberts.noah <at> gmail.com> writes:
Check your link line. The only way to get this kind of error is to either link with wrong library or no library at all.
Sorry, I must be imagining things again. It must be building and I just can't see past my own delusion to see that.
So, it works now?
Well, since it can't possibly not...it must. I just can't see it.
From my OP: "I'm liking to the unit-test-framework-s library."
I'd avoid relying on sarcasm to communicate via email. We can't hear your tone of voice or see your eyes rolling, so it's pretty difficult to pick up on. - -- Frank -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFILdCr5vihyNWuA4URAnGpAJ9GlnSylxAZ7Go+Xpqs3qMbQ6kr7gCfX60J 9Byr/aQGtZOdpWln5erigvw= =LLUo -----END PGP SIGNATURE-----

Noah Roberts <roberts.noah <at> gmail.com> writes:
Gennadiy Rozental wrote:
Noah Roberts <roberts.noah <at> gmail.com> writes:
Check your link line. The only way to get this kind of error is to either link with wrong library or no library at all. Sorry, I must be imagining things again. It must be building and I just can't see past my own delusion to see that.
So, it works now?
Well, since it can't possibly not...it must. I just can't see it.
From my OP: "I'm liking to the unit-test-framework-s library."
Your attempts to being sarcastic are in no way productive. I can assure you that I personally have no problem linking your example. An error like
undefined reference to `boost::test_tools::tt_detail::check_impl
means the reference is undefined, which means no one defined it. Unit Test framework does define it (it's implemented in test_tools.ipp). So either you are not linking to it (check again your makefile), or you are linking to wrong library (for example built for different version of boost, or with different compiler) HTH, Gennadiy

Gennadiy Rozental wrote:
undefined reference to `boost::test_tools::tt_detail::check_impl
means the reference is undefined, which means no one defined it. Unit Test framework does define it (it's implemented in test_tools.ipp). So either you are not linking to it (check again your makefile), or you are linking to wrong library (for example built for different version of boost, or with different compiler)
Well, again, I will inform you that I am both linking to the unit-test-framework-s library AND getting the undefined reference error (and yes, I know what an undefined reference is). Furthermore, until using BOOST_CHECK instead of BOOST_ASSERT, the unit test ran just fine...and this would not be possible without a main() or a link to that library! I mean, all you need to do is follow the conversation to see that. You can claim it is not happening all you want, that doesn't change the facts of what I am experiencing. Your insistence that I'm not seeing the problem I am seeing is likewise non-productive. Just say you don't know what the hell is going on, don't tell me I'm imagining things! You're assuming I'm an idiot, requiring me to constantly reiterate and justify what I see, and I don't see how that helps anyone.

Noah, Your language and tone are abusive. Gennadiy is not saying that you are not seeing a problem: he is telling you what is the only possible reason why you are seeing this problem (and he is right). There are two things you can try: 1) tell us what platform and compiler you use, print out the linker command issued by your build system and let us see it, and ask nicely for help. 2) don't link to the library, instead #include <boost/test/included/unit_test.hpp> at the top of your source file. pj On Fri, May 16, 2008 at 6:23 PM, Noah Roberts <roberts.noah@gmail.com> wrote:
Gennadiy Rozental wrote:
undefined reference to `boost::test_tools::tt_detail::check_impl
means the reference is undefined, which means no one defined it. Unit Test framework does define it (it's implemented in test_tools.ipp). So either you are not linking to it (check again your makefile), or you are linking to wrong library (for example built for different version of boost, or with different compiler)
Well, again, I will inform you that I am both linking to the unit-test-framework-s library AND getting the undefined reference error (and yes, I know what an undefined reference is).
Furthermore, until using BOOST_CHECK instead of BOOST_ASSERT, the unit test ran just fine...and this would not be possible without a main() or a link to that library! I mean, all you need to do is follow the conversation to see that.
You can claim it is not happening all you want, that doesn't change the facts of what I am experiencing. Your insistence that I'm not seeing the problem I am seeing is likewise non-productive. Just say you don't know what the hell is going on, don't tell me I'm imagining things!
You're assuming I'm an idiot, requiring me to constantly reiterate and justify what I see, and I don't see how that helps anyone.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Pierre-Jules Tremblay wrote:
Noah,
Your language and tone are abusive. Gennadiy is not saying that you are not seeing a problem: he is telling you what is the only possible reason why you are seeing this problem (and he is right).
Obviously not, but whatever.
There are two things you can try:
1) tell us what platform and compiler you use, print out the linker command issued by your build system and let us see it, and ask nicely for help. 2) don't link to the library, instead #include <boost/test/included/unit_test.hpp> at the top of your source file.
You do realize that only works in some environments?

Noah Roberts <roberts.noah <at> gmail.com> writes:
Pierre-Jules Tremblay wrote:
2) don't link to the library, instead #include <boost/test/included/unit_test.hpp> at the top of your source file.
You do realize that only works in some environments?
I am not aware about configuration that fail to compile this, but I am sure you will enlighten me, Gennadiy

Pierre-Jules Tremblay wrote:
Noah,
Your language and tone are abusive. Gennadiy is not saying that you are not seeing a problem: he is telling you what is the only possible reason why you are seeing this problem (and he is right).
There are two things you can try:
1) tell us what platform and compiler you use, print out the linker command issued by your build system and let us see it, and ask nicely for help.
g++ -I../include -g -O2 -lboost_unit_test_framework-s -o commands commands.o command.o commands.o: In function `test_construct()': /home/nroberts/projects/ai/wumpus2/tests/commands.cpp:11: undefined reference to `boost::test_tools::tt_detail::check_impl(boost::test_tools::predicate_result const&, boost::basic_wrap_stringstream<char>&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)' #include <boost/test/unit_test.hpp> /* * Upgrade of boost changed something. I can't get it to link correctly. * Going to have to forego the standard unit tests until I can get help * from the boost list. */ void test_construct() { BOOST_CHECK(false); } using namespace boost::unit_test; test_suite * init_unit_test_suite(int,char**) { test_suite * test = BOOST_TEST_SUITE("wumpus commands"); test->add(BOOST_TEST_CASE(&test_construct)); return test; } Change BOOST_CHECK to BOOST_ASSERT and I get this output: g++ -I../include -g -O2 -lboost_unit_test_framework-s -o commands commands.o command.o make[2]: Leaving directory `/home/nroberts/projects/ai/wumpus2/tests' make check-TESTS make[2]: Entering directory `/home/nroberts/projects/ai/wumpus2/tests' Running 1 test case... commands: commands.cpp:11: void test_construct(): Assertion `false' failed. *** No errors detected PASS: commands ================== All 1 tests passed ================== I do hope that ends the debate on whether I am linking to the unit test framework library. This is the library I've used in past versions of boost (minus the -s). I've simply asked if there is a different library I need to link to since this one quite obviously does NOT have the definition I need. Platform is Gentoo Linux 64, g++ 4.1.1. If someone needs more information that will help figure out what the problem is instead of saying it doesn't exist, I will be *more* than happy to provide it. *-s is being used because the library I used to link to, without the -s, complains that main is undefined and fails to link. "-s" means static apparently and it is, indeed, a static library on my system. Here is a listing in case you don't believe me: /usr/lib/libboost_unit_test_framework-mt-s.a /usr/lib/libboost_unit_test_framework-mt.so /usr/lib/libboost_unit_test_framework-s.a /usr/lib/libboost_unit_test_framework.so Perhaps later I can look into the build process that was used to build boost. I did use portage. If, indeed, that symbol is supposed to be found in this library then something went wrong somewhere either in portage or in the jam system. I saw nothing off hand in the emerge script that would do anything weird but perhaps I missed something. BTW, if I don't tell the linker to link to this library specifically I do get the expected output of: g++ -I../include -g -O2 -o commands commands.o command.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../lib64/crt1.o: In function `_start': init.c:(.text+0x20): undefined reference to `main' commands.o: In function `init_unit_test_suite(int, char**)': /home/nroberts/projects/ai/wumpus2/tests/commands.cpp:18: undefined reference to `boost::unit_test::test_suite::test_suite(boost::unit_test::basic_cstring<char const>)' commands.o: In function `init_unit_test_suite(int, char**)': /usr/include/boost/test/unit_test_suite_impl.hpp:247: undefined reference to `boost::unit_test::ut_detail::normalize_test_case_name(boost::unit_test::basic_cstring<char const>)' /usr/include/boost/test/unit_test_suite_impl.hpp:247: undefined reference to `boost::unit_test::test_case::test_case(boost::unit_test::basic_cstring<char const>, boost::unit_test::callback0<boost::unit_test::ut_detail::unused> const&)' commands.o: In function `init_unit_test_suite(int, char**)': /home/nroberts/projects/ai/wumpus2/tests/commands.cpp:19: undefined reference to `boost::unit_test::test_suite::add(boost::unit_test::test_unit*, unsigned long, unsigned int)' commands.o: In function `unit_test_log_t': /usr/include/boost/test/unit_test_log.hpp:126: undefined reference to `vtable for boost::unit_test::unit_test_log_t' commands.o: In function `test_construct()': /home/nroberts/projects/ai/wumpus2/tests/commands.cpp:11: undefined reference to `boost::unit_test::unit_test_log_t::set_checkpoint(boost::unit_test::basic_cstring<char const>, unsigned long, boost::unit_test::basic_cstring<char const>)' /home/nroberts/projects/ai/wumpus2/tests/commands.cpp:11: undefined reference to `boost::test_tools::tt_detail::check_impl(boost::test_tools::predicate_result const&, boost::basic_wrap_stringstream<char>&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)' commands.o: In function `unit_test_log_t': /usr/include/boost/test/unit_test_log.hpp:126: undefined reference to `vtable for boost::unit_test::unit_test_log_t' collect2: ld returned 1 exit status

Noah Roberts wrote:
Pierre-Jules Tremblay wrote:
Noah,
Your language and tone are abusive. Gennadiy is not saying that you are not seeing a problem: he is telling you what is the only possible reason why you are seeing this problem (and he is right).
There are two things you can try:
1) tell us what platform and compiler you use, print out the linker command issued by your build system and let us see it, and ask nicely for help.
g++ -I../include -g -O2 -lboost_unit_test_framework-s -o commands commands.o command.o commands.o: In function `test_construct()': /home/nroberts/projects/ai/wumpus2/tests/commands.cpp:11: undefined reference to `boost::test_tools::tt_detail::check_impl(boost::test_tools::predicate_result const&, boost::basic_wrap_stringstream<char>&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)'
I've found the error. It has to do with ordering of command line arguments. Don't know why it only complains about that function and works otherwise but whatever. Hopefully I can find a different way to inform automake of my need to link.

Hi Noah ! On Thursday 15 May 2008, Noah Roberts wrote:
This doesn't make a lot of sense to me and seems like new behavior in .35:
Running 1 test case... commands: commands.cpp:5: void test_construct(): Assertion `false' failed.
*** No errors detected PASS: commands ================== All 1 tests passed ==================
Previously, the use of BOOST_ASSERT(xxx) was the method of testing. Is that different now?
Previously, I didn't return anything from the function, I just assert. Is that different now?
This bug was fixed in trunk in r45160. See http://lists.boost.org/Archives/boost/2008/04/136805.php for the complete thread.
Boost.Test isn't listed in the updated libraries for .35 but this is definitely not the behavior I was getting in .34
Yes, this was a regression :-(( Yours, Jürgen -- * Dipl.-Math. Jürgen Hunold ! Ingenieurgesellschaft für * voice: ++49 511 262926 57 ! Verkehrs- und Eisenbahnwesen mbH * fax : ++49 511 262926 99 ! Lister Straße 15 * juergen.hunold@ivembh.de ! www.ivembh.de * * Geschäftsführer: ! Sitz des Unternehmens: Hannover * Prof. Dr.-Ing. Thomas Siefer ! Amtsgericht Hannover, HRB 56965 * PD Dr.-Ing. Alfons Radtke !

Noah Roberts wrote:
This doesn't make a lot of sense to me and seems like new behavior in .35:
Running 1 test case... commands: commands.cpp:5: void test_construct(): Assertion `false' failed.
*** No errors detected PASS: commands ================== All 1 tests passed ==================
Yeah. This was fixed recently.
Previously, the use of BOOST_ASSERT(xxx) was the method of testing. Is that different now?
Why? You are better of using BOOST_CHECK_... kind of tools.
Previously, I didn't return anything from the function, I just assert. Is that different now?
You can use assert
Boost.Test isn't listed in the updated libraries for .35 but this is definitely not the behavior I was getting in .34
There was quite some number of changes. I just did not have a chance to put them into release notes. Gennadiy
participants (5)
-
Frank Mori Hess
-
Gennadiy Rozental
-
Juergen Hunold
-
Noah Roberts
-
Pierre-Jules Tremblay