Example #1
0
def source_tree(testname):
    ret = Directory()

    source_lo = ret.add(name='lo', entry=Directory())
    source_lo.add(name=const.CONFIX2_PKG,
                  entry=File(lines=[
                      'PACKAGE_NAME("' + testname +
                      '-lo")', 'PACKAGE_VERSION("1.2.3")'
                  ]))
    source_lo.add(name=const.CONFIX2_DIR, entry=File())
    source_lo.add(
        name='lo.h',
        entry=File(lines=[
            '#ifndef lo_h', '#define lo_h', 'int the_answer();', '#endif'
        ]))
    source_lo.add(
        name='lo.cc',
        entry=File(
            lines=['#include "lo.h"', 'int the_answer() { return 42; }']))

    source_hi = ret.add(name='hi', entry=Directory())
    source_hi.add(name=const.CONFIX2_PKG,
                  entry=File(lines=[
                      'PACKAGE_NAME("' + testname +
                      '-hi")', 'PACKAGE_VERSION("1.2.3")'
                  ]))
    source_hi.add(name=const.CONFIX2_DIR, entry=File())
    source_hi.add(name='main.cc',
                  entry=File(lines=[
                      '#include <lo.h>', '#include <iostream>', 'int main() {',
                      '  std::cout << THE_ANSWER << std::endl;', '}'
                  ]))
    return ret
Example #2
0
    def test__sync_mem2sync(self):
        fs = FileSystem(path=self.rootpath())
        subdir = Directory(mode=0700)
        fs.rootdirectory().add(name='subdir', entry=subdir)
        file = File(mode=0755)
        subdir.add(name='file', entry=file)

        self.failUnlessEqual(fs.rootdirectory().state(),
                             DirectoryState.INMEMORY)
        self.failUnlessEqual(subdir.state(), DirectoryState.INMEMORY)
        self.failUnlessEqual(file.state(), FileState.NEW)

        fs.sync()

        self.failUnlessEqual(fs.rootdirectory().state(), DirectoryState.SYNC)
        self.failUnlessEqual(subdir.state(), DirectoryState.SYNC)
        self.failUnlessEqual(file.state(), FileState.SYNC_INMEM)

        self.failUnless(os.path.isdir(os.sep.join(self.rootpath())))
        self.failUnless(
            os.path.isdir(os.sep.join(self.rootpath() + ['subdir'])))
        self.failUnless(
            os.path.isfile(os.sep.join(self.rootpath() + ['subdir', 'file'])))

        self.failUnlessEqual(
            stat.S_IMODE(
                os.stat(os.sep.join(self.rootpath() + ['subdir'])).st_mode),
            0700)
        self.failUnlessEqual(
            stat.S_IMODE(
                os.stat(os.sep.join(self.rootpath() +
                                    ['subdir', 'file'])).st_mode), 0755)
        pass
Example #3
0
def lo_hi1_hi2_highest_exe(name, version):
    ret = Directory()

    ret.add(name=const.CONFIX2_PKG,
            entry=File(lines=[
                'PACKAGE_NAME("' + name + '")', 'PACKAGE_VERSION("' + version +
                '")'
            ]))
    ret.add(name=const.CONFIX2_DIR, entry=File())

    liblo = ret.add(name='lo', entry=Directory())
    liblo.add(name=const.CONFIX2_DIR, entry=File(lines=[]))
    liblo.add(
        name='lo.h',
        entry=File(
            lines=['#ifndef LO_H', '#  define LO_H', '#endif', 'void lo();']))
    liblo.add(name='lo.c', entry=File(lines=['void lo() {}']))

    libhi1 = ret.add(name='hi1', entry=Directory())
    libhi1.add(name=const.CONFIX2_DIR, entry=File(lines={}))
    libhi1.add(name='hi1.h',
               entry=File(lines=[
                   '#ifndef HI1_H', '#  define HI1_H', '#endif', 'void hi1();'
               ]))
    libhi1.add(
        name='hi1.c',
        entry=File(lines=[
            '#include <hi1.h>', '#include <lo.h>', 'void hi1() { lo(); }'
        ]))

    libhi2 = ret.add(name='hi2', entry=Directory())
    libhi2.add(name=const.CONFIX2_DIR, entry=File(lines=[]))
    libhi2.add(name='hi2.h',
               entry=File(lines=[
                   '#ifndef HI2_H', '#  define HI2_H', '#endif', 'void hi2();'
               ]))
    libhi2.add(
        name='hi2.c',
        entry=File(lines=[
            '#include <hi2.h>', '#include <lo.h>', 'void hi2() { lo(); }'
        ]))

    highest = ret.add(name='highest', entry=Directory())
    highest.add(name=const.CONFIX2_DIR, entry=File(lines=[]))
    highest.add(name='highest.c',
                entry=File(lines=[
                    '#include <hi1.h>', '#include <hi2.h>', 'void highest() {',
                    '    hi1();', '    hi2();', '}'
                ]))

    exe = ret.add(name='exe', entry=Directory())
    exe.add(name=const.CONFIX2_DIR, entry=File(lines=[]))
    exe.add(name='main.c',
            entry=File(lines=[
                '#include <hi1.h>', '#include <hi2.h>', 'int main(void) {',
                '    hi1();', '    hi2();', '    return 0;', '}'
            ]))
    return ret
Example #4
0
    def setUp(self):
        rootdirectory = Directory()
        rootdirectory.add(
            name=const.CONFIX2_PKG,
            entry=File(lines=[
                'PACKAGE_NAME("package-name")', 'PACKAGE_VERSION("1.2.3")'
            ]))
        rootdirectory.add(name=const.CONFIX2_DIR, entry=File())
        package = LocalPackage(rootdirectory=rootdirectory,
                               setups=[CMakeSetup()])
        package.boil(external_nodes=[])
        package.output()

        self.__cmakelists = find_cmake_output_builder(
            package.rootbuilder()).top_cmakelists()
        pass
Example #5
0
    def test__very_basic(self):
        fs = FileSystem(path=['a', 'b'])
        subdir = Directory()
        subdir.add(name='file', entry=File())
        fs.rootdirectory().add(name='subdir', entry=subdir)

        file = fs.rootdirectory().find(['subdir', 'file'])
        self.failIfEqual(file, None)
        self.failUnless(isinstance(file, File))

        self.assertEqual(subdir.abspath(), ['a', 'b', 'subdir'])
        self.assertEqual(subdir.relpath(fs.rootdirectory()), ['subdir'])

        self.assertRaises(Directory.AlreadyMounted,
                          fs.rootdirectory().add,
                          name='subdir',
                          entry=File())

        pass
