Home | History | Annotate | Download | only in libpthread
History log of /src/tests/lib/libpthread/t_mutex.c
RevisionDateAuthorComments
 1.20  07-May-2022  rin Bump timeout for slow machines.
 1.19  01-Dec-2017  kre Since there has been no objection (or even comment) in response
to my message on tech-userlevel ...

Subject: tests/lib/libpthread/t_mutex:mutex6
Date: Thu, 23 Nov 2017 17:34:54 +0700
Message-ID: <28385.1511433294@andromeda.noi.kre.to>

which can be found at:
http://mail-index.netbsd.org/tech-userlevel/2017/11/23/msg011010.html

which analysed the mutex6 test case of this test, and concluded
that it was useless, nonsense, and broken (the whole test is just a
race - not even really using or testing mutexes), let it be henceforth
forever gone.
 1.18  01-Apr-2017  martin branches: 1.18.4;
Make the mutex6 test (which fails every know and then, but too rarely
to actually debug it) print some debug info when failing.
 1.17  23-Mar-2017  martin Avoid using an uninitialized mutex.
 1.16  05-Mar-2017  chs reenable mutex2 and mutex3 on powerpc now that PR 44387 is fixed.
 1.15  16-Jan-2017  christos PR/51888: Ngie Cooper: more error checking, missing includes
 1.14  31-Oct-2016  christos branches: 1.14.2;
more tests from kamil
 1.13  31-Oct-2016  christos fix typos
 1.12  31-Oct-2016  christos Merge and fix the timed mutex tests to use absolute time.
NB: the new tests are broken?
 1.11  30-Oct-2016  kamil Add new test t_timedmutex

This test is a clone on t_mutex with additional two tests for timed-mutex
specific block.

All simple-mutex (not with the timed property according to the C11 wording)
specific tests are covered by pthread_mutex_timedlock(3) with parameter
ts_lengthy of sufficiently large tv_sec value (right now UINT16_MAX). If,
a test will hang, it won't wait UINT16_MAX seconds, but will be terminated
within the default timeout for ATF tests (right now 300 [sec] in my
NetBSD/amd64 setup).

This test was inspired by a classic selflock test failure of
pthread_mutex_timedlock(3) of the following form:

#include <assert.h>
#include <errno.h>
#include <pthread.h>
#include <stdio.h>
#include <time.h>

int main(int argc, char **argv)
{
pthread_mutex_t mtx;
struct timespec ts;

ts.tv_sec = 0;
ts.tv_nsec = 1000;
printf("ts{.tv_sec = %d, .tv_nsec=%ld}\n", ts.tv_sec, ts.tv_nsec);
fflush(stdout);

printf("mtx_init\n");
assert(pthread_mutex_init(&mtx, NULL) == 0);

printf("mtx_lock\n");
assert(pthread_mutex_lock(&mtx) == 0);

printf("mtx_timedlock\n");
assert(pthread_mutex_timedlock(&mtx, &ts) == ETIMEDOUT);

printf("mtx_unlock\n");
assert(pthread_mutex_unlock(&mtx) == 0);

printf("mtx_destroy\n");
assert(pthread_mutex_destroy(&mtx) == 0);

return 0;
}

Current NetBSD implementation wrongly hangs on this test.

The issue was detected during development of the C11 portable threads.

My local tests in chroot presents that the are further issues:

