TT#29068 Move kamailio's json output after each test

The script move the kamailio json files from /tmp/cfgtest folder
to the log folder as stated in the README file. This is executed
at the end of each single test.
To be sure that the /tmp/cfgtest is in place, it creates the folder
before start the test and it deletes the folder afterwards.

Change-Id: I54426b4415898165c1c2ba8154d0761a869c85d4
changes/61/18061/2
Marco Capetta 8 years ago
parent ae6e049cfb
commit cdc7428ad3

@ -554,7 +554,8 @@ fi
GROUP="${GROUP:-scenarios}"
NAME_CHECK="$1"
KAM_DIR="${KAM_DIR:-/var/run/kamailio/cfgtest}"
KAM_DIR="${KAM_DIR:-/tmp/cfgtest}"
JSON_DIR="${KAM_DIR}/${NAME_CHECK}"
BASE_DIR="${BASE_DIR:-/usr/share/kamailio-config-tests}"
BIN_DIR="${BASE_DIR}/bin"
LOG_DIR="${BASE_DIR}/log/${GROUP}/${NAME_CHECK}"
@ -602,9 +603,9 @@ if [ -z "$SKIP_RUNSIPP" ]; then
mkdir -p "${KAM_DIR}"
chown -R kamailio:kamailio "${KAM_DIR}"
else
echo "$(date) - remove ${KAM_DIR}/${NAME_CHECK}"
echo "$(date) - remove ${JSON_DIR}"
# shellcheck disable=SC2115
rm -rf "${KAM_DIR}/${NAME_CHECK}"
rm -rf "${JSON_DIR}"
fi
fi
echo "$(date) - Cleaning csv/reg.xml files"
@ -627,17 +628,18 @@ if [ -z "$SKIP_RUNSIPP" ]; then
echo "$(date) - move scenario_ids.yml file"
mv "${SCEN_CHECK_DIR}/scenario_ids.yml" "${LOG_DIR}"
echo "$(date) - Done"
else
if [ -n "${JSON_KAM}" ] ; then
echo "$(date) - get kamailio cfgt files"
if [ -d "${KAM_DIR}/${NAME_CHECK}" ] ; then
for i in "${KAM_DIR}/${NAME_CHECK}"/*.json ; do
echo "$(date) - Move kamailio json files"
if [ -d "${JSON_DIR}" ] ; then
for i in "${JSON_DIR}"/*.json ; do
expand -t1 "$i" > "${LOG_DIR}/$(printf '%04d.json' "$(basename "$i" .json)")"
rm "$i"
done
rmdir "${KAM_DIR:?}/${NAME_CHECK:?}"
rm -rf "${JSON_DIR}"
echo "$(date) - Done"
else
echo "no cfgt files found"
echo "$(date) - No json files found"
fi
fi
fi

@ -7,6 +7,7 @@ BIN_DIR="${BASE_DIR}/bin"
GROUP="${GROUP:-scenarios}"
LOG_DIR="${BASE_DIR}/log/${GROUP}"
MLOG_DIR="${BASE_DIR}/mem"
KAM_DIR="/tmp/cfgtest"
PROFILE="CE"
DOMAIN="spce.test"
TIMEOUT=${TIMEOUT:-300}
@ -105,6 +106,13 @@ else
PIDWATCH_OPTS=""
fi
echo "$(date) - Create temporary folder for json files"
rm -rf "${KAM_DIR}"
mkdir -p "${KAM_DIR}"
if [ -d "${KAM_DIR}" ]; then
chown kamailio "${KAM_DIR}"
fi
echo "$(date) - Clean mem log dir"
rm -rf "${MLOG_DIR}"
mkdir -p "${MLOG_DIR}" "${LOG_DIR}"
@ -176,6 +184,11 @@ if [[ ${MEMDBG} = 1 ]] ; then
ngcp-memdbg-csv /var/log/ngcp/kamailio-proxy.log "${MLOG_DIR}" >/dev/null
fi
if [ -d "${KAM_DIR}" ]; then
echo "$(date) - Removing temporary json dir"
rm -rf "${KAM_DIR}"
fi
cfg_debug_off
echo "$(date) - Done[$error_flag]"

Loading…
Cancel
Save