From 8097843c80514c6ae9fed43310897d0b378558f7 Mon Sep 17 00:00:00 2001 From: Nikolay Denev Date: Mon, 17 Oct 2016 20:55:55 +0200 Subject: [PATCH 1/4] Make it work on OS X. Allow analyze script to continue if it sees a skipped test due to missing language/compiler. --- results/analyze | 2 +- run.sh | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/results/analyze b/results/analyze index 2a2dab9..b87f3bc 100755 --- a/results/analyze +++ b/results/analyze @@ -263,7 +263,7 @@ sub main { while ($line = ) { chomp($line); - if ($line =~ /^\s*#/) { + if ($line =~ /^(\s*#|SKIPPING)/) { next; } diff --git a/run.sh b/run.sh index e0a01cb..ab4e0a5 100755 --- a/run.sh +++ b/run.sh @@ -8,6 +8,19 @@ MIN_NLINES="${MIN_NLINES:=10}" # it's a fatal error if we get less than this num SRC_FILTER="${SRC_FILTER:=x}" # if provided, execute only the given test DRY_RUN="${DRY_RUN:=0}" # if enabled, do only the compilation phase +_OS=$(uname) +if [ "$_OS" = "Linux" ]; then + TIME_CMD=$(which time) +elif [ "$_OS" = "Darwin" ]; then + TIME_CMD=$(which gtime) +fi + +if [ "$TIME_CMD" = "" ]; then + echo "Unable to find the GNU time command." + echo "If you are on a non Linux OS such as Mac OS or *BSD you will need to install it separately." + exit -1 +fi + export RUN_TIME echo "# Run time limited to $RUN_TIME wall-clock seconds" @@ -48,11 +61,11 @@ function run_benchmark() { echo "# ... run $n" - TIMES_FILE="$(mktemp --suffix .langs_perf)" || exit 1 + TIMES_FILE=$(mktemp) || exit 1 OUT="$( { - /usr/bin/time -o "$TIMES_FILE" --format \ + $TIME_CMD -o "$TIMES_FILE" --format \ 'real_TIME:%esec user_CPU:%Usec sys_CPU:%Ssec max_RSS:%Mkb swaps:%W ctx_sw:%c+%w' \ $RUN_CMD } 2>&1 From a739c5441b04370e62bbd4fbba0aa3c4663ac857 Mon Sep 17 00:00:00 2001 From: Ivan Zahariev Date: Mon, 17 Oct 2016 22:48:43 +0300 Subject: [PATCH 2/4] Minor Bash syntax improvements --- run.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/run.sh b/run.sh index ab4e0a5..93ac6e0 100755 --- a/run.sh +++ b/run.sh @@ -8,14 +8,14 @@ MIN_NLINES="${MIN_NLINES:=10}" # it's a fatal error if we get less than this num SRC_FILTER="${SRC_FILTER:=x}" # if provided, execute only the given test DRY_RUN="${DRY_RUN:=0}" # if enabled, do only the compilation phase -_OS=$(uname) -if [ "$_OS" = "Linux" ]; then - TIME_CMD=$(which time) -elif [ "$_OS" = "Darwin" ]; then - TIME_CMD=$(which gtime) +_OS="$(uname)" +if [ "$_OS" == "Linux" ]; then + TIME_CMD="$(which time)" +elif [ "$_OS" == "Darwin" ]; then + TIME_CMD="$(which gtime)" fi -if [ "$TIME_CMD" = "" ]; then +if [ "$TIME_CMD" == "" ]; then echo "Unable to find the GNU time command." echo "If you are on a non Linux OS such as Mac OS or *BSD you will need to install it separately." exit -1 @@ -65,7 +65,7 @@ function run_benchmark() { OUT="$( { - $TIME_CMD -o "$TIMES_FILE" --format \ + "$TIME_CMD" -o "$TIMES_FILE" --format \ 'real_TIME:%esec user_CPU:%Usec sys_CPU:%Ssec max_RSS:%Mkb swaps:%W ctx_sw:%c+%w' \ $RUN_CMD } 2>&1 From 988aa4898e89eb91ed9ffd65b4abcef1a1003130 Mon Sep 17 00:00:00 2001 From: Ivan Zahariev Date: Mon, 17 Oct 2016 22:50:39 +0300 Subject: [PATCH 3/4] Print errors to stderr --- run.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run.sh b/run.sh index 93ac6e0..129965d 100755 --- a/run.sh +++ b/run.sh @@ -16,8 +16,8 @@ elif [ "$_OS" == "Darwin" ]; then fi if [ "$TIME_CMD" == "" ]; then - echo "Unable to find the GNU time command." - echo "If you are on a non Linux OS such as Mac OS or *BSD you will need to install it separately." + echo "Unable to find the GNU time command." >&2 + echo "If you are on a non-Linux OS such as Mac OS or *BSD you will need to install it separately." >&2 exit -1 fi From bccd20db3851934b5d0bbf399cfc51d32fdc4d42 Mon Sep 17 00:00:00 2001 From: Ivan Zahariev Date: Mon, 17 Oct 2016 22:51:29 +0300 Subject: [PATCH 4/4] Quoting variables in Bash never hurts :) --- run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 129965d..cbdfbe3 100755 --- a/run.sh +++ b/run.sh @@ -61,7 +61,7 @@ function run_benchmark() { echo "# ... run $n" - TIMES_FILE=$(mktemp) || exit 1 + TIMES_FILE="$(mktemp)" || exit 1 OUT="$( {