WS_DOWNLOAD="${WS}/dwn"
WS_TEST="${WS}/img_test"
WS_TEST_REMOTE="${WS}/img_test_remote"
+WS_PUBLISH="${WS}/publish"
+
+DBNAME="results.db3"
+DBPATH="${WS_PUBLISH}/${DBNAME}"
TMP_POLL="/tmp/tl-master-poll"
TMP_MASTER="/tmp/tl-master"
check_diff() {
DIFF_FILE="$1"
JOB_NR="$2"
+ TARGET="$3"
test -n "$1" || die "Missing argument: diff file"
test -n "$2" || die "Missing argument: build nr"
+ test -n "$3" || die "Missing argument: target"
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}`
+ nr=`tspwb -L PUBLISH sh ${TSP_DIR}/jobs/publish.sh ${JOB_NR} ${TARGET}`
return 1
fi
}
if [ "$FAIL_CNT" -ge 2 ]; then
# Trigger publish job
- tspwb -L PUBLISH sh ${TSP_DIR}/jobs/publish.sh $1
+ tspwb -L PUBLISH sh ${TSP_DIR}/jobs/publish.sh "$1" "$TARGET"
exit 0
fi
fi
# Trigger publish job
-tspwb -L PUBLISH sh ${TSP_DIR}/jobs/publish.sh $1
+tspwb -L PUBLISH sh ${TSP_DIR}/jobs/publish.sh "$1" "$TARGET"
. "${TSP_DIR}/common.sh"
+TARGET="$2"
+
test -n "$1" || die "Missing argument: build nr"
+test -n "$TARGET" || die "Missing argument: target"
+test -d "${WS_PUBLISH}" || mkdir -p "${WS_PUBLISH}"
+
+cd "${WS_PUBLISH}"
IMG_WORKDIR="${WS_TEST}/$1"
DWN_WORKDIR="${WS_DOWNLOAD}/$1"
PROJECT_FILE="`ls ${DWN_WORKDIR}/project-*.conf`"
DIFF_FILE="`ls ${DWN_WORKDIR}/diff-*.report`"
SYSCTL_FILE="${IMG_WORKDIR}/sysctl.result"
-TARGET="${PROJECT_FILE%%.conf}"
-TARGET="${TARGET##*-}"
SNAPSHOT_SYSCTL_FILE="${WS_TEST}/snapshot_sysctl_${TARGET}"
TAG_FILE="${IMG_WORKDIR}/tag"
fi
fi
-test -n "$TAG" && echo "$TAG" > "$TAG_FILE"
+test -n "$TAG" || TAG="Unclear"
+echo "$TAG" > "$TAG_FILE"
+
+init_db() {
+ # Load schema
+ sqlite3 -batch "${DBPATH}" < "${TSP_DIR}/results-schema.sql"
+ # Load initial values to tables 'device' and 'result'
+ sqlite3 -batch "${DBPATH}" < "${TSP_DIR}/results-values-device.sql"
+ sqlite3 -batch "${DBPATH}" < "${TSP_DIR}/results-values-result.sql"
+}
+
+test -f "${DBPATH}" || init_db
+
+SR="`head -n 1 ${PROJECT_FILE}`"
+
+echo "SR: $SR"
+echo "TAG: $TAG"
+echo "TARGET: $TARGET"
+
+# Publish to database
+sqlite3 "${DBPATH}" "insert into test values (NULL,'$SR', CURRENT_TIMESTAMP,\
+ (select r.rid from result r where r.rname='$TAG'),\
+ (select d.did from device d where d.dname='$TARGET'));"
# Clean up workspace
ssh tl-pwb "rm -rf \"${WORKSPACE}\"; mkdir -p \"${WORKSPACE}\"" || echo "rm failed"