TT#4590 generate unique id for JUNIT output

Change-Id: Id4a60f8abd7dd1a308ca1d1e980b7fad599d50c7
changes/26/8926/2
Victor Seva 9 years ago
parent 31dd6f2b81
commit 7b6c758ff1

@ -1,6 +1,7 @@
#!/bin/bash
RESULTS=${RESULTS:-.}
ID=0
if [ -z "${FORMAT}" ] ; then
FORMAT=TAP
@ -16,10 +17,20 @@ esac
mkdir -p "${RESULTS}"/reports
rm -rf "${RESULTS}"/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 -> ${RESULTS}/reports/${1}.${EXT}"
local RES="${RESULTS}/reports/${1}.${EXT}"
echo "testing $1 -> ${RES}"
if ${OUT_FORCE} ; then
cat<<EOF|lua5.1 - > ${RESULTS}/reports/${1}.${EXT}
cat<<EOF |lua5.1 - > "${RES}"
EXPORT_ASSERT_TO_GLOBALS = true
require "tests/${1}"
---- Control test output:
@ -35,17 +46,21 @@ require "tests/${1}"
---- Control test output:
local lu = LuaUnit
lu:setOutputType('${FORMAT}')
lu:setFname('${RESULTS}/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
@ -53,6 +68,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

@ -17,6 +17,4 @@ else
mkdir -p "${RESULTS}"
fi
source_path="$(pwd)"
RESULTS=${RESULTS} FORMAT=JUNIT ./run_tests.sh

Loading…
Cancel
Save