Example #6
0
    def test__sync_dirty2sync(self):
        fs = FileSystem(path=self.rootpath())
        subdir = Directory(mode=0700)
        fs.rootdirectory().add(name='subdir', entry=subdir)
        file = File(mode=0755)
        subdir.add(name='file', entry=file)

        fs.sync()

        newfile = File()
        subdir.add(name='newfile', entry=newfile)
        self.failUnlessEqual(newfile.state(), FileState.NEW)

        fs.sync()

        self.failUnlessEqual(newfile.state(), FileState.SYNC_INMEM)
        self.failUnless(
            os.path.isfile(os.sep.join(self.rootpath() +
                                       ['subdir', 'newfile'])))

        pass
Example #7
0
    def test__library(self):
        rootdir = Directory()
        rootdir.add(
            name=const.CONFIX2_PKG,
            entry=File(lines=["PACKAGE_NAME('LibtoolInMemoryTest.testLibrary')",
                              "PACKAGE_VERSION('1.2.3')"]))
        rootdir.add(
            name=const.CONFIX2_DIR,
            entry=File(lines=["LIBRARY(members=[C(filename='file.c')])"]))
        rootdir.add(
            name='file.c',
            entry=File())

        package = LocalPackage(rootdirectory=rootdir,
                               setups=[ExplicitSetup(use_libtool=True)])
        package.boil(external_nodes=[])
        package.output()

        library_builder = None
        for b in package.rootbuilder().iter_builders():
            if isinstance(b, LibraryBuilder):
                self.failUnless(library_builder is None)
                library_builder = b
                pass
            pass
        self.failIf(library_builder is None)

        automake_output_builder = find_automake_output_builder(package.rootbuilder())
        self.failUnless('lib'+library_builder.basename()+'.la' in automake_output_builder.makefile_am().ltlibraries())
        pass
Example #8
0
    def test_basic(self):
        rootdirectory = Directory()
        rootdirectory.add(name=const.CONFIX2_PKG,
                          entry=File(lines=[
                              'PACKAGE_NAME("' + self.__class__.__name__ +
                              '")', 'PACKAGE_VERSION("1.2.3")'
                          ]))
        rootdirectory.add(name=const.CONFIX2_DIR, entry=File())

        lodir = rootdirectory.add(name='lo', entry=Directory())
        lodir.add(name=const.CONFIX2_DIR, entry=File())
        lodir.add(name='lo.h', entry=File())

        hidir = rootdirectory.add(name='hi', entry=Directory())
        hidir.add(name=const.CONFIX2_DIR, entry=File())
        hidir.add(name='hi.h', entry=File(lines=['#include <lo.h>']))

        user = rootdirectory.add(name='user', entry=Directory())
        user.add(name=const.CONFIX2_DIR, entry=File())
        user.add(name='user.c', entry=File(lines=['#include <hi.h>']))

        package = LocalPackage(rootdirectory=rootdirectory,
                               setups=[ConfixSetup(use_libtool=False)])
        package.boil(external_nodes=[])
        package.output()

        user_c_builder = package.rootbuilder().find_entry_builder(
            ['user', 'user.c'])
        self.failIf(user_c_builder is None)

        hi_pos = lo_pos = None
        for i in xrange(len(user_c_builder.native_local_include_dirs())):
            if user_c_builder.native_local_include_dirs()[i] == ['hi']:
                self.failUnless(hi_pos is None)
                hi_pos = i
                continue
            if user_c_builder.native_local_include_dirs()[i] == ['lo']:
                self.failUnless(lo_pos is None)
                lo_pos = i
                continue
            pass

        self.failIf(hi_pos is None)
        self.failIf(lo_pos is None)
        self.failIf(hi_pos > lo_pos)

        lo_h = package.rootbuilder().find_entry_builder(['lo', 'lo.h'])
        self.failUnlessEqual(lo_h.visibility(), [])
        self.failUnless(lo_h.public())
        self.failUnlessEqual(lo_h.package_visibility_action()[0],
                             HeaderBuilder.LOCALVISIBILITY_DIRECT_INCLUDE)
        self.failUnlessEqual(lo_h.package_visibility_action()[1], ['lo'])

        pass
Example #9
0
    def test__repo_install(self):
        rootdir = Directory()
        rootdir.add(
            name=const.CONFIX2_PKG,
            entry=File(
                lines=["PACKAGE_NAME('blah')", "PACKAGE_VERSION('1.2.3')"]))
        rootdir.add(name=const.CONFIX2_DIR, entry=File())

        package = LocalPackage(rootdirectory=rootdir,
                               setups=[
                                   ExplicitDirectorySetup(),
                                   AutomakeSetup(use_libtool=False)
                               ])
        package.boil(external_nodes=[])
        package.output()

        rootdir_output_builder = find_automake_output_builder(
            package.rootbuilder())
        self.failIf(rootdir_output_builder is None)

        self.failUnless('confixrepo' in rootdir_output_builder.makefile_am().
                        install_directories())

        pass
Example #10
0
def make_package():
    root = Directory()
    root.add(
        name=const.CONFIX2_PKG,
        entry=File(lines=[
            "PACKAGE_NAME('SimplePlainFileTest')", "PACKAGE_VERSION('1.2.3')"
        ]))
    root.add(
        name=const.CONFIX2_DIR,
        entry=File(lines=[
            "ADD_PLAINFILE(filename='plainfile_data', ",
            "              datadir=['subdir', 'data'])",  # list of path components
            "ADD_PLAINFILE(filename='plainfile_prefix',",
            "              prefixdir='subdir/prefix')",  # string
        ]))
    root.add(name='plainfile_data', entry=File())
    root.add(name='plainfile_prefix', entry=File())

    return root
