[Libreoffice-commits] 2 commits - loperf/loperf.sh loperf/utls.sh
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Feb 12 03:16:49 PST 2013
loperf/loperf.sh | 59 ++++++++++++++++++++++++++++++-------------------------
loperf/utls.sh | 46 +++++++++++++++++++++++++++++++-----------
2 files changed, 67 insertions(+), 38 deletions(-)
New commits:
commit 6a34502cde29bb53665e24ba5bc72ecc0eaddf03
Author: Yifan J <yfjiang at suse.com>
Date: Mon Jan 21 13:14:02 2013 +0800
loperf: lo version check, csv log dir
valgrind >= 3.7 dependency check
csv output to a standalone directory, so what we got now:
callgrind directory: to contain raw logs
loperf diretory: to have logs per build
csv directory: to have logs per file
expand all logs towards the same test document to a single csv log
merge all version check to a single function
1. try git head - if yes use it, otherwise,
2. try buildid field in versionrc - if yes use it, otherwise,
3. try `libreoffice --version` - if yes use it, otherwise,
4. use hard code string "unknown_version"
use same version tag in log file name and the csv field
diff --git a/loperf/loperf.sh b/loperf/loperf.sh
index 01360fa..b681ecc 100755
--- a/loperf/loperf.sh
+++ b/loperf/loperf.sh
@@ -26,35 +26,46 @@
source utls.sh
+# Requirement check
+# Vagrind >= 3.7
+
+REQUIRED_VALGRIND_VERSION="valgrind-3.7.0"
+
+hash valgrind > /dev/null 2>&1 || echo "valgrind >= $REQUIRED_VALGRIND_VERSION is required for this test."
+
+if test $(compareversion "$(valgrind --version)" "$REQUIRED_VALGRIND_VERSION") -eq -1; then
+ echo "valgrind >= $REQUIRED_VALGRIND_VERSION is required for this test."
+ exit 1
+fi
+
+# Post dependency check
export OOO_EXIT_POST_STARTUP=1
export OOO_DISABLE_RECOVERY=1
OFFICEBIN="$1"
TESTDATE=$(date --rfc-3339=second)
-BUILD_ID=$(get_lo_build_id "$OFFICEBIN")
-BUILD_ID=${BUILD_ID:-"BUILD_ID_NOT_FOUND"}
-
-LOVERSION=$(get_lo_version "$OFFICEBIN")
+LOVERSION="$(get_lo_version "$OFFICEBIN")"
DT=$(echo "$TESTDATE" | tr -s '\ \+\-\:' "_")
-CG_LOG="logs/callgrind/cg-lo$LOVERSION-$DT"
-PF_LOG="logs/loperf/pf-lo$LOVERSION-$DT.log"
-CSV_LOG="logs/callgrind/cg-lo$LOVERSION"
+CG_LOG="logs/callgrind/cg-lo-$LOVERSION-$DT"
+PF_LOG="logs/loperf/pf-lo-$LOVERSION-$DT.log"
ERR_LOG="logs/error.log"
+CSV_LOG_DIR="logs/csv/"
-mkdir -p logs/callgrind 2>&1 > /dev/null
-mkdir -p logs/loperf 2>&1 > /dev/null
+mkdir -p logs/callgrind > /dev/null 2>&1
+mkdir -p logs/loperf > /dev/null 2>&1
+mkdir -p "$CSV_LOG_DIR" > /dev/null 2>&1
function launch {
if test "$1" = ""; then
- valgrind --tool=callgrind --callgrind-out-file="$CG_LOG"_offload.log --simulate-cache=yes --dump-instr=yes --collect-bus=yes --branch-sim=yes "$OFFICEBIN" --splash-pipe=0 --headless > /dev/null 2>&1
- echo -n "$CG_LOG"_offload.log
+ valgrind --tool=callgrind --callgrind-out-file="$CG_LOG"-offload.log --simulate-cache=yes --dump-instr=yes --collect-bus=yes --branch-sim=yes "$OFFICEBIN" --splash-pipe=0 --headless > /dev/null 2>&1
+ echo -n "$CG_LOG"-offload.log
else
fn=${1#docs\/}
- valgrind --tool=callgrind --callgrind-out-file="$CG_LOG"_onload_"$fn".log --simulate-cache=yes --dump-instr=yes --collect-bus=yes --branch-sim=yes "$OFFICEBIN" "$1" --splash-pipe=0 --headless > /dev/null 2>&1
- echo -n "$CG_LOG"_onload_"$fn".log
+ valgrind --tool=callgrind --callgrind-out-file="$CG_LOG"-onload-"$fn".log --simulate-cache=yes --dump-instr=yes --collect-bus=yes --branch-sim=yes "$OFFICEBIN" "$1" --splash-pipe=0 --headless > /dev/null 2>&1
+ echo -n "$CG_LOG"-onload-"$fn".log
fi
}
@@ -119,9 +130,9 @@ find docs -type f | grep -Ev "\/\." | while read f; do
echo "$onload_str" | tee -a "$PF_LOG"
#Construct the csv file name
- CSV_FN="$CSV_LOG"_onload_"${f#docs\/}".csv
+ CSV_FN="$CSV_LOG_DIR"/"onload-${f#docs\/}".csv
- echo -n "$TESTDATE"$'\t'"$BUILD_ID" >> "$CSV_FN"
+ echo -n "$TESTDATE"$'\t'"$LOVERSION" >> "$CSV_FN"
# Populate onload delta to PF_LOG and CSV_FN
for i in $(seq 0 13); do
@@ -140,13 +151,9 @@ find docs -type f | grep -Ev "\/\." | while read f; do
done
# Regression check
-echo "Regression Status:" | tee -a "$PF_LOG"
-echo "-----------------" | tee -a "$PF_LOG"
-
-find $(dirname $(readlink -f "$PF_LOG")) -type f | grep -v "$PF_LOG" | grep log$ | while read rf; do
-
- check_regression "$PF_LOG" "$rf" | tee -a "$PF_LOG"
-
-done
-
-grep '^Regression found!$' "$PF_LOG" > /dev/null || echo "Congratulations, no regression found!" | tee -a "$PF_LOG"
+# echo "Regression Status:" | tee -a "$PF_LOG"
+# echo "-----------------" | tee -a "$PF_LOG"
+# find $(dirname $(readlink -f "$PF_LOG")) -type f | grep -v "$PF_LOG" | grep log$ | while read rf; do
+# check_regression "$PF_LOG" "$rf" | tee -a "$PF_LOG"
+# done
+# grep '^Regression found!$' "$PF_LOG" > /dev/null || echo "Congratulations, no regression found!" | tee -a "$PF_LOG"
diff --git a/loperf/utls.sh b/loperf/utls.sh
index 6103157..41bb1a0 100755
--- a/loperf/utls.sh
+++ b/loperf/utls.sh
@@ -26,21 +26,23 @@
function get_lo_version {
- echo -n $(echo $("$1" --version) | sed s/"LibreOffice "//)
-}
-
-function get_lo_commit_hash {
-
+ VERSIONRC_FN=$(echo -n $(echo -n "$1" | sed 's/soffice.*//')versionrc)
LOGITDIR=$(echo -n $(echo -n "$1" | sed 's/core.*//')core/.git)
- echo -n $(git --git-dir="$LOGITDIR" log -1 --pretty=format:"%H")
-}
+ version=$(git --git-dir="$LOGITDIR" rev-parse HEAD 2> /dev/null)
-function get_lo_build_id {
+ if test "$version" = ""; then
+ version=$(sed -nr 's/buildid=(.+)/\1/p' "$VERSIONRC_FN" 2> /dev/null)
+ if test "$version" = ""; then
+ version=$(echo -n $(echo $("$1" --version) | sed s/"LibreOffice "//))
+ if test "$version" = ""; then
+ version="unknown_version"
+ fi
+ fi
+ fi
- VERSIONRC_FN=$(echo -n $(echo -n "$1" | sed 's/soffice.*//')versionrc)
+ echo -n "$version"
- echo -n $(cat "$VERSIONRC_FN" | grep ^buildid | sed s/buildid\=//)
}
function is_delta_regress {
@@ -80,7 +82,6 @@ function check_regression {
# find offload regression
-
# find onload regression
i=0
@@ -112,3 +113,24 @@ function check_regression {
return 1
}
+
+
+# A lovely script to compare versions from fgm/stackoverflow:)
+# http://stackoverflow.com/questions/3511006/how-to-compare-versions-of-some-products-in-unix-shell
+function compareversion () {
+
+ typeset IFS='.'
+ typeset -a v1=( $1 )
+ typeset -a v2=( $2 )
+ typeset n diff
+
+ for (( n=0; n<4; n+=1 )); do
+ diff=$((v1[n]-v2[n]))
+ if [ $diff -ne 0 ] ; then
+ [ $diff -le 0 ] && echo '-1' || echo '1'
+ return
+ fi
+ done
+ echo '0'
+
+}
commit 6bc06edf950575fa8f10019a66d83aa484a0236c
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Tue Feb 12 00:51:44 2013 +0100
loperf: these are bash scripts
diff --git a/loperf/loperf.sh b/loperf/loperf.sh
index 19822cc..01360fa 100755
--- a/loperf/loperf.sh
+++ b/loperf/loperf.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
# Version: MPL 1.1 / GPLv3+ / LGPLv3+
#
# The contents of this file are subject to the Mozilla Public License Version
diff --git a/loperf/utls.sh b/loperf/utls.sh
index 78402ac..6103157 100755
--- a/loperf/utls.sh
+++ b/loperf/utls.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
# Version: MPL 1.1 / GPLv3+ / LGPLv3+
#
# The contents of this file are subject to the Mozilla Public License Version
More information about the Libreoffice-commits
mailing list