fix: Windows compatibility and flaky benchmark test

- Use cmd.exe /c to execute .bat/.cmd on Windows
- Set USERPROFILE alongside HOME for os.UserHomeDir()
- Use setTempDirEnv to set TEMP/TMP on Windows
- Replace chmod-based tests with cross-platform alternatives
- Fix concurrent speedup benchmark with fair comparison
- Add output/ to gitignore

Generated with SWE-Agent.ai

Co-Authored-By: SWE-Agent.ai <noreply@swe-agent.ai>
This commit is contained in:
cexll
2026-01-26 21:29:54 +08:00
parent c96193fca6
commit 2c0553794a
10 changed files with 65 additions and 78 deletions

View File

@@ -36,10 +36,8 @@ func TestEnvInjectionWithAgent(t *testing.T) {
t.Fatal(err)
}
// Override HOME to use temp dir
oldHome := os.Getenv("HOME")
os.Setenv("HOME", tmpDir)
defer os.Setenv("HOME", oldHome)
t.Setenv("HOME", tmpDir)
t.Setenv("USERPROFILE", tmpDir)
// Reset config cache
config.ResetModelsConfigCacheForTest()
@@ -104,9 +102,8 @@ func TestEnvInjectionLogic(t *testing.T) {
t.Fatal(err)
}
oldHome := os.Getenv("HOME")
os.Setenv("HOME", tmpDir)
defer os.Setenv("HOME", oldHome)
t.Setenv("HOME", tmpDir)
t.Setenv("USERPROFILE", tmpDir)
config.ResetModelsConfigCacheForTest()
defer config.ResetModelsConfigCacheForTest()