Fix bisect script run and level validators
This commit is contained in:
@@ -504,6 +504,37 @@ class GitSandboxEngineTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun nativeBisectRunScriptShortcutRunsThroughShell() {
|
||||
val git = testGitBinary()
|
||||
assumeTrue(git.exists() && git.canExecute())
|
||||
val root = Files.createTempDirectory("githug-bisect-run-script").toFile()
|
||||
try {
|
||||
val runtime = GitRepositoryRuntime(root, git)
|
||||
val level = bisectLevel()
|
||||
var repo = runtime.prepareLevel(level)
|
||||
|
||||
listOf(
|
||||
"git bisect start",
|
||||
"git bisect bad HEAD",
|
||||
"git bisect good known-good",
|
||||
).forEach { command ->
|
||||
val (nextRepo, _) = runtime.execute(level, repo, command)
|
||||
repo = nextRepo
|
||||
}
|
||||
|
||||
val (_, output) = runtime.execute(level, repo, "git bisect run ./test-balance.sh")
|
||||
val text = output.joinToString("\n")
|
||||
|
||||
assertFalse(text, text.contains("Permission denied", ignoreCase = true))
|
||||
assertFalse(text, text.contains("can't execute", ignoreCase = true))
|
||||
assertFalse(text, text.contains("bogus exit code", ignoreCase = true))
|
||||
assertTrue(text, text.contains("first bad commit", ignoreCase = true))
|
||||
} finally {
|
||||
root.deleteRecursively()
|
||||
}
|
||||
}
|
||||
|
||||
private fun testGitBinary(): File {
|
||||
System.getenv("GITHUG_TEST_GIT_BINARY")
|
||||
?.takeIf { it.isNotBlank() }
|
||||
|
||||
Reference in New Issue
Block a user