From d7eefa8066b8e2ac70e0a4080c52bce20da24a23 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Thu, 22 Aug 2024 00:10:26 +0200 Subject: samba: Add docker server run by tests Current user needs to be in docker group (or in some other way have access to the docker.socket) for this to work. Two current problems: * listRoot() fails, no directories are found. * gradle hangs after running the samba tests --- libs/samba/build.gradle.kts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'libs/samba/build.gradle.kts') diff --git a/libs/samba/build.gradle.kts b/libs/samba/build.gradle.kts index 2fc5007..b7816c4 100644 --- a/libs/samba/build.gradle.kts +++ b/libs/samba/build.gradle.kts @@ -1,7 +1,12 @@ +import org.gradle.api.tasks.testing.logging.TestExceptionFormat + plugins { alias(libs.plugins.android.library) } +val shareDir = layout.buildDirectory.dir("test-share") +val dockerDir = layout.projectDirectory.dir("src/test/docker") + android { namespace = "org.the_jk.cleversync.samba" @@ -19,6 +24,24 @@ android { externalNativeBuild { cmake { cFlags += listOf("-O3") } } } } + + testOptions { + unitTests { + all { test -> + test.doFirst { + shareDir.get().asFile.mkdirs() + } + + test.systemProperty("dockerDir", dockerDir.toString()) + test.systemProperty("shareDir", shareDir.get().toString()) + + test.testLogging { + showStandardStreams = true + exceptionFormat = TestExceptionFormat.FULL + } + } + } + } } dependencies { @@ -26,7 +49,7 @@ dependencies { } listOf("Debug", "Release").forEach { buildType -> - val buildDir = project.layout.buildDirectory.dir("test/debug/build") + val buildDir = project.layout.buildDirectory.dir("test-cpp/debug/build") val configure by tasks.register( "configureLibsFor${buildType}UnitTest", -- cgit v1.2.3-70-g09d2