From d454224a4d07d3baa4bd1fdf9e7f4e3a6e2a4e94 Mon Sep 17 00:00:00 2001 From: Jeremy Hayes Date: Tue, 18 Dec 2018 13:35:31 -0700 Subject: [PATCH] tests: Flock the implicit layer test Fix #121 Change-Id: I2e060a3ddda3bf919d6be8a3e0af7169ac0fee63 --- tests/run_extra_loader_tests.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/run_extra_loader_tests.sh b/tests/run_extra_loader_tests.sh index c29e5737..86d1f59a 100755 --- a/tests/run_extra_loader_tests.sh +++ b/tests/run_extra_loader_tests.sh @@ -101,6 +101,11 @@ RunImplicitLayerTest() echo "ImplicitLayer test PASSED" } -! RunImplicitLayerTest && echo "ImplicitLayer test FAILED" >&2 && exit 1 +# Prevent the implicit layer test from running concurrently with itself in another process. +# i.e. flock the following command subshell with an automatic file descriptor. +filename=${0##*/} +( + flock "$filedesc" && ! RunImplicitLayerTest && echo "ImplicitLayer test FAILED" >&2 && exit 1 +){filedesc}>"/tmp/$filename.lockfile" popd > /dev/null