Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ private const val MAX_TEST_COUNT_PER_SMALL_SHARD = 15
*/
fun main(args: Array<String>) {
if (args.size < 4) {
println(
"Usage: bazel run //scripts:compute_affected_tests --" +
" <path_to_directory_root> <path_to_output_file> <merge_base_commit>" +
" <compute_all_tests=true/false>"
)
exitProcess(1)
printUsageAndExit()
}

val pathToRoot = args[0]
Expand All @@ -68,6 +63,15 @@ fun main(args: Array<String>) {
}
}

private fun printUsageAndExit(): Nothing {
println(
"Usage: bazel run //scripts:compute_affected_tests --" +
" <path_to_directory_root> <path_to_output_file> <merge_base_commit>" +
" <compute_all_tests=true/false>"
)
exitProcess(1)
}

// Needed since the codebase isn't yet using Kotlin 1.5, so this function isn't available.
private fun String.toBooleanStrictOrNull(): Boolean? {
return when (lowercase(Locale.US)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ private const val MAX_FILE_COUNT_PER_SMALL_SHARD = 15
*/
fun main(args: Array<String>) {
if (args.size < 4) {
println(
"Usage: bazel run //scripts:compute_changed_files --" +
" <path_to_directory_root> <path_to_output_file> <merge_base_commit>" +
" <compute_all_files=true/false>"
)
exitProcess(1)
printUsageAndExit()
}

val pathToRoot = args[0]
Expand All @@ -69,6 +64,15 @@ fun main(args: Array<String>) {
}
}

private fun printUsageAndExit(): Nothing {
println(
"Usage: bazel run //scripts:compute_changed_files --" +
" <path_to_directory_root> <path_to_output_file> <merge_base_commit>" +
" <compute_all_files=true/false>"
)
exitProcess(1)
}

/** Utility used to compute changed files. */
class ComputeChangedFiles(
private val scriptBgDispatcher: ScriptBackgroundCoroutineDispatcher,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ import kotlin.system.exitProcess
*/
fun main(args: Array<String>) {
if (args.size < 3) {
println(
"Usage: bazel run //scripts:retrieve_affected_tests --" +
" <encoded_proto_in_base64> <path_to_bucket_name_output_file>" +
" <path_to_test_target_list_output_file>"
)
exitProcess(1)
printUsageAndExit()
}

val protoBase64 = args[0]
Expand All @@ -48,3 +43,12 @@ fun main(args: Array<String>) {
writer.println(affectedTestsBucket.affectedTestTargetsList.joinToString(separator = " "))
}
}

private fun printUsageAndExit(): Nothing {
println(
"Usage: bazel run //scripts:retrieve_affected_tests --" +
" <encoded_proto_in_base64> <path_to_bucket_name_output_file>" +
" <path_to_test_target_list_output_file>"
)
exitProcess(1)
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ import kotlin.system.exitProcess
*/
fun main(args: Array<String>) {
if (args.size < 5) {
println(
"Usage: bazel run //scripts:retrieve_changed_files --" +
" <encoded_proto_in_base64> <path_to_bucket_name_output_file>" +
" <path_to_file_list_output_file> <path_to_test_target_list_output_file>"
)
exitProcess(1)
printUsageAndExit()
}

val repoRoot = args[0]
Expand Down Expand Up @@ -118,6 +113,15 @@ private fun findTestFile(rootDirectory: File, filePath: String): List<String> {
.map { it.toRelativeString(rootDirectory) }
}

private fun printUsageAndExit(): Nothing {
println(
"Usage: bazel run //scripts:retrieve_changed_files --" +
" <encoded_proto_in_base64> <path_to_bucket_name_output_file>" +
" <path_to_file_list_output_file> <path_to_test_target_list_output_file>"
)
exitProcess(1)
}

private fun loadTestFileExemptionsProto(testFileExemptiontextProto: String): TestFileExemptions {
return File("$testFileExemptiontextProto.pb").inputStream().use { stream ->
TestFileExemptions.newBuilder().also { builder ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,10 @@ class DataProviderTestMonitor<T> private constructor(
// Waiting for a result is the same as ensuring the conditions are right for the provider to
// execute (since it must return a result if it's executed, even if it's pending).
val monitor = createMonitor(dataProvider)
monitor.waitForNextResult().also {
monitor.stopObservingDataProvider()
}.also {
// There must be an actual result for the provider to be successful.
assertThat(it).isNotPending()
}
val result = monitor.waitForNextResult()
monitor.stopObservingDataProvider()
// There must be an actual result for the provider to be successful.
assertThat(result).isNotPending()
}

/**
Expand Down
Loading