After patch 9d26b82, we don't provide recursive call protection anymore.
Therefore, to pass the test, we adjust the testcase by protecting on
caller and the testcase is to make sure the dtors is properly handled.
Details
- Reviewers
kib markj - Commits
- rGc25976f0a9a3: libc: Fix cxa_thread_atexit{,nothr} test.
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 71568 Build 68451: arc lint + arc unit
Event Timeline
No, I mean to keep this test, adjusted.
Create a global static var that is incremented on each again() call, and do not call __cxa_thread_atexit() if the counter greater than some value.
As an additional check, you might assert that the counter indeed counted to the specified value.
What about the nothr case? Since there is only one main thread. The dtos will be called after the ATF_TEST_CASE_BODY, which means we are unable to use assert since the main thread is destroyed.
I don't add the ATF_REQUIRE_EQ in nothr case. I think it at least check the dtor is handled properly.
I think that this is the right concern, and the right answer would be to significantly reorg the test. Since we are testing something that checks C runtime behavior outside the scope of normal execution (inside the main) for ATF, we need to create a helper program.
The test should spawn that program and check the effects of it, instead of trying to do everything inline.
Yes, re-organize the testcase is necessary. I also see something strange in the testcase like there is a 1 second sleep after thread::join(), which I don't think is necessary. But in the short term (at least for this week), I think we can fix the CI first.
For now, I suggest to #ifdef 0 the ADD_TEST(), then revert it when the updated test is written.
For the tests we plan to rewrite, I suggest using atf_tc_skip() with a reason to mark this test case is problematic and have a reminder in the test output.
BTW, is it possible to create a test case for commit 9d26b82826d9?
| lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc | ||
|---|---|---|
| 33 | AGAIN_CALL_LIMIT is a better name. | |
| 85–88 | ||
| 94 | Do we still need to skip this? | |
Yes, I think we can have some tests for this. But I think we should do it after re-org the tests. At least for now we can rely on the llvm testcase as I run it biweekly with latest CURRENT.
| lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc | ||
|---|---|---|
| 94 | Yes, we only have main thread so we are unable to use any ATF_CHECK | |
| lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc | ||
|---|---|---|
| 94 | Well, we do not really need ATF_CHECK. Just let the test run. If it hangs forever, or crashes, kyua will still report a problem. It would be nice to have ATF_CHECK verify again_count, but even without it this test is better than nothing. | |
| lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc | ||
|---|---|---|
| 94 | I just don't want to leave this test in this state. Either it should be useful, or it should be deleted entirely. | |
| lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc | ||
|---|---|---|
| 94 | The promise was that it would be fixed. IMO it is better to leave it as is for some time, because I prefer to see the diff against the current baseline, both in review and in the commit history, instead of the revert and then commit consisting of the additions (we loose useful change history). | |
| lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc | ||
|---|---|---|
| 94 | I am not proposing to revert anything, I just do not like the skip() here. But ok, we can fix it separately, it would be good to fix the tests in the meantime. | |