The NetBSD Project

CVS log for src/tests/lib/libpthread/t_condwait.c

[BACK] Up to [cvs.NetBSD.org] / src / tests / lib / libpthread

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.10 / (download) - annotate - [select for diffs], Sun Dec 11 10:02:53 2022 UTC (8 weeks, 1 day ago) by kre
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10, HEAD
Changes since 1.9: +9 -21 lines
Diff to previous 1.9 (colored)


This test makes (made) a false assumption about the way that
process scheduling works.   That a process (or in this case,
a thread) is no longer blocked at time T does not mean that it
will resume execution at time T.   The OS is free to devote
resources to other processes/threads instead - all we should
normally be able to expect is that if it is not unblocked before
time T, that it will not start running before then.

In general though, the pthread_cond_*wait() functions don't guarantee
even that - but for this test, the possibility of something else
randomly signalling the condvar isn't believable, so don't worry about
that possibility (but do fail without calling strerror(0) on the off
chance it does happen).

Once we cease testing that the process resumed running before some
particular time, we can stop dealing with qemu timekeeping issues,
it might (seem to) take qemu twice as long as was requested before
the thread resumes, but that's OK - the same thing could happen on
a loaded system for other reasons.

Beyond that, the test also has (had) a race condition.   When using
CLOCK_REALTIME though that clock needed to have advanced to T before
the ETIMEDOUT should happen, there is no guarantee that it will stay >T
(CLOCK_REALTIME is allowed to be reset backwards).   So, only test
that the current time (after ETIMEDOUT) >= T when we're using
CLOCK_MONOTONIC - for CLOCK_REALTIME the time might have stepped
back between when the ETIMEDOUT happened and when the thread
obtains the current clock reading.  For that case, all we can test
is that the ETIMEDOUT actually happens.

With much of what was there now gone, the code can be simplified,
we no longer need to do timespec arithmetic, just one comparison
(simpler to test that Tend >= Tstart+period than Tend-Tstart > period
as we need Tstart+period for the abstime value for the timeout anyway).

Note that this still tests for the issue reported in PR lib/47703
which is where the test came from in the first place.

ps: we seem to be missing pthread_cond_clockwait() which is the same
as pthread_cond_timedwait() except that the clock to use is passed
as a parameter, rather than as an attribute of the condition variable.

Revision 1.9 / (download) - annotate - [select for diffs], Sat Apr 16 18:15:22 2022 UTC (9 months, 3 weeks ago) by andvar
Branch: MAIN
Changes since 1.8: +3 -3 lines
Diff to previous 1.8 (colored)

fix various typos in comments and log messages.

Revision 1.5.12.1 / (download) - annotate - [select for diffs], Mon Apr 13 08:05:29 2020 UTC (2 years, 9 months ago) by martin
Branch: phil-wifi
Changes since 1.5: +18 -9 lines
Diff to previous 1.5 (colored) next main 1.6 (colored)

Mostly merge changes from HEAD upto 20200411

Revision 1.8 / (download) - annotate - [select for diffs], Sun Aug 11 11:42:23 2019 UTC (3 years, 5 months ago) by martin
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, is-mlppp-base, is-mlppp, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.7: +6 -6 lines
Diff to previous 1.7 (colored)

Re-enable the QEMU specific timing limits, but only an increased upper
limit for now - let's see if that works on the test-bed.

Revision 1.7 / (download) - annotate - [select for diffs], Sat Aug 10 07:36:15 2019 UTC (3 years, 5 months ago) by martin
Branch: MAIN
Changes since 1.6: +18 -9 lines
Diff to previous 1.6 (colored)

PR lib/54440: adapt the FreeBSD change to this test and calculate time
differences more exact, allowing between 0 and 1 s delay between the
expected wakeup and the actual event happening.
Also convert the QEMU special case code to the same scheme, but for now
disable it (with XXX mark) and see if the proper timing limits fix that
case too.
If not, we will re-enable the QEMU special case.

