# Copyright 2005-2015 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
BEGIN {
OFMT = "%.4f"
print ""
if (JMETER=="true") {
print ""
} else {
print ""
}
test_name = "none"
dir = ""
times["real"] = ""
times["user"] = ""
times["sys"] = ""
}
/TEST\:/ {test_name = $2}
/PASS\:/ { if (JMETER=="true")
for (key in times) jmeter_sample(dir,test_name,key,times[key],TIMESTAMP,"true")
else
junit_sample(dir,test_name,times["real"], "true")
}
/FAIL\:/ { if (JMETER=="true")
for (key in times) jmeter_sample(dir,test_name,key,times[key],TIMESTAMP,"false")
else
junit_sample(dir,test_name,times["real"], "false")
}
/^real|^user|^sys/ {times[$1]=get_time_in_msecs($2)}
/DIRECTORY:/ {dir = get_dir($2)}
END {
if (JMETER=="true") {
print ""
} else {
print ""
}
}
function jmeter_sample(dir, test_name,test_type,time,timestamp,success) {
print ""
}
function junit_sample(dir,test_name,time,success) {
if (success=="true") {
print ""
} else {
print ""
print "Non zero-return"
print ""
}
}
function get_time_in_msecs(timestring) {
if ( timestring ~ /s$/ ) {
# It must be the 0m0.003s format
len = split(timestring,bits,"[hms]")
} else {
# It must be the 2:00.0 format
len = split(timestring,bits,":")
}
val = 0
count = 0
for (i = len-1;i>=0;i--) {
if (! bits[i] ~ /\s*/) {
val = val + (bits[i] * 1000 * (60 ^ count))
count ++
}
}
return val;
}
function get_dir(dir) {
len = split(dir,bits,"/")
return bits[len]
}