Exemplo n.º 1
0
    def test_expandlibsdeps(self):
        '''Test library expansion for dependencies'''
        # Dependency list for a library with a descriptor is equivalent to
        # the arguments expansion, to which we add each descriptor
        args = self.arg_files + [self.tmpfile('liby', Lib('y'))]
        self.assertRelEqual(
            ExpandLibsDeps(args),
            ExpandArgs(args) + [
                self.tmpfile('libx',
                             Lib('x') + config.LIBS_DESC_SUFFIX),
                self.tmpfile('liby',
                             Lib('y') + config.LIBS_DESC_SUFFIX)
            ])

        # When a library exists at the same time as a descriptor, the
        # descriptor is not a dependency
        self.touch([self.tmpfile('libx', Lib('x'))])
        args = self.arg_files + [self.tmpfile('liby', Lib('y'))]
        self.assertRelEqual(
            ExpandLibsDeps(args),
            ExpandArgs(args) +
            [self.tmpfile('liby',
                          Lib('y') + config.LIBS_DESC_SUFFIX)])

        self.touch([self.tmpfile('liby', Lib('y'))])
        args = self.arg_files + [self.tmpfile('liby', Lib('y'))]
        self.assertRelEqual(ExpandLibsDeps(args), ExpandArgs(args))
Exemplo n.º 2
0
    def test_expand(self):
        '''Test library expansion'''
        # Expanding arguments means libraries with a descriptor are expanded
        # with the descriptor content, and import libraries are used when
        # a library doesn't exist
        args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
        self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files) 

        # When a library exists at the same time as a descriptor, we just use
        # the library
        self.touch([self.tmpfile('libx', Lib('x'))])
        args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
        self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + [self.tmpfile('libx', Lib('x'))]) 

        self.touch([self.tmpfile('liby', Lib('y'))])
        args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
        self.assertRelEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))])