Changeset 2088 for pjproject


Ignore:
Timestamp:
Jun 28, 2008 12:52:20 AM (16 years ago)
Author:
nanang
Message:

Updated PESQ test to save the WAV output on failure and report the PESQ target.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/test-pjsua/mod_pesq.py

    r2078 r2088  
    1717import subprocess 
    1818import wave 
     19import shutil 
    1920import inc_const as const 
    2021 
     
    138139        pesq_res = mo_pesq_out.group(1) 
    139140        if (float(pesq_res) >= threshold): 
    140                 endpt.trace("Success, PESQ result = " + pesq_res) 
     141                endpt.trace("Success, PESQ result = " + pesq_res + " (target=" + str(threshold) + ").") 
    141142        else: 
    142                 endpt.trace("Failed, PESQ result = " + pesq_res) 
    143                 raise TestError("WAV seems to be degraded badly") 
     143                endpt.trace("Failed, PESQ result = " + pesq_res + " (target=" + str(threshold) + ").") 
     144                # Save the wav file 
     145                wavoutname = ARGS[1] 
     146                wavoutname = re.sub("[\\\/]", "_", wavoutname) 
     147                wavoutname = re.sub("\.py$", ".wav", wavoutname) 
     148                wavoutname = "logs/" + wavoutname 
     149                try: 
     150                        shutil.copyfile(output_filename, wavoutname) 
     151                        print "Output WAV is copied to " + wavoutname 
     152                except: 
     153                        print "Couldn't copy output WAV, please check if 'logs' directory exists." 
     154 
     155                raise TestError("WAV seems to be degraded badly, PESQ = "+ pesq_res + " (target=" + str(threshold) + ").") 
    144156 
    145157 
Note: See TracChangeset for help on using the changeset viewer.