Fix bisect script run and level validators

This commit is contained in:
Joe Tretter
2026-06-26 19:00:51 -05:00
parent caaf26a541
commit d703f539d3
5 changed files with 79 additions and 4 deletions

View File

@@ -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() }