gradle-plugin: Add tests for headerFilterAdditionalSearchPrefixes

This commit is contained in:
Ilya Matveev
2017-11-16 16:29:11 +07:00
committed by ilmat192
parent 5c05891ba7
commit e4fc1eda7c
2 changed files with 29 additions and 0 deletions
@@ -196,6 +196,19 @@ class IncrementalSpecification extends BaseKonanSpecification {
"noDefaultLibs" | "true"
}
def 'headerFilterAdditionalSearchPrefix change should cause recompilation and interop reprocessing'() {
when:
def project = KonanProject.createWithInterop(projectDirectory) { KonanProject it ->
it.defFiles.first().write("headers = stdio.h\nheaderFilter = stdio.h")
}
def results = buildTwice(project) { KonanProject it ->
it.addSetting(KonanProject.DEFAULT_INTEROP_NAME, "headerFilterAdditionalSearchPrefix", "'.'")
}
then:
recompilationAndInteropProcessingHappened(*results)
}
def 'defFile change for an interop task should cause recompilation and interop reprocessing'() {
when:
def project = KonanProject.createWithInterop(projectDirectory, ArtifactType.LIBRARY)
@@ -34,6 +34,22 @@ class TaskSpecification extends BaseKonanSpecification {
result.output.findAll(~/BACKEND:\s+\d+\s+msec/).size() == 1
}
def 'Plugin should support headerFilterAdditionalSearchPrefix option for cinterop'() {
expect:
def project = KonanProject.createEmpty(projectDirectory) { KonanProject it ->
it.addCompilerArtifact("interopLib", "headers=foo.h\nheaderFilter=foo.h bar.h", ArtifactType.INTEROP)
it.generateSrcFile(it.projectPath, "foo.h", "#include <bar.h>")
def fooDir = it.projectPath.resolve("foo")
it.generateSrcFile(fooDir, "bar.h", "const int foo = 5;")
it.addSetting("interopLib", "headerFilterAdditionalSearchPrefix", fooDir.toFile())
it.addSetting("interopLib", "headerFilterAdditionalSearchPrefix", it.projectDir)
}
project.createRunner().withArguments("build").build()
def wrong_path = project.createFile("wrong_path", "")
project.addSetting("interopLib", "headerFilterAdditionalSearchPrefix", wrong_path)
project.createRunner().withArguments("build").buildAndFail()
}
BuildResult failOnPropertyAccess(KonanProject project, String property) {
project.buildFile.append("""
task testTask(type: DefaultTask) {