
Hi, I successfully built the boost libraries for the iPhone and for the iPhone Simulator. Now I have done some work on cross plattform C++ code and I am testing this code with Boost Unit Tests. It's running fine on Mac and Windows. It's also running fine on the iPhone Simulator. But unfortunately it's not working on the iPhone Device. It's not even getting into my test code, it just "hangs" somewhere before when collecting the test cases, if I can see this right in the debugger. I experienced that if I just have one BOOST_AUTO_TEST_CASE it also works fine on the iPhone Device. The test case executes, it succeeds and the app quits. But as soon as I have two or more BOOST_AUTO_TEST_CASEs, none of these test cases gets executed and the iPhone just hangs forever and loops around in some boost unit test initialization code using "spinlocks" and "yields" ... Is this a known issue? Anyone successfully using Boost Unit Tests on iPhone? Any ideas what I could try? Thanks, Mani -- http://mani.de - friendly software iVolume - listen to music freehand LittleSecrets - the encrypted notepad Sahara - sand in your pocket Watchdog - baffle the curious

I had some problem with static allocation/deallocation with the iphone.I don't know much detail but basically, a boost singleton (serialization lib) was destroy while boost was still using it. Might help, might not!

I successfully built the boost libraries for the iPhone and for the iPhone Simulator. [...]
Do you mind sharing how you got Boost to build?
Yes, sure. I just wrote a blog post describing how I created Boost for iPhone: http://www.mani.de/backstage/?p=159 BTW, the original problem of multple Unit Tests not running on the iPhone still persists also with Boost 1.39.0. Any ideas are welcome. Regards, Mani

Manfred Schwind
Hi,
I successfully built the boost libraries for the iPhone and for the iPhone Simulator. Now I have done some work on cross plattform C++ code and I am testing this code with Boost Unit Tests. It's running fine on Mac and Windows. It's also running fine on the iPhone Simulator. But unfortunately it's not working on the iPhone Device. It's not even getting into my test code, it just "hangs" somewhere before when collecting the test cases, if I can see this right in the debugger.
Would you care to post stack trace?
I experienced that if I just have one BOOST_AUTO_TEST_CASE it also works fine on the iPhone Device. The test case executes, it succeeds and the app quits. But as soon as I have two or more BOOST_AUTO_TEST_CASEs, none of these test cases gets executed and the iPhone just hangs forever and loops around in some boost unit test initialization code using "spinlocks" and "yields" ...
What if you register test cases manually? Is there anything special about static variables construction in this configuration?
Is this a known issue? Anyone successfully using Boost Unit Tests on iPhone? Any ideas what I could try?
I definitely never tested in this setup ;o) Asides from notes above: what variant of UTF are you using? can you try another one?

I experienced that if I just have one BOOST_AUTO_TEST_CASE it also works fine on the iPhone Device. The test case executes, it succeeds and the app quits. But as soon as I have two or more BOOST_AUTO_TEST_CASEs, none of these test cases gets executed and the iPhone just hangs forever and loops around in some boost unit test initialization code using "spinlocks" and "yields" ...
What if you register test cases manually? Is there anything special about static variables construction in this configuration?
I've done various tests now. I tried the alternate init variant and I tried registering test cases manually etc. It's always the same problem. I am always using the static library variant. After reducing test case for test case, I found out that I was just wrong - it has nothing to do with the number of test cases! I was finally able to narrow it down to this simple thing: BOOST_CHECK works fine, but as soon as I use BOOST_CHECK_EQUAL, the code "hangs" at startup and even never enters the test case code. BOOST_AUTO_TEST_CASE( my_test ) { printf("Started!\n"); BOOST_CHECK(7 == 7); // works ("Started!" is printed, test case succeeds) // BOOST_CHECK_EQUAL(7, 7); // causes startup hang ("Started!" is not even printed) } This is really strange.
Would you care to post stack trace?
#0 0x31467bac in swtch_pri #1 0x3145c92a in sched_yield #2 0x00065f50 in yield [inlined] at yield_k.hpp:110 #3 0x00065f50 in boost::detail::spinlock::lock at spinlock_gcc_arm.hpp: 45 #4 0x00065f50 in scoped_lock [inlined] at spinlock_pool.hpp:61 #5 0x00065f50 in atomic_increment [inlined] at spinlock_pool.hpp:41 #6 0x00065f50 in boost::detail::sp_counted_base::add_ref_copy at sp_counted_base_spin.hpp:90 #7 0x00065f50 in shared_count [inlined] at shared_count.hpp:227 #8 0x00065f50 in shared_ptr [inlined] at yield_k.hpp:165 #9 0x00065f50 in callback0 [inlined] at shared_ptr.hpp:101 #10 0x00065f50 in boost::unit_test::test_case::test_case #11 0x00003570 in boost::unit_test::make_test_case at unit_test_suite_impl.hpp:250 Regards, Mani

Manfred Schwind
BOOST_CHECK works fine, but as soon as I use BOOST_CHECK_EQUAL, the code "hangs" at startup and even never enters the test case code.
This makes no sense whatsoever. Can you dig further? These only different at call site. Can you see what particular expression causes this? Gennadiy
participants (3)
-
Gennadiy Rozental
-
gtsml owevwr
-
Manfred Schwind