t_timedmutex (21/25): 10 test cases
mutex1: [0.001142s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:75: *param != 20
mutex2: [0.261499s] Passed.
mutex3: [0.261496s] Passed.
mutex4: [0.001204s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:265: pthread_mutex_timedlock(&mutex, &ts_lengthy): Connection timed out
mutex5: [0.001235s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:337: pthread_mutex_timedlock(&mutex5, &ts_lengthy): Connection timed out
mutex6: [21.218497s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:512: start != 1
mutexattr1: [0.001328s] Passed.
mutexattr2: [0.001175s] Passed.
timedmutex1: [301.119397s] Failed: Test case timed out after 300 seconds
timedmutex2: [301.123081s] Failed: Test case timed out after 300 seconds
[623.990659s]

I'm also receiveing the same failure in the mutex6 test in t_mutex, so
there might be a false positives due to local chroot(8) issues.

Commit approved by <christos>.
 1.10  31-Jul-2016  christos we require root for sched_fifo, and more verbose messages.
 1.9  06-Jul-2016  christos branches: 1.9.2;
fix uninitialized var.
 1.8  03-Jul-2016  christos GSoC 2016 Charles Cui: Implement thread priority protection based on work
by Andy Doran. Also document the get/set pshared thread calls as not
implemented, and add a skeleton implementation that is disabled.
XXX: document _sched_protect(2).
 1.7  04-Nov-2014  justin PR misc/49356 remove unnecessary references to atf-c/config.h

The function included via this header is not used and is removed in
later versions of atf, so let us avoid it.
 1.6  09-Feb-2014  jmmv Use compiler builtins instead of atf_arch and atf_machine.

The atf_arch and atf_machine configuration variables were removed from
atf-0.19 without me realizing that some tests were querying them directly.

Instead of reintroducing those variables, just rely on compiler builtins
as many other tests already do.

Should fix PR bin/48582.
 1.5  04-Apr-2011  martin branches: 1.5.4; 1.5.10;
Do only set a (lower than default) timeout value if we are on powerpc and
expect to run into a real deadrun ofter.
The (too short) timeout otherwise makes slower archs fail.
 1.4  21-Feb-2011  riz mutex2/mutex3 are expected to fail on powerpc because of
PR port-powerpc/44387.

XXX the ugly sleep at the end is because ATF will mark an un-triggered
race condition (ie, the test passes unexpectedly) as a test failure otherwise.
 1.3  20-Feb-2011  jmmv The mutex3 test is supposed to use a static initializer so that it differs
to the mutex2 test. This detail was lost during the atfification of these
tests.

Spotted by pooka@ and riz@.
 1.2  16-Jul-2010  njoly branches: 1.2.2;
Add missing pthread_mutex_init call in mutex3 testcase.
 1.1  16-Jul-2010  jmmv Convert the libpthread tests to atf.
Initial work from the GSoC 2008 project by Lukasz Strzygowski.

I think that this, together with the previous conversion of librt, obsoletes
the tests in the semaphore/ directory. Will investigate later.
 1.2.2.1  05-Mar-2011  bouyer Sync with HEAD
 1.5.10.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.4.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9.2.5  26-Apr-2017  pgoyette Sync with HEAD
 1.9.2.4  20-Mar-2017  pgoyette Sync with HEAD
 1.9.2.3  04-Nov-2016  pgoyette Sync with HEAD
 1.9.2.2  06-Aug-2016  pgoyette Sync with HEAD
 1.9.2.1  01-Aug-2016  pgoyette Import test fix from HEAD.

With this, a complete test run on HEAD vs the localcount branch yields
identical lists of "Failed test cases" and "Expected failures"
 1.14.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.18.4.1  26-Feb-2018  snj Pull up following revision(s) (requested by maya in ticket #585):
tests/lib/libpthread/t_mutex.c: 1.19
Since there has been no objection (or even comment) in response
to my message on tech-userlevel ...
Subject: tests/lib/libpthread/t_mutex:mutex6
Date: Thu, 23 Nov 2017 17:34:54 +0700
Message-ID: <28385.1511433294%andromeda.noi.kre.to@localhost>
which can be found at:
http://mail-index.netbsd.org/tech-userlevel/2017/11/23/msg011010.html
which analysed the mutex6 test case of this test, and concluded
that it was useless, nonsense, and broken (the whole test is just a
race - not even really using or testing mutexes), let it be henceforth
forever gone.

RSS XML Feed