def test_gcc_ask(): f = localudir.join("y.c") f.write(""" #include <stdio.h> #include <test_gcc_ask.h> int main() { printf("hello\\n"); return 0; } """) dir1 = localudir.join('test_gcc_ask_dir1').ensure(dir=1) dir2 = localudir.join('test_gcc_ask_dir2').ensure(dir=1) dir1.join('test_gcc_ask.h').write('/* hello world */\n') dir2.join('test_gcc_ask.h').write('#error boom\n') eci = ExternalCompilationInfo(include_dirs=[str(dir1)]) # remove cache path = cache_file_path([f], eci, 'try_compile_cache') if path.check(): path.remove() assert try_compile_cache([f], eci) assert try_compile_cache([f], eci) assert build_executable_cache([f], eci) == "hello\n" eci2 = ExternalCompilationInfo(include_dirs=[str(dir2)]) err = py.test.raises(CompilationError, try_compile_cache, [f], eci2) print '<<<' print err print '>>>'
def ask_gcc(self, question): self.start_main() self.f.write(question + "\n") self.close() try_compile_cache([self.path], self.eci)
def ask_gcc(self, question): self.start_main() self.f.write(question + "\n") self.close() eci = self.config._compilation_info_ try_compile_cache([self.path], eci)