Example #11
0
    def test(self):
        rootdirectory = Directory()
        rootdirectory.add(name=const.CONFIX2_PKG,
                          entry=File(lines=[
                              "PACKAGE_NAME('" + self.__class__.__name__ +
                              "')", "PACKAGE_VERSION('1.2.3')"
                          ]))
        rootdirectory.add(
            name=const.CONFIX2_DIR,
            entry=File(
                lines=["DIRECTORY(['include'])", "DIRECTORY(['source'])"]))

        include = rootdirectory.add(name='include', entry=Directory())
        include.add(
            name=const.CONFIX2_DIR,
            entry=File(lines=["H(filename='file.h', relocate_to=['source'])"]))
        include.add(name='file.h',
                    entry=File(lines=['#include <another_file.h>']))

        source = rootdirectory.add(name='source', entry=Directory())
        source.add(name=const.CONFIX2_DIR, entry=File(lines=[]))

        package = LocalPackage(rootdirectory=rootdirectory,
                               setups=[ExplicitSetup(use_libtool=False)])
        package.boil(external_nodes=[])

        include_builder = package.rootbuilder().find_entry_builder(
            path=['include'])
        source_builder = package.rootbuilder().find_entry_builder(
            path=['source'])

        self.failIf(include_builder is None)
        self.failIf(source_builder is None)

        # the include directory must not require anything - the only
        # builder was relocated to the source directory.
        for r in include_builder.requires():
            self.failIf(isinstance(r, Require_CInclude), r)
            pass

        # whereas the source directory must require the header that
        # file.h includes.
        for r in source_builder.requires():
            if isinstance(
                    r, Require_CInclude) and r.filename() == 'another_file.h':
                break
            pass
        else:
            self.fail()
            pass

        pass
Example #12
0
    def test(self):
        root = Directory()
        root.add(name=const.CONFIX2_PKG,
                 entry=File(lines=[
                     'PACKAGE_NAME("' + self.__class__.__name__ +
                     '")', 'PACKAGE_VERSION("1.2.3")'
                 ]))
        root.add(name=const.CONFIX2_DIR, entry=File())

        ext_lib = root.add(name='ext-lib', entry=Directory())
        ext_lib.add(name=const.CONFIX2_DIR,
                    entry=File(lines=[
                        'PROVIDE_H("ext_lib.h")',
                        'PKG_CONFIG_LIBRARY(packagename="ext_lib")'
                    ]))

        main = root.add(name='main', entry=Directory())
        main.add(name='main.cc',
                 entry=File(lines=[
                     '#include <ext_lib.h>',
                     '// CONFIX:REQUIRE_H("ext_lib.h", REQUIRED)',
                     '// CONFIX:EXENAME("the_exe")', 'int main() { return 0; }'
                 ]))
        main.add(name=const.CONFIX2_DIR, entry=File())

        package = LocalPackage(
            rootdirectory=root,
            setups=[ConfixSetup(use_libtool=False),
                    PkgConfigSetup()])
        package.boil(external_nodes=[])
        package.output()

        maindir_builder = package.rootbuilder().find_entry_builder(['main'])
        self.failIf(maindir_builder is None)

        maindir_output_builder = find_automake_output_builder(maindir_builder)
        self.failIf(maindir_output_builder is None)

        self.failUnless('$(ext_lib_PKG_CONFIG_CFLAGS)' in
                        maindir_output_builder.makefile_am().am_cflags())
        self.failUnless('$(ext_lib_PKG_CONFIG_CFLAGS)' in
                        maindir_output_builder.makefile_am().am_cxxflags())

        main_ldadd = maindir_output_builder.makefile_am().compound_ldadd(
            compound_name='the_exe')
        self.failIf(main_ldadd is None)

        self.failUnless('$(ext_lib_PKG_CONFIG_LIBS)' in main_ldadd)
        pass
Example #13
0
def make_package_source(package_name):
    sourcedir = Directory()
    sourcedir.add(name=const.CONFIX2_PKG,
                  entry=File(lines=[
                      "PACKAGE_NAME('" + package_name +
                      "')", "PACKAGE_VERSION('1.2.3')"
                  ]))
    sourcedir.add(name=const.CONFIX2_DIR,
                  entry=File(lines=[
                      "DIRECTORY(['include'])",
                      "DIRECTORY(['lib_implementation'])", "DIRECTORY(['exe'])"
                  ]))

    include = sourcedir.add(name='include', entry=Directory())
    include.add(
        name=const.CONFIX2_DIR,
        entry=File(
            lines=["H(filename='lib.h', relocate_to=['lib_implementation'])"]))
    include.add(
        name='lib.h',
        entry=File(
            lines=['#ifndef LIB_H', '#define LIB_H', 'void lib();', '#endif']))

    lo_implementation = sourcedir.add(name='lib_implementation',
                                      entry=Directory())
    lo_implementation.add(name=const.CONFIX2_DIR,
                          entry=File(lines=["CXX(filename='lib.cc')"]))
    lo_implementation.add(
        name='lib.cc', entry=File(lines=["#include <lib.h>", "void lib() {}"]))

    exe = sourcedir.add(name='exe', entry=Directory())
    exe.add(name=const.CONFIX2_DIR,
            entry=File(lines=["CXX(filename='main.cc')"]))
    exe.add(name='main.cc',
            entry=File(
                lines=["#include <lib.h>", "int main() {", "    lib();", "}"]))
    return sourcedir
Example #14
0
    def test_bad_namespace_and_no_idea_where_to_install(self):
        rootdirectory = Directory()
        rootdirectory.add(name=const.CONFIX2_PKG,
                          entry=File(lines=[
                              "PACKAGE_NAME('" + self.__class__.__name__ +
                              "')", "PACKAGE_VERSION('1.2.3')"
                          ]))
        rootdirectory.add(name=const.CONFIX2_DIR, entry=File())
        rootdirectory.add(name='file.h',
                          entry=File(lines=['namespace X {', '}']))

        package = LocalPackage(rootdirectory=rootdirectory,
                               setups=[ConfixSetup(use_libtool=False)])
        try:
            package.boil(external_nodes=[])
            package.output()
        except Error, e:
            self.failUnless(
                e.contains_error_of_type(libconfix.plugins.c.h.BadNamespace))
            pass
Example #15
0
    def test_from_root_directory(self):

        rootdirectory = Directory()
        rootdirectory.add(name=const.CONFIX2_PKG,
                          entry=File(lines=[
                              'PACKAGE_NAME("' + self.__class__.__name__ +
                              '")', 'PACKAGE_VERSION("1.2.3")'
                          ]))
        rootdirectory.add(name=const.CONFIX2_DIR, entry=File())
        file_h = rootdirectory.add(name='file.h', entry=File())
        file_h.set_property(name='INSTALLPATH_CINCLUDE', value=['x', 'y'])

        user = rootdirectory.add(name='user', entry=Directory())
        user.add(name=const.CONFIX2_DIR, entry=File())
        user.add(
            name='user.cc',
            entry=File(lines=[
                '#include <x/y/file.h>',
                '// CONFIX:REQUIRE_H(filename="x/y/file.h", urgency=REQUIRED)'
            ]))

        package = LocalPackage(rootdirectory=rootdirectory,
                               setups=[ConfixSetup(use_libtool=False)])
        package.boil(external_nodes=[])
        package.output()

        file_h_builder = package.rootbuilder().find_entry_builder(['file.h'])
        self.failIf(file_h_builder is None)
        self.failUnless(isinstance(file_h_builder, HeaderBuilder))

        self.failUnless(file_h_builder.visibility(), ['x', 'y'])
        self.failUnless(file_h_builder.public())
        self.failUnless(file_h_builder.package_visibility_action()[0] is
                        HeaderBuilder.LOCALVISIBILITY_INSTALL)
        self.failUnless(
            file_h_builder.package_visibility_action()[1] == ['x', 'y'])
        pass
