TT#4590 generate unique id for JUNIT output

Change-Id: Id4a60f8abd7dd1a308ca1d1e980b7fad599d50c7
(cherry picked from commit 7b6c758ff1)
mr3.8.7
Victor Seva 9 years ago
parent 9174fe2491
commit 2d89e7ec06

@ -1,5 +1,7 @@
#!/bin/bash
ID=0
if [ -z "${FORMAT}" ] ; then
FORMAT=TAP
fi
@ -14,10 +16,20 @@ esac
mkdir -p reports
rm -rf reports/*
# unique id across files
# See TT#4590
function fix_id() {
(( ID += 1))
local tmp_id
tmp_id=$(printf "%05d\n" "$ID")
sed -i "s/id=\"00001\"/id=\"$tmp_id\"/" "$1"
}
function do_test() {
echo "testing $1 -> reports/${1}.${EXT}"
local RES="reports/${1}.${EXT}"
echo "testing $1 -> ${RES}"
if ${OUT_FORCE} ; then
cat<<EOF|lua5.1 - > reports/${1}.${EXT}
cat<<EOF |lua5.1 - > "${RES}"
EXPORT_ASSERT_TO_GLOBALS = true
require "tests/${1}"
---- Control test output:
@ -27,23 +39,27 @@ lu:setVerbosity(1)
lu:run()
EOF
else
cat<<EOF|lua5.1 -
cat<<EOF |lua5.1 -
EXPORT_ASSERT_TO_GLOBALS = true
require "tests/${1}"
---- Control test output:
local lu = LuaUnit
lu:setOutputType('${FORMAT}')
lu:setFname('reports/${1}.${EXT}')
lu:setFname('${RES}')
lu:setVerbosity(1)
lu:run()
EOF
if [[ "${FORMAT}" = "JUNIT" ]] ; then
fix_id "${RES}"
fi
fi
}
if [[ -n "$@" ]]; then
for i in $@; do
for i in "$@"; do
if [ ! -f "$i" ]; then
echo "No $f found"
echo "No $i found"
else
do_test "$(basename "$i" .lua)"
fi
@ -51,6 +67,6 @@ if [[ -n "$@" ]]; then
exit 0
fi
for i in $(find tests -name '*.lua' ! -name test_\*) ; do
find tests -name '*.lua' ! -name test_\*| while read -r i ; do
do_test "$(basename "$i" .lua)"
done

Loading…
Cancel
Save