diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2017-02-02 12:42:12 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-02-02 17:37:45 +0000 |
commit | 42eace0770242b5aa716f87f5f0af3a4fe3c3e29 (patch) | |
tree | b4fad251f4fe49a64a73ce4bbcd36c6b1f819268 /scripts | |
parent | f1957bf59e538fb3762be31706671481c53ed6b6 (diff) | |
download | poky-42eace0770242b5aa716f87f5f0af3a4fe3c3e29.tar.gz |
build-perf-test-wrapper.sh: implement locking
In order to prevent multiple instances of the script running at the same
time.
(From OE-Core rev: 96a194de890f7ef1e6e5e036b32848e0f9d1bcf5)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/contrib/build-perf-test-wrapper.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/contrib/build-perf-test-wrapper.sh b/scripts/contrib/build-perf-test-wrapper.sh index e03ea978b9..a4c19290a7 100755 --- a/scripts/contrib/build-perf-test-wrapper.sh +++ b/scripts/contrib/build-perf-test-wrapper.sh | |||
@@ -67,6 +67,17 @@ if [ $# -ne 0 ]; then | |||
67 | exit 1 | 67 | exit 1 |
68 | fi | 68 | fi |
69 | 69 | ||
70 | # Open a file descriptor for flock and acquire lock | ||
71 | LOCK_FILE="/tmp/oe-build-perf-test-wrapper.lock" | ||
72 | if ! exec 3> "$LOCK_FILE"; then | ||
73 | echo "ERROR: Unable to open lock file" | ||
74 | exit 1 | ||
75 | fi | ||
76 | if ! flock -n 3; then | ||
77 | echo "ERROR: Another instance of this script is running" | ||
78 | exit 1 | ||
79 | fi | ||
80 | |||
70 | echo "Running on `uname -n`" | 81 | echo "Running on `uname -n`" |
71 | if ! git_topdir=$(git rev-parse --show-toplevel); then | 82 | if ! git_topdir=$(git rev-parse --show-toplevel); then |
72 | echo "The current working dir doesn't seem to be a git clone. Please cd there before running `basename $0`" | 83 | echo "The current working dir doesn't seem to be a git clone. Please cd there before running `basename $0`" |