Example #16
0
    def test__basic(self):
        sourcedir = Directory()
        sourcedir.add(name=const.CONFIX2_PKG,
                      entry=File(lines=[
                          "PACKAGE_NAME('" + self.__class__.__name__ +
                          "')", "PACKAGE_VERSION('1.2.3')"
                      ]))
        sourcedir.add(
            name=const.CONFIX2_DIR,
            entry=File(lines=[
                "DIRECTORY(['lolibrary'])", "DIRECTORY(['hilibrary'])",
                "DIRECTORY(['executable'])"
            ]))

        lolibrary_dir = sourcedir.add(name='lolibrary', entry=Directory())
        hilibrary_dir = sourcedir.add(name='hilibrary', entry=Directory())
        executable_dir = sourcedir.add(name='executable', entry=Directory())

        lolibrary_dir.add(name=const.CONFIX2_DIR,
                          entry=File(lines=[
                              "LIBRARY(members=[H(filename='lo.h'),",
                              "                 C(filename='lo1.c'),",
                              "                 C(filename='lo2.c')],",
                              "        basename='hansi')"
                          ]))
        lolibrary_dir.add(
            name='lo.h',
            entry=File(lines=[
                '#ifndef LO_H', '#define LO_H', '#ifdef __cplusplus',
                'extern "C" {', '#endif', 'void lo1(void);', 'void lo2(void);',
                '#ifdef __cplusplus', '}', '#endif', '#endif'
            ]))
        lolibrary_dir.add(
            name='lo1.c',
            entry=File(lines=['#include "lo.h"', 'void lo1(void) { lo2(); }']))
        lolibrary_dir.add(
            name='lo2.c',
            entry=File(lines=['#include "lo.h"', 'void lo2(void) {}']))

        hilibrary_dir.add(
            name=const.CONFIX2_DIR,
            entry=File(lines=[
                "LIBRARY(members=[H(filename='hi.h', install=['hi']),",
                "                 CXX(filename='hi.cc')])"
            ]))
        hilibrary_dir.add(
            name='hi.h',
            entry=File(lines=[
                "#ifndef HI_HI_H", "#define HI_HI_H", "void hi();", "#endif"
            ]))
        hilibrary_dir.add(
            name='hi.cc',
            entry=File(lines=[
                '#include "hi.h"', '#include <lo.h>', 'void hi() { lo1(); }'
            ]))

        executable_dir.add(name=const.CONFIX2_DIR,
                           entry=File(lines=[
                               "EXECUTABLE(exename='the_executable',",
                               "           center=CXX(filename='main.cc'))"
                           ]))
        executable_dir.add(name='main.cc',
                           entry=File(lines=[
                               '#include <hi/hi.h>', 'int main() {',
                               '    hi();', '    return 0;', '}'
                           ]))

        package = LocalPackage(rootdirectory=sourcedir,
                               setups=[ExplicitSetup(use_libtool=False)])
        package.boil(external_nodes=[])

        # see if we have got the directories right
        found_lodir_builder = package.rootbuilder().find_entry_builder(
            ['lolibrary'])
        self.failIf(found_lodir_builder is None)
        found_hidir_builder = package.rootbuilder().find_entry_builder(
            ['hilibrary'])
        self.failIf(found_hidir_builder is None)
        found_exedir_builder = package.rootbuilder().find_entry_builder(
            ['executable'])
        self.failIf(found_exedir_builder is None)

        # lodirectory has lolibrary has H(lo.h), C(lo1.c), C(lo2.c)
        # ---------------------------------------------------------

        # we called H() and C() in the directory's Confix2.dir, as
        # arguments of LIBRARY(). the side effect of this must have
        # been to add the corresponding source files to the directory.
        found_lo_lo_h = None
        found_lo_lo1_c = None
        found_lo_lo2_c = None
        for b in found_lodir_builder.iter_builders():
            if type(b) is HeaderBuilder and b.file().name() == 'lo.h':
                found_lo_lo_h = b
                pass
            if type(b) is CBuilder and b.file().name() == 'lo1.c':
                found_lo_lo1_c = b
                pass
            if type(b) is CBuilder and b.file().name() == 'lo2.c':
                found_lo_lo2_c = b
                pass
            pass
        self.failIf(found_lo_lo_h is None)
        self.failIf(found_lo_lo1_c is None)
        self.failIf(found_lo_lo2_c is None)

        # find the library itself and see if it has the right
        # properties.
        found_lolib_builder = None
        for b in found_lodir_builder.iter_builders():
            if type(b) is LibraryBuilder:
                self.failUnless(found_lolib_builder is None,
                                str(b))  # we build only one library
                found_lolib_builder = b
                pass
            pass
        self.failIf(found_lolib_builder is None)
        self.failUnless(found_lolib_builder.basename() == 'hansi')

        # see if it has the right members
        found_lo_lo_h = None
        found_lo_lo1_c = None
        found_lo_lo2_c = None
        for b in found_lolib_builder.members():
            if type(b) is HeaderBuilder and b.file().name() == 'lo.h':
                found_lo_lo_h = b
                continue
            if type(b) is CBuilder and b.file().name() == 'lo1.c':
                found_lo_lo1_c = b
                continue
            if type(b) is CBuilder and b.file().name() == 'lo2.c':
                found_lo_lo2_c = b
                continue
            pass
        self.failIf(found_lo_lo_h is None)
        self.failIf(found_lo_lo1_c is None)
        self.failIf(found_lo_lo2_c is None)

        pass
