@@ -39,7 +39,7 @@ func projectTmpDir(t *testing.T, name string) string {
3939
4040func TestBuildToolParams_TestConfig (t * testing.T ) {
4141 // Create a temp test fixture with test-config.json
42- dir := t . TempDir ( )
42+ dir := projectTmpDir ( t , "test-config" )
4343 testDir := filepath .Join (dir , "tools" , "my_tool" , "my_test" )
4444 os .MkdirAll (filepath .Join (testDir , "before" ), 0o755 )
4545 os .MkdirAll (filepath .Join (testDir , "after" ), 0o755 )
@@ -56,7 +56,7 @@ func TestBuildToolParams_TestConfig(t *testing.T) {
5656}
5757
5858func TestBuildToolParams_MonitoringStateParams (t * testing.T ) {
59- dir := t . TempDir ( )
59+ dir := projectTmpDir ( t , "monitoring-state" )
6060 testDir := filepath .Join (dir , "tools" , "codeql_lsp_completion" , "basic" )
6161 os .MkdirAll (filepath .Join (testDir , "before" ), 0o755 )
6262 os .MkdirAll (filepath .Join (testDir , "after" ), 0o755 )
@@ -77,7 +77,7 @@ func TestBuildToolParams_MonitoringStateParams(t *testing.T) {
7777}
7878
7979func TestBuildToolParams_ValidateCodeqlQuery (t * testing.T ) {
80- dir := t . TempDir ( )
80+ dir := projectTmpDir ( t , "validate-query" )
8181 testDir := filepath .Join (dir , "tools" , "validate_codeql_query" , "syntax_validation" )
8282 os .MkdirAll (filepath .Join (testDir , "before" ), 0o755 )
8383 os .MkdirAll (filepath .Join (testDir , "after" ), 0o755 )
@@ -97,7 +97,7 @@ func TestBuildToolParams_ValidateCodeqlQuery(t *testing.T) {
9797}
9898
9999func TestBuildToolParams_ResolveQueries_UsesDirectoryKey (t * testing.T ) {
100- dir := t . TempDir ( )
100+ dir := projectTmpDir ( t , "resolve-queries" )
101101 testDir := filepath .Join (dir , "tools" , "codeql_resolve_queries" , "resolve_queries" )
102102 os .MkdirAll (filepath .Join (testDir , "before" ), 0o755 )
103103 os .MkdirAll (filepath .Join (testDir , "after" ), 0o755 )
@@ -116,7 +116,7 @@ func TestBuildToolParams_ResolveQueries_UsesDirectoryKey(t *testing.T) {
116116}
117117
118118func TestBuildToolParams_ResolveLanguages (t * testing.T ) {
119- dir := t . TempDir ( )
119+ dir := projectTmpDir ( t , "resolve-languages" )
120120 testDir := filepath .Join (dir , "tools" , "codeql_resolve_languages" , "list_languages" )
121121 os .MkdirAll (filepath .Join (testDir , "before" ), 0o755 )
122122 os .MkdirAll (filepath .Join (testDir , "after" ), 0o755 )
@@ -134,7 +134,7 @@ func TestBuildToolParams_ResolveLanguages(t *testing.T) {
134134}
135135
136136func TestBuildToolParams_UnknownTool (t * testing.T ) {
137- dir := t . TempDir ( )
137+ dir := projectTmpDir ( t , "unknown-tool" )
138138 testDir := filepath .Join (dir , "tools" , "unknown_tool_xyz" , "test1" )
139139 os .MkdirAll (filepath .Join (testDir , "before" ), 0o755 )
140140 os .MkdirAll (filepath .Join (testDir , "after" ), 0o755 )
@@ -148,7 +148,7 @@ func TestBuildToolParams_UnknownTool(t *testing.T) {
148148}
149149
150150func TestFindFilesByExt (t * testing.T ) {
151- dir := t . TempDir ( )
151+ dir := projectTmpDir ( t , "find-files" )
152152 os .WriteFile (filepath .Join (dir , "a.ql" ), []byte ("" ), 0o600 )
153153 os .WriteFile (filepath .Join (dir , "b.ql" ), []byte ("" ), 0o600 )
154154 os .WriteFile (filepath .Join (dir , "c.txt" ), []byte ("" ), 0o600 )
@@ -189,7 +189,7 @@ func TestIsSARIFTool(t *testing.T) {
189189}
190190
191191func TestBuildToolParams_SARIFToolWithConfig (t * testing.T ) {
192- dir := t . TempDir ( )
192+ dir := projectTmpDir ( t , "sarif-tool-config" )
193193 testDir := filepath .Join (dir , "tools" , "sarif_extract_rule" , "extract_sql_injection" )
194194 beforeDir := filepath .Join (testDir , "before" )
195195 os .MkdirAll (beforeDir , 0o755 )
@@ -221,7 +221,7 @@ func TestBuildToolParams_SARIFToolWithConfig(t *testing.T) {
221221}
222222
223223func TestBuildToolParams_SARIFCompareAlertsWithConfig (t * testing.T ) {
224- dir := t . TempDir ( )
224+ dir := projectTmpDir ( t , "sarif-compare-alerts" )
225225 testDir := filepath .Join (dir , "tools" , "sarif_compare_alerts" , "sink_overlap" )
226226 beforeDir := filepath .Join (testDir , "before" )
227227 os .MkdirAll (beforeDir , 0o755 )
0 commit comments