#!/usr/bin/python Import('env') import sys, os, glob def scanFiles(pattern, paths) : files = [] for path in paths : files+=glob.glob(os.path.join(path,pattern)) return files def recursiveDirs(root) : return filter( (lambda a : a.rfind( ".svn")==-1 ), [ a[0] for a in os.walk(root)] ) def unique(list) : return dict.fromkeys(list).keys() folders = [ os.path.join('.'), os.path.join('CommonHelpers'), os.path.join('ControlsTests'), os.path.join('DescriptorsTests'), os.path.join('DynamicTypeTests'), os.path.join('FactoryTest'), os.path.join('FlowControlTests'), os.path.join('NonComponentData'), os.path.join('PortsTest'), os.path.join('ProcessingBaseTests'), os.path.join('ProcessingDataTests'), os.path.join('ProcessingsTests'), os.path.join('StandardTests'), os.path.join('TonalAnalysis'), os.path.join('ToolsTests'), os.path.join('TypedControlsTests'), os.path.join('XMLAdaptersTests'), os.path.join('VisualizationTests'), ] blacklist = [ os.path.join('.','TestRunnerQt.cxx'), os.path.join('FactoryTest','PolymorphicTest.cxx'), os.path.join('ProcessingsTests','AudioMixerTest.cxx'), os.path.join('TonalAnalysis','ChordCorrelatorTest.cxx'), # recognized labels not the current ones os.path.join('TonalAnalysis','ChordExtractorTest.cxx'), # last too long # TODO see for libxml? os.path.join('XMLAdaptersTests','LibXmlDomDocumentHandlerTest.cxx'), os.path.join('XMLAdaptersTests','LibXmlDomReaderTest.cxx'), os.path.join('XMLAdaptersTests','LibXmlDomReadingContextTest.cxx'), os.path.join('XMLAdaptersTests','LibXmlDomWriterTest.cxx'), os.path.join('XMLAdaptersTests','XercesDom2ClamObjectsTest.cxx'), os.path.join('XMLAdaptersTests','XercesDomDocumentHandlerTest.cxx'), os.path.join('DescriptorsTests','ProofOfConceptTest.cxx'), ] #folders = [ os.path.join('..','..','..','test', folder) for folder in folders ] #blacklist = [ os.path.join('..','..','..','test', blacksheep) for blacksheep in blacklist ] sources = scanFiles('*.cxx', folders) headers = scanFiles('*.hxx', folders) for blacksheep in blacklist : sources.remove(blacksheep) if sys.platform != 'win32' : env.Append( CPPPATH=['include'] ) unit_tests = env.Program( 'UnitTests', sources ) test_alias = Alias( 'run_unit_tests', [unit_tests], unit_tests[0].abspath ) AlwaysBuild( test_alias ) # Workaround to have only some unit-tests in a separate executable #simple_test = [ 'TestRunnerConsole.cxx', #'TypedControlsTests/TypedControlsTests.cxx' ] #simple_unit_tests = env.Program( 'simpleUnitTest', simple_test ) #simple_unit_tests_alias = Alias( 'simple_unit_tests', [simple_unit_tests], simple_unit_tests[0].abspath ) #AlwaysBuild( simple_unit_tests )