Example #17
0
def make_source(classname):
    common = Directory()
    common.add(name=const.CONFIX2_PKG,
               entry=File(lines=[
                   'PACKAGE_NAME("' + classname +
                   '-common")', 'PACKAGE_VERSION("2.3.4")'
               ]))
    common.add(name=const.CONFIX2_DIR, entry=File())
    common.add(name='common.h',
               entry=File(lines=[
                   '#ifndef COMMON_H', '#define COMMON_H',
                   'void common(void);', '#endif'
               ]))
    common.add(
        name='common.c',
        entry=File(lines=['#include "common.h"', 'void common(void) {}']))

    lo = Directory()
    lo.add(name=const.CONFIX2_PKG,
           entry=File(lines=[
               'PACKAGE_NAME("' + classname +
               '-lo")', 'PACKAGE_VERSION("6.6.6")'
           ]))
    lo.add(name=const.CONFIX2_DIR, entry=File())
    lo_include = lo.add(name='include', entry=Directory())
    lo_include.add(
        name=const.CONFIX2_DIR,
        entry=File(lines=[
            'RELOCATE_HEADER(filename="lo.h", directory=["source"])',
            '# require the header, begging for early', '# errors',
            'REQUIRE_H(filename="common.h", urgency=URGENCY_ERROR)'
        ]))
    lo_include.add(name='lo.h',
                   entry=File(lines=[
                       '#ifndef LO_H', '#define LO_H',
                       '/* just for fun (or if we dont test it elsewhere): */',
                       '/*   require something from a relocated header */',
                       '#include <common.h>', 'void lo(void);', '#endif'
                   ]))
    lo_source = lo.add(name='source', entry=Directory())
    lo_source.add(name=const.CONFIX2_DIR,
                  entry=File(lines=[
                      '# require the header, begging for early', '# errors',
                      'REQUIRE_H(filename="common.h", urgency=URGENCY_ERROR)',
                      '# this one is internal - requre it just for fun',
                      'REQUIRE_H(filename="lo.h", urgency=URGENCY_ERROR)'
                  ]))
    lo_source.add(name='lo.c',
                  entry=File(lines=[
                      '#include "lo.h"', '#include <common.h>',
                      'void lo(void) {', '    (void)common();', '}'
                  ]))

    hi = Directory()
    hi.add(name=const.CONFIX2_PKG,
           entry=File(lines=[
               'PACKAGE_NAME("' + classname +
               '-hi")', 'PACKAGE_VERSION("1.2.3")'
           ]))
    hi.add(name=const.CONFIX2_DIR, entry=File())
    hi.add(name='hi.c',
           entry=File(lines=[
               '#include <lo.h>', '#include <common.h>', 'int main(void) {',
               '    (void)lo();', '    (void)common();', '    return 0;'
               '}'
           ]))

    return (common, lo, hi)
Example #18
0
    def setUp(self):
        PersistentTestCase.setUp(self)
        self.sourcedir_ = self.rootpath() + ['source']
        self.builddir_ = self.rootpath() + ['build']
        self.installdir_ = self.rootpath() + ['install']
        self.lo_sourcedir_ = self.sourcedir_ + ['lo']
        self.lo_builddir_ = self.builddir_ + ['lo']
        self.hi_sourcedir_ = self.sourcedir_ + ['hi']
        self.hi_builddir_ = self.builddir_ + ['hi']

        lo_root = Directory()
        lo_root.add(
            name=const.CONFIX2_PKG,
            entry=File(
                lines=['PACKAGE_NAME("lo")', 'PACKAGE_VERSION("1.2.3")']))
        lo_root.add(
            name=const.CONFIX2_DIR,
            # we actually do nothing intelligent here but to
            # test the marshalling of buildinfo (which is not
            # strictly the target of this particular test, but
            # I'm too lazy to make an extra test of it)
            entry=File(lines=[
                'CONFIGURE_AC(lines=["  "],',
                '             order=AC_PROGRAMS)', 'ACINCLUDE_M4(lines=["  "])'
            ]))
        lo_h = lo_root.add(name='lo.h',
                           entry=File(lines=[
                               '#ifndef lo_lo_h',
                               '#define lo_lo_h',
                               'void lo();',
                               '#endif',
                           ]))
        lo_h.set_property(name='INSTALLPATH_CINCLUDE', value=['lo'])
        lo_root.add(name='lo.c',
                    entry=File(lines=['#include "lo.h"', 'void lo() {}']))
        self.lo_fs_ = FileSystem(path=self.lo_sourcedir_,
                                 rootdirectory=lo_root)

        self.lo_package_ = LocalPackage(
            rootdirectory=self.lo_fs_.rootdirectory(),
            setups=[ConfixSetup(use_libtool=self.use_libtool())])

        hi_root = Directory()
        hi_root.add(
            name=const.CONFIX2_PKG,
            entry=File(
                lines=['PACKAGE_NAME("hi")', 'PACKAGE_VERSION("4.5.6")']))
        hi_root.add(name=const.CONFIX2_DIR, entry=File())
        lib = hi_root.add(name='lib', entry=Directory())
        lib.add(name=const.CONFIX2_DIR, entry=File())
        lib.add(name='hilib.h',
                entry=File(lines=[
                    '#ifndef hi_hilib_h', '#define hi_hilib_h',
                    'void hilib();', '#endif'
                ]))
        lib.add(name='hilib.c',
                entry=File(lines=[
                    '#include "hilib.h"', '#include <stdio.h>',
                    'void hilib() {', r'    printf("hilib();\n");', '}'
                ]))
        bin = hi_root.add(name='bin', entry=Directory())
        bin.add(name=const.CONFIX2_DIR, entry=File())
        bin.add(name='main.c',
                entry=File(lines=[
                    '#include <lo/lo.h>', '#include <hilib.h>',
                    '// URGENCY_ERROR: detect errors as early as possible ',
                    '// (keeping test-and-fix cycles low)',
                    '// CONFIX:REQUIRE_H("lo/lo.h", URGENCY_ERROR)',
                    '// CONFIX:REQUIRE_H("hilib.h", URGENCY_ERROR)', '',
                    'int main() {', '  lo();', '  hilib();', '  return 0;', '}'
                ]))

        self.hi_fs_ = FileSystem(path=self.hi_sourcedir_,
                                 rootdirectory=hi_root)
        self.hi_package_ = LocalPackage(
            rootdirectory=self.hi_fs_.rootdirectory(),
            setups=[ConfixSetup(use_libtool=self.use_libtool())])

        pass
