diff --git a/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt b/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt index df024d6..c69a706 100644 --- a/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt +++ b/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt @@ -96,19 +96,27 @@ fun stopAllEmulators( args: Commands.Stop, connectedEmulators: () -> Single> = ::connectedEmulators, completableProcess: (List, Pair?) -> Completable = ::completableProcess -) = connectedEmulators() - .map { emulators -> - emulators.map { emulator -> - completableProcess( - listOf(adb, "-s", emulator.id, "emu", "kill"), - args.timeoutSeconds to SECONDS - ) +) { + val startTime = System.nanoTime() + + connectedEmulators() + .map { emulators -> + log("Stopping running emulators: $emulators.") + emulators.map { emulator -> + completableProcess( + listOf(adb, "-s", emulator.id, "emu", "kill"), + args.timeoutSeconds to SECONDS + ) + .doOnCompleted { log("Stopped emulator $emulator.") } + } } - } - .flatMapCompletable(Completable::merge) - .doOnError { log("Error during all emulators stop, error = $it") } - .doOnCompleted { log("All emulators stopped") } - .await() + .flatMapCompletable(Completable::merge) + .doOnError { log("Error during stopping emulators, error = $it.") } + .doOnCompleted { log("All emulators stopped.") } + .await() + + log("Swarmer: - \"My job is done here, took ${(System.nanoTime() - startTime).nanosAsSeconds()} seconds, bye bye.\"") +} private fun completableProcess(args: List, timeout: Pair?) = process(args, timeout) diff --git a/swarmer/src/test/kotlin/com/gojuno/swarmer/ArgsSpec.kt b/swarmer/src/test/kotlin/com/gojuno/swarmer/ArgsSpec.kt index b1c921a..c8c7498 100644 --- a/swarmer/src/test/kotlin/com/gojuno/swarmer/ArgsSpec.kt +++ b/swarmer/src/test/kotlin/com/gojuno/swarmer/ArgsSpec.kt @@ -2,7 +2,6 @@ package com.gojuno.swarmer import org.assertj.core.api.Assertions.assertThat import org.jetbrains.spek.api.Spek -import org.jetbrains.spek.api.dsl.SpecBody import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.dsl.on @@ -31,21 +30,6 @@ class ArgsSpec : Spek({ } } - fun SpecBody.onEmulatorNameVariants() { - listOf("a", "b").forEach { - // evaluateBody(it) - if (it == "a") { - it("is a") { - - } - } else { - it("is b") { - - } - } - } - } - on("parse multiple args") { val result by memoized {