From 329f0cc3654f8d13bbaff71cc400cb9c4154ad53 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 23 Apr 2021 15:15:56 +0200 Subject: test/json: Make the test hook more reliable Ugh, this was super flaky under -j 16 and -j 4, each behaving in slightly different ways. This seems to be stable now. No real bug though, all behaviors were OK. --- test/integration/test-apt-cli-json-hooks | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'test/integration/test-apt-cli-json-hooks') diff --git a/test/integration/test-apt-cli-json-hooks b/test/integration/test-apt-cli-json-hooks index 3ec470284..a3bcf3fdb 100755 --- a/test/integration/test-apt-cli-json-hooks +++ b/test/integration/test-apt-cli-json-hooks @@ -28,14 +28,12 @@ export TEST_HOOK_VERSION=0.2 cat >> json-hook.sh << EOF #!/bin/bash -set -e +trap '' SIGPIPE while true; do - read request <&\$APT_HOOK_SOCKET - read empty <&\$APT_HOOK_SOCKET + read request <&\$APT_HOOK_SOCKET || exit 1 if echo "\$request" | grep -q ".hello"; then echo "HOOK: HELLO" - printf '{"jsonrpc": "2.0", "result": {"version": "'\$TEST_HOOK_VERSION'"}, "id": 0}\n\n' >&\$APT_HOOK_SOCKET fi if echo "\$request" | grep -q ".bye"; then @@ -44,7 +42,16 @@ while true; do fi echo HOOK: request \$request + + read empty <&\$APT_HOOK_SOCKET || exit 1 + echo HOOK: empty \$empty + + if echo "\$request" | grep -q ".hello"; then + printf '{"jsonrpc": "2.0", "result": {"version": "'\$TEST_HOOK_VERSION'"}, "id": 0}\n\n' >&\$APT_HOOK_SOCKET 2>/dev/null || exit 1 + fi + + done EOF -- cgit v1.2.3-70-g09d2