Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost Unit Tests on iPhone
From: Manfred Schwind (lists_at_[hidden])
Date: 2009-05-13 12:03:55


>> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net