Example #19
0
def make_source_tree():
    rootdirectory = Directory()

    lo_source = rootdirectory.add(name='lo', entry=Directory())
    lo_source.add(
        name=const.CONFIX2_PKG,
        entry=File(lines=['PACKAGE_NAME("lo")', 'PACKAGE_VERSION("1.2.3")']))
    lo_source.add(
        name=const.CONFIX2_DIR,
        entry=File(lines=[
            'LIBRARY(basename="lo", members=[H(filename="lo.h"), C(filename="lo.c")])'
        ]))
    lo_source.add(
        name='lo.h',
        entry=File(
            lines=['#ifndef LO_H', '#define LO_H', 'void lo();', '#endif']))
    lo_source.add(name='lo.c',
                  entry=File(lines=['#include "lo.h"', 'void lo() {}']))

    mid_source = rootdirectory.add(name='mid', entry=Directory())
    mid_source.add(
        name=const.CONFIX2_PKG,
        entry=File(lines=['PACKAGE_NAME("mid")', 'PACKAGE_VERSION("6.6.6")']))
    mid_source.add(
        name=const.CONFIX2_DIR,
        entry=File(lines=[
            'LIBRARY(basename="mid", members=[H(filename="mid.h"), C(filename="mid.c")])'
        ]))
    mid_source.add(
        name='mid.h',
        entry=File(
            lines=['#ifndef MID_H', '#define MID_H', 'void mid();', '#endif']))
    mid_source.add(
        name='mid.c',
        entry=File(lines=[
            '#include "mid.h"',
            # spot bugs *really* early
            '// CONFIX:REQUIRE_H("lo.h", REQUIRED)',
            '#include <lo.h>',
            'void mid() { lo(); }'
        ]))

    hi_source = rootdirectory.add(name='hi', entry=Directory())
    hi_source.add(
        name=const.CONFIX2_PKG,
        entry=File(lines=['PACKAGE_NAME("hi")', 'PACKAGE_VERSION("2.3.4")']))
    hi_source.add(
        name=const.CONFIX2_DIR,
        entry=File(
            lines=['EXECUTABLE(exename="exe", center=C(filename="main.c"))']))
    hi_source.add(
        name='main.c',
        entry=File(lines=[
            '#include <mid.h>',
            '#include <lo.h>',
            '#include <stdio.h>',
            '',
            # spot bugs *really* early
            '// CONFIX:REQUIRE_H("mid.h", REQUIRED)',
            '// CONFIX:REQUIRE_H("lo.h", REQUIRED)',
            '',
            'int main(void) {',
            r'    printf("main was here\n");',
            '    mid();',
            '}'
        ]))

    return rootdirectory
    def test__basic(self):
        source = Directory()
        source.add(
            name=const.CONFIX2_PKG,
            entry=File(lines=[
                'PACKAGE_NAME("Local-Install")', 'PACKAGE_VERSION("1.2.3")'
            ]))
        source.add(
            name=const.CONFIX2_DIR,
            entry=File(lines=[
                'DIRECTORY(["headers-only"])',
                'DIRECTORY(["headers-with-library"])', 'DIRECTORY(["exe"])'
            ]))

        headers_only = source.add(name='headers-only', entry=Directory())
        headers_with_library = source.add(name='headers-with-library',
                                          entry=Directory())
        exe = source.add(name='exe', entry=Directory())

        headers_only.add(
            name=const.CONFIX2_DIR,
            entry=File(lines=[
                'H(filename="header-1.h", install=["headers-only-install"])',
                'H(filename="header-2.h", install=["headers-only-install"])'
            ]))
        headers_only.add(name='header-1.h', entry=File())
        headers_only.add(name='header-2.h', entry=File())

        headers_with_library.add(
            name=const.CONFIX2_DIR,
            entry=File(lines=[
                'LIBRARY(members=[H(filename="library-1.h", install=["headers-with-library-install"]),'
                '                 H(filename="library-2.h", install=["headers-with-library-install"]),'
                '                 C(filename="library-1.c"),'
                '                 C(filename="library-2.c")',
                '                ]', '       )'
            ]))
        headers_with_library.add(name='library-1.h',
                                 entry=File(lines=['void library1(void);']))
        headers_with_library.add(name='library-2.h',
                                 entry=File(lines=['void library2(void);']))
        headers_with_library.add(
            name='library-1.c',
            entry=File(lines=[
                '#include <headers-only-install/header-1.h>',
                'void library1(void) {}'
            ]))
        headers_with_library.add(
            name='library-2.c',
            entry=File(lines=[
                '#include <headers-only-install/header-2.h>',
                'void library2(void) {}'
            ]))

        exe.add(name=const.CONFIX2_DIR,
                entry=File(lines=[
                    'EXECUTABLE(exename="exe",',
                    '           center=C(filename="main.c"))',
                ]))
        exe.add(
            name='main.c',
            entry=File(lines=[
                '#include <headers-only-install/header-1.h>',
                '#include <headers-only-install/header-2.h>',
                '#include <headers-with-library-install/library-1.h>',
                '#include <headers-with-library-install/library-2.h>',
                'int main(void) {', '    library1();', '    library2();', '}'
            ]))

        fs = FileSystem(path=self.rootpath())
        source = fs.rootdirectory().add(name='source', entry=source)
        build = fs.rootdirectory().add(name='build', entry=Directory())

        package = LocalPackage(
            rootdirectory=source,
            setups=[ExplicitDirectorySetup(),
                    ExplicitCSetup(),
                    CMakeSetup()])
        package.boil(external_nodes=[])
        package.output()

        fs.sync()

        commands.cmake(packageroot=source.abspath(),
                       builddir=build.abspath(),
                       args=[])
        commands.make(builddir=build.abspath(), args=[])

        scan.rescan_dir(build)

        # I doubt that this will hold under Windows :-) if it becomes
        # an issue we will skip this check
        self.failUnless(build.find(['exe', 'exe']))

        pass
