2022-12-20 13:14:59 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
#set -x
|
|
|
|
|
2023-01-11 17:48:34 +00:00
|
|
|
#> Note: this script lies within <conf-dir>/upload_hooks
|
|
|
|
CONF_DIR="$(dirname "${0}")"/..
|
2023-01-10 15:49:44 +00:00
|
|
|
|
2022-12-20 13:14:59 +00:00
|
|
|
prog_NAME=$(basename "${0}")
|
|
|
|
|
|
|
|
warn()
|
|
|
|
{
|
|
|
|
echo "${prog_NAME}: WARN: $*"
|
|
|
|
}
|
|
|
|
|
|
|
|
info()
|
|
|
|
{
|
|
|
|
echo "${prog_NAME}: INFO: $*"
|
|
|
|
}
|
|
|
|
|
|
|
|
err()
|
|
|
|
{
|
|
|
|
echo "${prog_NAME}: ERROR: $*" 1>&2
|
|
|
|
}
|
|
|
|
|
|
|
|
die()
|
|
|
|
{
|
|
|
|
echo "${prog_NAME}: ERROR: $*" 1>&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat <<EOM 1>&2
|
2023-01-16 13:45:58 +00:00
|
|
|
usage: ${prog_NAME} [ OPTIONS ] <main_binary_localpath>
|
2022-12-20 14:03:09 +00:00
|
|
|
Starts up a performance-test if job is supported and the binary has not been tested before.
|
|
|
|
In the end a new histogram-plot is generated containing all the results over time.
|
2022-12-20 13:14:59 +00:00
|
|
|
Options:
|
|
|
|
--uuid=STRING
|
|
|
|
UUID of build.
|
2022-12-20 14:03:09 +00:00
|
|
|
--job=STRING
|
|
|
|
The job name of the build.
|
|
|
|
--sha256=STRING
|
|
|
|
The SHA256 hash of the main binary.
|
2022-12-20 13:14:59 +00:00
|
|
|
--data-dir=STRING
|
|
|
|
Path to the data directory.
|
|
|
|
--cache-dir=STRING
|
|
|
|
Path to the cache directory.
|
|
|
|
EOM
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
UUID=
|
|
|
|
JOB=
|
|
|
|
BIN_SHA256=
|
|
|
|
CACHE_DIR=
|
|
|
|
DATA_DIR=
|
|
|
|
|
2023-01-11 17:48:34 +00:00
|
|
|
while [ $# -gt 1 ]; do
|
2022-12-20 13:14:59 +00:00
|
|
|
OPT="$1"
|
|
|
|
|
|
|
|
case "${OPT}" in
|
|
|
|
--uuid=*)
|
|
|
|
UUID="${OPT##*=}"
|
|
|
|
;;
|
|
|
|
--job=*)
|
|
|
|
JOB="${OPT##*=}"
|
|
|
|
;;
|
|
|
|
--sha256=*)
|
|
|
|
BIN_SHA256="${OPT##*=}"
|
|
|
|
;;
|
|
|
|
--cache-dir=*)
|
|
|
|
CACHE_DIR="${OPT##*=}"
|
|
|
|
;;
|
|
|
|
--data-dir=*)
|
|
|
|
DATA_DIR="${OPT##*=}"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
warn "Ignoring unknown option: '${OPT}' (Note that this script reads DB)"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
[ -z "${UUID}" ] && die "The --uuid option must be specified"
|
|
|
|
[ -z "${JOB}" ] && die "The --job option must be specified"
|
|
|
|
[ -z "${BIN_SHA256}" ] && die "The --sha256 option must be specified"
|
|
|
|
[ -z "${CACHE_DIR}" ] && die "The --cache-dir option must be specified"
|
|
|
|
[ -z "${DATA_DIR}" ] && die "The --data-dir option must be specified"
|
|
|
|
|
2023-01-12 15:58:26 +00:00
|
|
|
BIN="$1"
|
|
|
|
[ -z "${BIN}" ] && \
|
2022-12-20 13:14:59 +00:00
|
|
|
die "The main binarys localpath must be given as the first positional argument"
|
2023-01-12 15:58:26 +00:00
|
|
|
BIN_EXT=$(echo "$BIN" | sed 's/.*\.\(.*\)/\1/')
|
2022-12-20 13:14:59 +00:00
|
|
|
|
2023-01-12 14:27:33 +00:00
|
|
|
# >>> CONFIGURE PER SYSTEM
|
|
|
|
SERVER="starand"
|
|
|
|
SERVER_DIR="0tmp/robur_perftest"
|
|
|
|
# <<< --------------------
|
|
|
|
|
2022-12-20 13:14:59 +00:00
|
|
|
info "processing UUID '$UUID'"
|
|
|
|
|
2022-12-20 20:08:16 +00:00
|
|
|
DB="${DATA_DIR}/builder.sqlite3"
|
|
|
|
[ ! -e "$DB" ] && die "The database doesn't exist: '$DB'"
|
|
|
|
|
|
|
|
DB_VERSION="$(sqlite3 "$DB" "PRAGMA user_version;")"
|
|
|
|
[ -z "$DB_VERSION" ] && die "Couldn't read database version from '$DB'"
|
|
|
|
[ "$DB_VERSION" -lt 16 ] && die "The database version should be >= 16. It is '$DB_VERSION'"
|
|
|
|
|
|
|
|
APP_ID="$(sqlite3 "$DB" "PRAGMA application_id;")"
|
|
|
|
[ -z "$APP_ID" ] && die "Couldn't read application-id from '$DB'"
|
|
|
|
[ "$APP_ID" -ne 1234839235 ] && die "The application-id should be = 1234839235. It is '$APP_ID'"
|
|
|
|
|
2023-01-10 15:49:44 +00:00
|
|
|
PERFJOB_DIR="$DATA_DIR/_perftest/$JOB"
|
|
|
|
PERFSCRIPT_DIR="$CONF_DIR/perftest/$JOB"
|
2022-12-20 20:08:16 +00:00
|
|
|
PERFDATA_DIR="$PERFJOB_DIR/$BIN_SHA256"
|
2022-12-20 13:14:59 +00:00
|
|
|
|
2022-12-21 11:00:20 +00:00
|
|
|
if [ -d "$PERFDATA_DIR" ]; then
|
|
|
|
info "$PERFDATA_DIR already exists, exiting"
|
|
|
|
exit 0
|
|
|
|
fi;
|
|
|
|
#< goto maybe add a 'force' param to rerun test + regenerate plot
|
|
|
|
|
2022-12-20 13:14:59 +00:00
|
|
|
case "${JOB},${BIN_EXT}" in
|
|
|
|
unipi,hvt)
|
2023-01-10 15:49:44 +00:00
|
|
|
"$PERFSCRIPT_DIR"/run-test-remotely.sh "$PERFSCRIPT_DIR"/remote "$PERFDATA_DIR" "$BIN" "$SERVER" "$SERVER_DIR"
|
2022-12-20 20:08:16 +00:00
|
|
|
"$PERFSCRIPT_DIR"/plot.sh "$PERFJOB_DIR" "$CACHE_DIR" "$DB" "$JOB" "$UUID"
|
2022-12-20 13:14:59 +00:00
|
|
|
;;
|
|
|
|
*)
|
2022-12-20 14:04:52 +00:00
|
|
|
info "Job '${JOB}' compiled to the '${BIN_EXT}'-target doesn't support performance-testing"
|
2022-12-20 13:14:59 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|