Build libpbd tests using waf.
authorCarl Hetherington <carl@carlh.net>
Fri, 2 Apr 2010 14:52:55 +0000 (14:52 +0000)
committerCarl Hetherington <carl@carlh.net>
Fri, 2 Apr 2010 14:52:55 +0000 (14:52 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6831 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/pbd/test/xpath.cc
libs/pbd/wscript

index 54b844f16c2376a791f8d21d6a754ff029fe4b8b..237bf8fa640b4219adeff71aa4f6c42e0454562e 100644 (file)
@@ -5,10 +5,12 @@
 
 using namespace std;
 
+string const prefix = "../../libs/pbd/test/";
+
 int main()
 {
        cout << "Test 1: RosegardenPatchFile.xml: Find all banks in the file" << endl;
-       XMLTree  doc("./RosegardenPatchFile.xml");
+       XMLTree  doc(prefix + "RosegardenPatchFile.xml");
        // "//bank" gives as last element an empty element libxml bug????
        boost::shared_ptr<XMLSharedNodeList> result = doc.root()->find("//bank[@name]");
        
@@ -38,7 +40,7 @@ int main()
        cout << endl << endl << "Test 3: TestSession.ardour: find all Sources where captured-for contains the string 'Guitar'" << endl;
        
        // We have to allocate a new document here, or we get segfaults
-       XMLTree doc2("./TestSession.ardour");
+       XMLTree doc2(prefix + "TestSession.ardour");
        result = doc2.root()->find("/Session/Sources/Source[contains(@captured-for, 'Guitar')]");
        assert(result->size() == 16);
        
@@ -62,7 +64,7 @@ int main()
        cout << endl << endl << "Test 5: ProtoolsPatchFile.midnam: Get Banks and Patches for 'Name Set 1'" << endl;
        
        // We have to allocate a new document here, or we get segfaults
-       XMLTree doc3("./ProtoolsPatchFile.midnam");
+       XMLTree doc3(prefix + "ProtoolsPatchFile.midnam");
        result = doc3.root()->find("/MIDINameDocument/MasterDeviceNames/ChannelNameSet[@Name='Name Set 1']/PatchBank");
        assert(result->size() == 16);
        
index 69839b907b24ba3dc65d24d609f40fd8defef67b..717fda8d4576c794c676c767f9c0c9d252b79bc5 100644 (file)
@@ -107,6 +107,17 @@ def build(bld):
        if bld.env['build_target'] == 'x86_64':
                obj.cxxflags += [ '-DUSE_X86_64_ASM' ]
 
+       if bld.env['BUILD_TESTS'] and bld.env['HAVE_CPPUNIT']:
+               # Unit tests
+               testobj              = bld.new_task_gen('cxx', 'program')
+               testobj.source       = '''
+                       test/xpath.cc
+               '''.split()
+               testobj.target       = 'run-tests'
+               testobj.includes     = obj.includes + ['test', '../pbd']
+               testobj.uselib       = 'XML'
+               testobj.uselib_local = 'libpbd'
+
 def shutdown():
        autowaf.shutdown()