test-webserver: Fix race condition
authorSimon McVittie <smcv@debian.org>
Tue, 28 Aug 2018 15:26:38 +0000 (16:26 +0100)
committerSimon McVittie <smcv@debian.org>
Sat, 15 Sep 2018 10:41:26 +0000 (11:41 +0100)
commit637b2c8acea6f13353ebe2cc2c339f11983a51a0
tree64cfd040aa06b905cdd519b4c15c302c61ae0398
parentce4c375c4f6512de0c1fcb7473f5d6fa550abbf8
test-webserver: Fix race condition

If we rely on the background subshell to create the httpd-output file,
and we are unlucky, then the "cp" invocation in the loop might execute
before the file has been created, and fail. This appears to have
happened on Debian's arm64 autobuilder, which failed with:

    Running web server: PYTHONUNBUFFERED=1 setsid python3 /<<PKGBUILDDIR>>/tests/http-utils-test-server.py 0
    Web server pid: 13319
    Waiting for web server (1/300)...
    cp: cannot stat '/var/tmp/tap-test.p1cxRN/httpd-output': No such file or directory

Signed-off-by: Simon McVittie <smcv@debian.org>
Forwarded: https://github.com/flatpak/flatpak/pull/2098

Gbp-Pq: Name test-webserver-Fix-race-condition.patch
tests/test-webserver.sh