Revision 1.6 / (download) - annotate - [select for diffs], Tue Jul 9 16:24:01 2019 UTC (3 years, 7 months ago) by maya
Branch: MAIN
CVS Tags: netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

return return atf_no_error() instead of 0 for consistency.

suggested by moritzbuhl in https://github.com/NetBSD/src/pull/11/

Revision 1.4.18.1 / (download) - annotate - [select for diffs], Fri Apr 21 16:54:11 2017 UTC (5 years, 9 months ago) by bouyer
Branch: bouyer-socketcan
Changes since 1.4: +7 -4 lines
Diff to previous 1.4 (colored) next main 1.5 (colored)

Sync with HEAD

Revision 1.4.14.1 / (download) - annotate - [select for diffs], Mon Mar 20 06:57:59 2017 UTC (5 years, 10 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.4: +7 -4 lines
Diff to previous 1.4 (colored) next main 1.5 (colored)

Sync with HEAD

Revision 1.5 / (download) - annotate - [select for diffs], Mon Jan 16 16:29:19 2017 UTC (6 years ago) by christos
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, phil-wifi-20190609, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, bouyer-socketcan-base1
Branch point for: phil-wifi
Changes since 1.4: +7 -4 lines
Diff to previous 1.4 (colored)

PR/51884: Ngie Cooper: Include and message fixes

Revision 1.4.8.2 / (download) - annotate - [select for diffs], Thu May 22 11:42:22 2014 UTC (8 years, 8 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.4.8.1: +142 -0 lines
Diff to previous 1.4.8.1 (colored) to branchpoint 1.4 (colored) next main 1.5 (colored)

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

Revision 1.4.2.2 / (download) - annotate - [select for diffs], Sun Jun 23 06:28:57 2013 UTC (9 years, 7 months ago) by tls
Branch: tls-maxphys
Changes since 1.4.2.1: +142 -0 lines
Diff to previous 1.4.2.1 (colored) to branchpoint 1.4 (colored) next main 1.5 (colored)

resync from head

Revision 1.4.8.1, Fri Apr 12 17:18:11 2013 UTC (9 years, 9 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.4: +0 -142 lines
FILE REMOVED

file t_condwait.c was added on branch yamt-pagecache on 2014-05-22 11:42:22 +0000

Revision 1.4.2.1, Fri Apr 12 17:18:11 2013 UTC (9 years, 9 months ago) by tls
Branch: tls-maxphys
Changes since 1.4: +0 -142 lines
FILE REMOVED

file t_condwait.c was added on branch tls-maxphys on 2013-06-23 06:28:57 +0000

Revision 1.4 / (download) - annotate - [select for diffs], Fri Apr 12 17:18:11 2013 UTC (9 years, 9 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, pgoyette-localcount-base, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, localcount-20160914, bouyer-socketcan-base
Branch point for: yamt-pagecache, tls-maxphys, pgoyette-localcount, bouyer-socketcan
Changes since 1.3: +12 -7 lines
Diff to previous 1.3 (colored)

loosen the test only for qemu.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Apr 12 14:21:52 2013 UTC (9 years, 9 months ago) by gson
Branch: MAIN
Changes since 1.2: +7 -3 lines
Diff to previous 1.2 (colored)

Make cond_wait_mono and cond_wait_real tests accept a wait time in the
range of 90% to 250% of nominal, to allow the test to pass under qemu
which has a known issue where timing can be off by a factor of two.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Mar 29 02:32:38 2013 UTC (9 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.1: +8 -7 lines
Diff to previous 1.1 (colored)

fix printf formats

Revision 1.1 / (download) - annotate - [select for diffs], Thu Mar 28 18:50:01 2013 UTC (9 years, 10 months ago) by christos
Branch: MAIN

Add pthread_cond_timedwait(3) test from PR/47703

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>