From 964bf0de6b9211c1649f20c616900fcdf091541a Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Sat, 28 Jun 2008 00:52:20 +0000 Subject: Updated PESQ test to save the WAV output on failure and report the PESQ target. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2088 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/test-pjsua/mod_pesq.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'pjsip-apps') diff --git a/pjsip-apps/src/test-pjsua/mod_pesq.py b/pjsip-apps/src/test-pjsua/mod_pesq.py index de92eb12..109674ef 100644 --- a/pjsip-apps/src/test-pjsua/mod_pesq.py +++ b/pjsip-apps/src/test-pjsua/mod_pesq.py @@ -16,6 +16,7 @@ import sys import re import subprocess import wave +import shutil import inc_const as const from inc_cfg import * @@ -137,10 +138,21 @@ def post_func(t): # Evaluate the PESQ MOS value pesq_res = mo_pesq_out.group(1) if (float(pesq_res) >= threshold): - endpt.trace("Success, PESQ result = " + pesq_res) + endpt.trace("Success, PESQ result = " + pesq_res + " (target=" + str(threshold) + ").") else: - endpt.trace("Failed, PESQ result = " + pesq_res) - raise TestError("WAV seems to be degraded badly") + endpt.trace("Failed, PESQ result = " + pesq_res + " (target=" + str(threshold) + ").") + # Save the wav file + wavoutname = ARGS[1] + wavoutname = re.sub("[\\\/]", "_", wavoutname) + wavoutname = re.sub("\.py$", ".wav", wavoutname) + wavoutname = "logs/" + wavoutname + try: + shutil.copyfile(output_filename, wavoutname) + print "Output WAV is copied to " + wavoutname + except: + print "Couldn't copy output WAV, please check if 'logs' directory exists." + + raise TestError("WAV seems to be degraded badly, PESQ = "+ pesq_res + " (target=" + str(threshold) + ").") # Here where it all comes together -- cgit v1.2.3