blob: 8dd90a1dc794d418022022d2e2d692983dc78d50 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This function takes up to two arguments:
# 1. error message
# 2. exit code (default: 1)
#
# Example: test -n "$VAR" || die "VAR is not set!" 5
# If variable $VAR is not set, "VAR is not set!" will be printed on stderr
# and script in which it was invoked will exit with exit code equal to 5.
#
# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
die() {
printf >&2 -- '%s\n' "$1"
exit ${2:-1}
}
test -z "${TSP_DIR}" || export TS_ONFINISH="${TSP_DIR}/scripts/log.sh"
WS="${HOME}/ws"
WS_WATCHER="${WS}/watcher"
WS_DOWNLOAD="${WS}/dwn"
WS_TEST="${WS}/img_test"
WS_TEST_REMOTE="${WS}/img_test_remote"
TMP_POLL="/tmp/tl-master-poll"
TMP_MASTER="/tmp/tl-master"
TMP_PWB="/tmp/tl-pwb"
test -d "$TMP_POLL" || mkdir "$TMP_POLL"
test -d "$TMP_MASTER" || mkdir "$TMP_MASTER"
test -d "$TMP_PWB" || mkdir "$TMP_PWB"
alias tspoll="TMPDIR=$TMP_POLL tsp"
alias tsmaster="TMPDIR=$TMP_MASTER tsp"
alias tspwb="TMPDIR=$TMP_PWB tsp"
tsrun_target() {
test -n "$1" || die "Missing argument: target"
TMPDIR="/tmp/tl-runner-$1"
test -d "$TMPDIR" || mkdir "$TMPDIR"
shift
TMPDIR="$TMPDIR" tsp $@
}
check_diff() {
DIFF_FILE="$1"
JOB_NR="$2"
test -n "$1" || die "Missing argument: diff file"
test -n "$2" || die "Missing argument: build nr"
test -n "${TSP_DIR}" || die "Missing environment variable: TSP_DIR"
if grep -q "identical" "${DIFF_FILE}"
then
echo "Image is unchanged in respect to snapshot"
nr=`tspwb -L PUBLISH sh ${TSP_DIR}/jobs/publish.sh ${JOB_NR}`
return 1
fi
}
|