Beispiel #1
0
    def test_GetHeaderFiles(self):
        """
        test GetHeaderFiles
        """
        now_dir = os.getcwd()
        obj = 'get_header_files.o'
        infile = 'get_header_files.cpp'
        include = ['/usr/include', '/usr/local/include']
        compiler = '/usr/bin/g++'
        builder = Builder.ObjBuilder(obj, infile, include, None, compiler,
                                     now_dir)
        right_header_cmd = "/usr/bin/g++ \\\n\t-MM -MG\\\n\t-I/usr/include \
\\\n\t-I/usr/local/include \\\n\tget_header_files.cpp"

        self.assertEqual(right_header_cmd, builder.GetHeaderCmd())
        with open('hello.h', 'wb') as f:
            f.write("#include <stdio.h>\n\
void hello()\n\
{\n\
    print(\"hello - hello\");\n\
}\n")
        with open('world.h', 'wb') as f:
            f.write("#include <stdio.h>\n\
void world()\n\
{\n\
    print(\"hello - world\");\n\
}\n")
        with open('get_header_files.cpp', 'wb') as f:
            f.write("#include <stdio.h>\n\
#include <pthread.h>\n\
#include \"hello.h\"\n\
#include \"world.h\"\n\
int main()\n\
{\n\
    hello();\n\
    world();\n\
    return 0;\n\
}\n")
        ret = builder.CalcHeaderFiles()
        self.assertEqual(True, ret['ret'])
        self.assertEqual(sorted(["hello.h", 'world.h']),
                         sorted(builder.GetHeaderFiles()))

        Function.DelFiles('get_header_files.cpp')
        Function.DelFiles('hello.h')
        Function.DelFiles('world.h')
Beispiel #2
0
 def __del__(self):
     """
     """
     Function.DelFiles(self._broc_dir)