+++ /dev/null
-import unittest
-
-import native_libvlc_test
-
-class NativeAlgoTestCase( unittest.TestCase ):
- def test_arrays( self ):
- """[Algo] Check dynamic arrays"""
- native_libvlc_test.arrays_test()
- def test_bsearch_direct( self ):
- """[Algo] Check Bsearch with simple types"""
- native_libvlc_test.bsearch_direct_test()
- def test_bsearch_struct( self ):
- """[Algo] Check Bsearch with structs"""
- native_libvlc_test.bsearch_member_test()
- def test_dict( self ):
- """[Algo] Check dictionnaries"""
- native_libvlc_test.dict_test()
+++ /dev/null
-import unittest
-
-import native_gc_test
-
-class NativeGcTestCase( unittest.TestCase ):
- def testGc( self ):
- """[GC] Test GC"""
- native_gc_test.gc_test()
+++ /dev/null
-import unittest
-
-import native_libvlc_test
-
-class NativeI18NTestCase( unittest.TestCase ):
- def testi18n_atof( self ):
- """[I18N] Test i18n_atof"""
- native_libvlc_test.i18n_atof_test()
+++ /dev/null
-import unittest
-
-import native_libvlc_test
-
-class NativeLibvlcTestCase( unittest.TestCase ):
- def testTls( self ):
- """[Thread] Set TLS"""
- native_libvlc_test.threadvar_test()
- def test1Exception( self ):
- """[LibVLC] Checks libvlc_exception"""
-# native_libvlc_test.exception_test()
- def test2Startup( self ):
- """[LibVLC] Checks creation/destroy of libvlc"""
-# native_libvlc_test.create_destroy()
- def test3Playlist( self ):
- """[LibVLC] Checks basic playlist interaction"""
-# native_libvlc_test.playlist_test()
- def test4VLM( self ):
- """[LibVLC] Checks VLM wrapper"""
-# native_libvlc_test.vlm_test()
+++ /dev/null
-import unittest
-
-import native_libvlc_test
-
-class NativeProfilesTestCase( unittest.TestCase ):
- def testchains( self ):
- """[Streaming] Test sout chains handling"""
- native_libvlc_test.chains_test()
- def testchains2(self ):
- """[Streaming] Test sout chain interactions handling"""
- native_libvlc_test.gui_chains_test()
- native_libvlc_test.psz_chains_test()
+++ /dev/null
-import unittest
-
-import native_libvlc_test
-
-class NativeStatsTestCase( unittest.TestCase ):
- def testTimers( self ):
- """[Stats] Test timers"""
- native_libvlc_test.timers_test()
+++ /dev/null
-import unittest
-
-import native_libvlc_test
-
-class NativeURLTestCase( unittest.TestCase ):
- def testurl_decode( self ):
- """[URL] Test url_decode and base64"""
- native_libvlc_test.url_test()
+++ /dev/null
-#import vlc
-#import unittest
-#
-#class BaseTestCase( unittest.TestCase ):
-# def testStartup(self):
-# """[PyMC] Check that VLC starts"""
-# mc = vlc.MediaControl( ['--quiet'])
-# mc.exit()
+++ /dev/null
-#import vlc
-#import unittest
-
-# FIXME: How to avoid creating / killing vlc for each test method ?
-
-#class VariablesTestCase( unittest.TestCase ):
-# """[PyMC] Test misc variables interaction"""
-# def setUp( self ):
-# self.mc = vlc.MediaControl( [ '--quiet'] )
-#
-#" def tearDown( self ):
-# self.mc.exit()
-#
-# def testSimple( self ):
-# """[PyMC] Check simple add"""
-# assert len( self.mc.playlist_get_list() ) == 0
-## self.mc.playlist_add_item( "test" )
-## assert len( self.mc.playlist_get_list() ) == 1
+++ /dev/null
-#import vlc
-#import unittest
-#
-## FIXME: Always segfault
-#
-#class VariablesTestCase( unittest.TestCase ):
-# """[PyMC] Test misc variables interaction"""
-# def setUp( self ):
-# print "broken"
-## self.mc = vlc.MediaControl( [ '--quiet'] )
-# # FIXME ! - Get this through children test
-## self.libvlc = vlc.Object(1)
-## self.playlist = vlc.Object(268)
-#
-# def tearDown( self ):
-# print "broken"
-## self.playlist.release()
-## self.libvlc.release()
-## self.mc.exit()
-#
-# # The Python binding can't create variables, so just get default ones
-# def testInt( self ):
-# """[PyMC] Get/Set integer variable"""
-# print "broken"
-## assert self.libvlc.get( "width" ) == 0
-## self.libvlc.set( "width", 42 )
-## assert self.libvlc.get( 'width' ) == 42
-#
-# # FIXME: Python binding should listen to return value and raise exception
-# def testInvalidInt( self ):
-# """[PyMC] Get/Set invalid integer"""
-# print "broken"
-## self.libvlc.set( "width" , 5 )
-## self.libvlc.set( "width", "foo" )
-## assert self.libvlc.get( "width" ) == -1
-#
-# def testString( self ):
-# """[PyMC] Get/Set string variable"""
-# print "broken"
-## assert self.libvlc.get( "open" ) == ''
-## self.libvlc.set( "open", "foo" )
-## assert self.libvlc.get( "open" ) == "foo"
-#
+++ /dev/null
-import logging
-import urllib2
-
-def getLogger( module ):
- logger = logging.getLogger( module )
- stl = logging.StreamHandler( )
- formatter = logging.Formatter( '%(asctime)s %(name)s %(levelname)s %(message)s' )
- stl.setFormatter( formatter )
- logger.addHandler( stl )
- logger.setLevel( logging.DEBUG )
- return logger
-
-def downloadFile( file, source, target, l ):
- l.info( "Opening %s/%s" % (source,file ) )
- try:
- remote = urllib2.urlopen( "%s/%s" % (source,file ) )
- l.debug( "Open success, downloading" )
- local = open( target + "/" + file, "w+" )
- local.write( remote.read() )
- except:
- return 1
- return 0
-
+++ /dev/null
-import VLCUtil
-import shutil
-import os
-from random import randint
-import glob
-
-# Todo
-# - Correctly handle errors
-# - Launch VLC in a separate thread and detect hangs
-# - Correct path handling
-
-global conf
-global l
-
-def play_mangled( filename, logfile ):
- os.chdir( "../.." )
- vlc_pid = os.spawnvp( os.P_NOWAIT, "./vlc",
- [ "vlc", "-I", "logger", "--quiet", "--stop-time", "1",
- filename , "vlc:quit", "--logfile", logfile ])
- ( exit_pid, exit_status ) = os.waitpid( vlc_pid, 0 )
- os.chdir( "test/mangle" )
- l.debug( "VLC exited with status %i" % exit_status )
- return exit_status
-
-def mangle_file( filename, header_size, percentage , new_file):
- shutil.copyfile( filename, new_file )
- file = open ( new_file, "r+" )
- for i in range( header_size ):
- file.seek( i)
- if( randint(0, 100/percentage) == 0 ):
- file.write( "%i" % randint (0, 255 ));
- file.flush()
- file.close()
-
-def process_file_once( file, header_size ):
- suffix = randint( 0, 65535 )
- new_file = conf["temp_folder"] + conf["prefix"] + "%i" % suffix
- log_file = conf["temp_folder"] + conf["log_prefix"] + "%i" % suffix
-
- mangle_file( file, header_size, conf["mangle_ratio"], new_file )
- status = play_mangled( new_file, log_file )
- if( status == 0 ):
- os.remove( new_file )
- os.remove( log_file )
- else:
- l.info( "Potential crash detected : %i, saving results" % suffix )
- try:
- shutil.move( new_file , conf["crashdir"] )
- shutil.move( log_file , conf["crashdir"] )
- except:
- l.error( "Unable to move file" )
-
-def process_file( file, source, header_size ):
- l.info( "Starting work on " + file )
-
- if( len( glob.glob( conf["inputdir"] + "/" + file ) ) == 0 ):
- l.warn( "%s does not exist in %s" % (file, conf["inputdir"] ) )
- if( VLCUtil.downloadFile( file, source, conf["inputdir"], l ) != 0 ):
- l.error( "Unable to download %s" % file )
- return
-
- for i in range( conf["loops"] ):
- process_file_once( conf["inputdir"] + "/" + file, header_size )
-
-l = VLCUtil.getLogger( "Mangle" )
-
-conf = {}
-conf["inputdir"] = "input"
-conf["crashdir"] = "crashers"
-conf["temp_folder"] = "/tmp/"
-conf["prefix"] = "mangle."
-conf["log_prefix"] = "vlc-log."
-conf["mangle_ratio"] = 4 # Change X% of bytes within header
-conf["loops"] = 20
-
-l.debug( "Creating folders" )
-
-try:
- os.makedirs( conf["crashdir"] )
- os.makedirs( conf["inputdir"] )
- os.makedirs( conf["temp_folder"] )
-except:
- pass
-
-
-##########
-process_file( "bl.mp4", "ftp://streams.videolan.org/streams-videolan/reference/mp4", 3000 )
-process_file( "Win98Crash.mov", "ftp://streams.videolan.org/streams-videolan/reference/mov", 3000 )
-process_file( "x264.avi", "ftp://streams.videolan.org/streams-videolan/reference/avi", 3000 )
-process_file( "batidadomontoya.wmv", "ftp://streams.videolan.org/streams-videolan/reference/asf", 3000 )
-process_file( "tarzan.ogm", "ftp://streams.videolan.org/streams-videolan/reference/ogm", 3000 )
-
+++ /dev/null
-#include <Python.h>
-
-extern int asserts;
-
-#define ASSERT( a, message ) asserts++;if( !(a) ) { fprintf( stderr, "Assert failed at %s:%i\n", __FILE__, __LINE__); PyErr_SetString( PyExc_AssertionError, message " - " #a ); return NULL; }
-
-#define DECLARE_MODULE( module ) PyMODINIT_FUNC init##module( void ) { \
- Py_InitModule( #module, module##_methods ); \
-}
-
-#define ASSERT_NOEXCEPTION asserts++; if( libvlc_exception_raised( &exception ) ) { \
- if( libvlc_exception_get_message( &exception ) ) PyErr_SetString( PyExc_AssertionError, libvlc_exception_get_message( &exception ) ); \
- else PyErr_SetString( PyExc_AssertionError, "Exception raised" ); return NULL; }
-
-#define ASSERT_EXCEPTION asserts ++; if( !libvlc_exception_raised( &exception ) ) { \
- if( libvlc_exception_get_message( &exception ) ) PyErr_SetString( PyExc_AssertionError, libvlc_exception_get_message( &exception ) ); \
- else PyErr_SetString( PyExc_AssertionError, "Exception not raised" ); return NULL; }
-
-
-#define DEF_METHOD( method, desc ) { #method, method, METH_VARARGS, desc},
+++ /dev/null
-from distutils.core import setup,Extension
-import os
-
-def get_vlcconfig():
- vlcconfig=None
- for n in ( 'vlc-config',
- os.path.sep.join( ( '..', 'vlc-config' ))):
- if os.path.exists(n):
- vlcconfig=n
- break
- if vlcconfig is None:
- print "*** Warning *** Cannot find vlc-config"
- elif os.sys.platform == 'win32':
- # Win32 does not know how to invoke the shell itself.
- vlcconfig="sh %s" % vlcconfig
- return vlcconfig
-
-def get_cflags():
- vlcconfig=get_vlcconfig()
- if vlcconfig is None:
- return []
- else:
- cflags=os.popen('%s --cflags' % vlcconfig, 'r').readline().rstrip().split()
- cflags.append( "-D__LIBVLC__")
- return cflags
-
-def get_ldflags():
- vlcconfig=get_vlcconfig()
- if vlcconfig is None:
- return []
- else:
- os.environ['top_builddir'] = '..'
- ldflags = []
- if os.sys.platform == 'darwin':
- ldflags = "-read_only_relocs warning".split()
- ldflags.extend(os.popen('%s --libs vlc builtin' % vlcconfig, 'r').readline().rstrip().split())
- if os.sys.platform == 'darwin':
- ldflags.append('-lstdc++')
- return ldflags
-
-# To compile in a local vlc tree
-native_libvlc_test = Extension( 'native_libvlc_test',
- sources = ['native/init.c', 'native/url.c', 'native/i18n.c',
- 'native/stats.c', 'native/libvlc.c', 'native/profiles.c',
- 'native/algo.c', 'native/threads.c'],
- include_dirs = ['../include', '../', '/usr/win32/include' ],
- extra_objects = [ '../src/.libs/libvlc.so', '../src/.libs/libvlc-control.so' ],
- extra_compile_args = get_cflags(),
- extra_link_args = [ '-L../..' ] + get_ldflags(),
- )
-
-native_gc_test = Extension( 'native_gc_test',
- sources = ['native/gc.c'],
- include_dirs = ['../include', '../', '/usr/win32/include' ],
- extra_objects = [ '../src/.libs/libvlc.so' ],
- extra_compile_args = get_cflags(),
- extra_link_args = [ '-L../..' ] + get_ldflags(),
- )
-
-setup( name = 'native_libvlc_test' ,version = '1242', ext_modules = [ native_libvlc_test ] )
-
-
-setup( name = 'native_gc_test' ,version = '1242', ext_modules = [ native_gc_test ] )
+++ /dev/null
-"""Regression testing framework
-
-This module will search for scripts in the same directory named
-XYZtest.py. Each such script should be a test suite that tests a
-module through PyUnit. (As of Python 2.1, PyUnit is included in
-the standard library as "unittest".) This script will aggregate all
-found test suites into one big test suite and run them all at once.
-"""
-
-import sys, os, re, unittest
-import native_libvlc_test
-
-
-def printAndRun( module ):
-# print "Running tests from module " + module.__name__;
- return unittest.defaultTestLoader.loadTestsFromModule( module )
-
-def regressionTest():
- path = os.path.abspath(os.path.dirname(sys.argv[0]))
- files = os.listdir(path)
- test = re.compile("test.py$", re.IGNORECASE)
- files = filter(test.search, files)
- filenameToModuleName = lambda f: os.path.splitext(f)[0]
- moduleNames = map(filenameToModuleName, files)
- modules = map(__import__, moduleNames)
-
- native_libvlc_test.init()
-
-# load = unittest.defaultTestLoader.loadTestsFromModule
- load = printAndRun
- return unittest.TestSuite(map(load, modules))
-
-if __name__ == "__main__":
- unittest.main(defaultTest="regressionTest")
+++ /dev/null
-#! /bin/sh
-
-set -e
-python setup.py build
-
-cd ..
-# TODO: FIXME !!
-export PYTHONPATH=$PYTHONPATH:bindings/mediacontrol-python/build/lib.linux-i686-2.3:test/build/lib.linux-i686-2.3:test/build/lib.linux-x86_64-2.3:test/build/lib.linux-i686-2.4:test/build/lib.linux-x86_64-2.4
-
-export LD_LIBRARY_PATH=src/.libs/
-
-# Always dump core
-ulimit -c unlimited
-
-if [ "x$1" = "xdebug" ]
-then
- gdb python "test/test.sh"
-else
- python test/test.py -v 2>&1|perl -e \
-'$bold = "\033[1m";
-$grey = "\033[37m";
-$green = "\033[32m";
-$blue = "\033[34m";
-$red = "\033[31m";
-$reset = "\033[0m";
-
-# Combinations
-$info = $reset;
-$ok = $green;
-$err = $red.$bold;
-
-while(<STDIN>)
-{
- $line = $_;
- chomp $line;
- if( $line =~ s/^(\[[A-z0-9]*\]\s.*)\.\.\.\sok$/$info$1\.\.\.$ok ok/g ||
- $line =~ s/^(\[[A-z0-9]*\]\s.*)\.\.\.\sFAIL$/$info$1\.\.\.$err FAIL/g||
- $line =~ s/^(\[[A-z0-9]*\]\s.*)\.\.\.(.)*$/$info$1\.\.\.$2/g ||
- $line =~ s/^(ok)$/$ok$1/ig || $line =~ s/^FAIL$/$err FAIL/g ||
- $line =~ s/(Ran\s.*)/$info$1/g )
- {
- print $line.$reset."\n";
- }
- else
- {
- print $grey.$line."\n";
- }
-}'
-fi