Example #21
0
def make_package_source(package_name):
    sourcedir = Directory()
    sourcedir.add(name=const.CONFIX2_PKG,
                  entry=File(lines=[
                      "PACKAGE_NAME('" + package_name +
                      "')", "PACKAGE_VERSION('1.2.3')"
                  ]))
    sourcedir.add(name=const.CONFIX2_DIR,
                  entry=File(lines=[
                      "DIRECTORY(['lolibrary'])", "DIRECTORY(['hilibrary'])",
                      "DIRECTORY(['executable'])"
                  ]))

    lolibrary_dir = sourcedir.add(name='lolibrary', entry=Directory())
    hilibrary_dir = sourcedir.add(name='hilibrary', entry=Directory())
    executable_dir = sourcedir.add(name='executable', entry=Directory())

    lolibrary_dir.add(name=const.CONFIX2_DIR,
                      entry=File(lines=[
                          "LIBRARY(members=[H(filename='lo.h'),",
                          "                 C(filename='lo1.c'),",
                          "                 C(filename='lo2.c')],",
                          "        basename='hansi')"
                      ]))
    lolibrary_dir.add(
        name='lo.h',
        entry=File(lines=[
            '#ifndef LO_H', '#define LO_H', '#ifdef __cplusplus',
            'extern "C" {', '#endif', 'void lo1(void);', 'void lo2(void);',
            '#ifdef __cplusplus', '}', '#endif', '#endif'
        ]))
    lolibrary_dir.add(
        name='lo1.c',
        entry=File(lines=['#include "lo.h"', 'void lo1(void) { lo2(); }']))
    lolibrary_dir.add(
        name='lo2.c',
        entry=File(lines=['#include "lo.h"', 'void lo2(void) {}']))

    hilibrary_dir.add(
        name=const.CONFIX2_DIR,
        entry=File(lines=[
            "LIBRARY(members=[H(filename='hi.h', install=['hi']),",
            "                 CXX(filename='hi.cc')])"
        ]))
    hilibrary_dir.add(
        name='hi.h',
        entry=File(lines=[
            "#ifndef HI_HI_H", "#define HI_HI_H", "void hi();", "#endif"
        ]))
    hilibrary_dir.add(
        name='hi.cc',
        entry=File(lines=[
            '#include "hi.h"', '#include <lo.h>', 'void hi() { lo1(); }'
        ]))

    executable_dir.add(name=const.CONFIX2_DIR,
                       entry=File(lines=[
                           "EXECUTABLE(exename='the_executable',",
                           "           center=CXX(filename='main.cc'))"
                       ]))
    executable_dir.add(name='main.cc',
                       entry=File(lines=[
                           '#include <hi/hi.h>', 'int main() {', '    hi();',
                           '    return 0;', '}'
                       ]))

    return sourcedir
Example #22
0
def make_source_tree():
    rootdirectory = Directory()
    rootdirectory.add(
        name=const.CONFIX2_PKG,
        entry=File(lines=['PACKAGE_NAME("intra-package")',
                          'PACKAGE_VERSION("1.2.3")']))
    rootdirectory.add(
        name=const.CONFIX2_DIR,
        entry=File(lines=['DIRECTORY(["lo"])',
                          'DIRECTORY(["hi"])',
                          'DIRECTORY(["exe"])']))
    lo = rootdirectory.add(
        name='lo',
        entry=Directory())
    lo.add(
        name=const.CONFIX2_DIR,
        entry=File(lines=['LIBRARY(basename="lo",',
                          '        members=[H(filename="lo1.h"),',
                          '                 C(filename="lo1.c"),'
                          '                 H(filename="lo2.h"),'
                          '                 C(filename="lo2.c")])']))
    lo.add(
        name='lo1.h',
        entry=File(lines=['#ifndef LO1_h',
                          '#define LO1_h',
                          'extern void lo1();',
                          '#endif']))
    lo.add(
        name='lo1.c',
        entry=File(lines=['#include "lo1.h"',
                          'void lo1() {}']))
    lo.add(
        name='lo2.h',
        entry=File(lines=['#ifndef LO2_h',
                          '#define LO2_h',
                          'extern void lo2();',
                          '#endif']))
    lo.add(
        name='lo2.c',
        entry=File(lines=['#include "lo2.h"',
                          'void lo2() {}']))

    hi = rootdirectory.add(
        name='hi',
        entry=Directory())
    hi.add(
        name=const.CONFIX2_DIR,
        entry=File(lines=['LIBRARY(basename="hi",',
                          '        members=[H(filename="hi1.h"),',
                          '                 C(filename="hi1.c"),'
                          '                 H(filename="hi2.h"),'
                          '                 C(filename="hi2.c")])']))
    hi.add(
        name='hi1.h',
        entry=File(lines=['#ifndef HI1_H',
                          '#define HI1_H',
                          'extern void hi1();',
                          '#endif']))
    hi.add(
        name='hi1.c',
        entry=File(lines=['#include "hi1.h"',
                          '#include <lo1.h>',
                          'void hi1() { lo1(); }']))
    hi.add(
        name='hi2.h',
        entry=File(lines=['#ifndef HI2_H',
                          '#define HI2_H',
                          'extern void hi2();',
                          '#endif']))
    hi.add(
        name='hi2.c',
        entry=File(lines=['#include "hi2.h"',
                          '#include <lo2.h>',
                          'void hi2() { lo2(); }']))

    exe = rootdirectory.add(
        name='exe',
        entry=Directory())
    exe.add(
        name=const.CONFIX2_DIR,
        entry=File(lines=['EXECUTABLE(exename="exe",',
                          '           center=C(filename="main.c"),',
                          '           members=[H(filename="require_lo.h"),',
                          '                    C(filename="require_lo.c"),',
                          '                    H(filename="require_hi.h"),',
                          '                    C(filename="require_hi.c")])']))
    exe.add(
        name='require_lo.h',
        entry=File(lines=['#ifndef REQUIRE_LO_H',
                          '#define REQUIRE_LO_H',
                          'extern void require_lo1();',
                          'extern void require_lo2();',
                          '#endif']))
    exe.add(
        name='require_lo.c',
        entry=File(lines=['#include "require_lo.h"',
                          '#include <lo1.h>',
                          '#include <lo2.h>',
                          'void require_lo1() { lo1(); }',
                          'void require_lo2() { lo2(); }']))
    exe.add(
        name='require_hi.h',
        entry=File(lines=['#ifndef REQUIRE_HI_H',
                          '#define REQUIRE_HI_H',
                          'extern void require_hi1();',
                          'extern void require_hi2();',
                          '#endif']))
    exe.add(
        name='require_hi.c',
        entry=File(lines=['#include "require_hi.h"',
                          '#include <hi1.h>',
                          '#include <hi2.h>',
                          'void require_hi1() { hi1(); }',
                          'void require_hi2() { hi2(); }']))
    exe.add(
        name='main.c',
        entry=File(lines=['#include "require_lo.h"',
                          '#include "require_hi.h"',
                          'int main() {',
                          '    require_lo1();',
                          '    require_lo2();',
                          '    require_hi1();',
                          '    require_hi2();',
                          '}']))

    return rootdirectory
    def test(self):
        source = Directory()
        source.add(
            name=const.CONFIX2_PKG,
            entry=File(lines=[
                'PACKAGE_NAME("Public-Install")', 'PACKAGE_VERSION("1.2.3")'
            ]))
        source.add(name=const.CONFIX2_DIR,
                   entry=File(lines=[
                       'DIRECTORY(["headers"])', 'DIRECTORY(["library"])',
                       'DIRECTORY(["exe"])', 'DIRECTORY(["test"])'
                   ]))

        headers = source.add(name='headers', entry=Directory())
        library = source.add(name='library', entry=Directory())
        exe = source.add(name='exe', entry=Directory())
        test = source.add(name='test', entry=Directory())

        headers.add(name=const.CONFIX2_DIR,
                    entry=File(lines=[
                        'H(filename="flat-header.h")',
                        'H(filename="subdir-header.h", install=["subdir"])',
                    ]))
        headers.add(name='flat-header.h', entry=File())
        headers.add(name='subdir-header.h', entry=File())

        library.add(
            name=const.CONFIX2_DIR,
            entry=File(lines=[
                'LIBRARY(basename="rary", members=[C(filename="library.c")])'
            ]))
        library.add(name='library.c', entry=File())

        exe.add(name=const.CONFIX2_DIR,
                entry=File(lines=[
                    'EXECUTABLE(exename="exe",',
                    '           center=C(filename="main.c"))',
                ]))
        exe.add(name='main.c',
                entry=File(lines=['int main(void) { return 0; }']))

        test.add(name=const.CONFIX2_DIR,
                 entry=File(lines=[
                     'EXECUTABLE(exename="test",',
                     '           center=C(filename="main.c"),',
                     '           what=EXECUTABLE_CHECK)',
                 ]))
        test.add(name='main.c',
                 entry=File(lines=['int main(void) { return 0; }']))

        fs = FileSystem(path=self.rootpath())
        source = fs.rootdirectory().add(name='source', entry=source)
        build = fs.rootdirectory().add(name='build', entry=Directory())
        install = fs.rootdirectory().add(name='install', entry=Directory())

        package = LocalPackage(
            rootdirectory=source,
            setups=[ExplicitDirectorySetup(),
                    ExplicitCSetup(),
                    CMakeSetup()])
        package.boil(external_nodes=[])
        package.output()

        fs.sync()

        commands.cmake(
            packageroot=source.abspath(),
            builddir=build.abspath(),
            args=['-DCMAKE_INSTALL_PREFIX=' + os.sep.join(install.abspath())])
        commands.make(builddir=build.abspath(), args=['install'])

        scan.rescan_dir(install)

        self.failUnless(install.find(['include', 'flat-header.h']))
        self.failUnless(install.find(['include', 'subdir', 'subdir-header.h']))

        # if this fails, then you probably are running on Windows.
        self.failUnless(install.find(['lib', 'library.a']))
        self.failUnless(install.find(['bin', 'exe']))
        self.failIf(install.find(['bin', 'test']))

        self.failUnless(
            install.find([
                'share',
                'confix-%s' % const.REPO_VERSION, 'repo',
                package.repofilename()
            ]))

        pass
