env: find llgo root for development

This commit is contained in:
Li Jie
2025-01-18 12:33:54 +08:00
parent 521b70c715
commit cabc7ffca8
5 changed files with 48 additions and 9 deletions

View File

@@ -58,8 +58,10 @@ func TestLLGoRuntimeDir(t *testing.T) {
defer os.Setenv("LLGO_ROOT", origLLGoRoot)
os.Setenv("LLGO_ROOT", "/nonexistent/path")
if got := LLGoRuntimeDir(); got != "" {
t.Errorf("LLGoRuntimeDir() = %v, want empty string", got)
wd, _ := os.Getwd()
expected, _ := filepath.Abs(filepath.Join(wd, "../../../runtime"))
if got := LLGoRuntimeDir(); got != expected {
t.Errorf("LLGoRuntimeDir() = %v, want %v", got, expected)
}
})
}