Commit 364dcc5
committed
t/README: document writing concurrency-safe helpers
The two preceding fixes addressed the same underlying problem: a test
helper assuming it has exclusive access to a file when the web server
can run it for several requests at once. The atomic idioms that avoid
this are not specific to CGI or to HTTP, so document them generally,
alongside the other guidance for writing tests, and leave a pointer from
the lib-httpd helper list rather than a local comment. The note covers
the anti-pattern (a "test -f" then a separate act) and the two safe
operations (mkdir to elect a winner, rename to consume a one-shot
marker), citing Git's own lockfile.c and make_symlink() as precedent.
Signed-off-by: Michael Montalbo <mmontalbo@gmail.com>1 parent 7b8759a commit 364dcc5
2 files changed
Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
854 | 854 | | |
855 | 855 | | |
856 | 856 | | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
857 | 889 | | |
858 | 890 | | |
859 | 891 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
162 | 165 | | |
163 | 166 | | |
164 | 167 | | |
| |||
0 commit comments