Example #24
0
def subdir(parent, name):
    dir = Directory()
    dir.add(name=const.CONFIX2_DIR, entry=File())
    parent.add(name=name, entry=dir)
    return dir
    def test(self):
        # boil and install lo
        if True:
            losource = Directory()
            losource.add(name=const.CONFIX2_PKG,
                         entry=File(lines=['PACKAGE_NAME("lo")',
                                           'PACKAGE_VERSION("6.6.6")']))
            losource.add(name=const.CONFIX2_DIR,
                         entry=File(lines=['LIBRARY(members=[H(filename="lo.h"), C(filename="lo.c")])']))
            
            losource.add(name='lo.h', entry=File())
            losource.add(name='lo.c', entry=File())
            local_lopkg = LocalPackage(rootdirectory=losource,
                                       setups=[ExplicitDirectorySetup(), ExplicitCSetup()])
            local_lopkg.boil(external_nodes=[])
            installed_lopkg = local_lopkg.install()
            pass
        
        # boil hi, referencing things from lo.
        if True:
            hisource = Directory()
            hisource.add(name=const.CONFIX2_PKG,
                         entry=File(lines=['PACKAGE_NAME("hi")',
                                           'PACKAGE_VERSION("0.0.1")']))
            hisource.add(name=const.CONFIX2_DIR,
                         entry=File(lines=['LIBRARY(members=[C(filename="hi.c")])']))
            
            hisource.add(name='hi.c',
                         entry=File(lines=['#include <lo.h>']))
            local_hipkg = LocalPackage(rootdirectory=hisource,
                                       setups=[ExplicitDirectorySetup(), ExplicitCSetup()])
            local_hipkg.boil(external_nodes=installed_lopkg.nodes())
            pass

        lo_h_builder = local_lopkg.rootbuilder().find_entry_builder(['lo.h'])
        lo_c_builder = local_lopkg.rootbuilder().find_entry_builder(['lo.c'])
        liblo_builder = None
        for b in local_lopkg.rootbuilder().iter_builders():
            if isinstance(b, LibraryBuilder):
                liblo_builder = b
                break
            pass
        else:
            self.fail()
            pass

        hi_c_builder = local_hipkg.rootbuilder().find_entry_builder(['hi.c'])
        libhi_builder = None
        for b in local_hipkg.rootbuilder().iter_builders():
            if isinstance(b, LibraryBuilder):
                libhi_builder = b
                break
            pass
        else:
            self.fail()
            pass

        # hi.c includes lo.h, so it must have a BuildInfo for
        # installed header files, but none for local header files.
        self.failUnless(hi_c_builder.using_native_installed() > 0)
        self.failUnless(len(hi_c_builder.native_local_include_dirs()) == 0)
        self.failUnless(len(libhi_builder.direct_libraries()) == 1)
        self.failUnless(len(libhi_builder.topo_libraries()) == 1)
        self.failUnless(isinstance(libhi_builder.direct_libraries()[0],
                                   BuildInfo_CLibrary_NativeInstalled))
        self.failUnless(isinstance(libhi_builder.topo_libraries()[0],
                                   BuildInfo_CLibrary_NativeInstalled))
        self.failUnless(libhi_builder.topo_libraries()[0] is \
                        libhi_builder.direct_libraries()[0])                        
        self.failUnless(libhi_builder.direct_libraries()[0].basename() == 'lo')

        pass