@@ -147,20 +147,17 @@ func TestMain(m *testing.M) {
147147
148148 // Initialize resource registry if any profiling flag is active.
149149 if * flagResourceProfile || * flagResourceRecord || * flagResourceCheck {
150- // Resolve profile directory relative to repo root (go test runs from
151- // the package directory, not where go test was invoked).
152150 pkgDir , _ := os .Getwd ()
153151 profileDir := filepath .Join (pkgDir , ".." , ".." , "coverage" , "test-profiles" )
154152 if _ , err := os .Stat (filepath .Join (pkgDir , ".." , ".." , "go.mod" )); err != nil {
155- // Fallback: use CWD as-is if we can't find go.mod
156153 profileDir = "coverage/test-profiles"
157154 }
158155 testRegistry = testresourceregistry .New (profileDir , 2 , 4 , 500 )
159156 fmt .Fprintf (os .Stderr , "Info: resource profiling enabled (dir=%s, profile=%v record=%v check=%v)\n " ,
160157 profileDir , * flagResourceProfile , * flagResourceRecord , * flagResourceCheck )
161158 }
162159
163- // 1. Try the committed source project
160+ // 1. Try the committed source project (fast path).
164161 srcDir , err := filepath .Abs (sourceProject )
165162 if err == nil {
166163 if _ , err := os .Stat (filepath .Join (srcDir , sourceProjectMPR )); err == nil {
@@ -171,10 +168,24 @@ func TestMain(m *testing.M) {
171168 }
172169 }
173170
174- // 2. Create a project once using mx create-project
171+ // 2. Fallback: use testdata/helpdesk-clean-11.10.0 (fast, no mx create-project).
172+ // This is a blank 11.10.0 project with Atlas Core pre-installed.
173+ pkgDir , err := os .Getwd ()
174+ if err == nil {
175+ candidate := filepath .Join (pkgDir , ".." , ".." , "testdata" , "helpdesk-clean-11.10.0" )
176+ if _ , err := os .Stat (filepath .Join (candidate , "minimal.mpr" )); err == nil {
177+ sharedSourceProject = candidate
178+ sharedSourceMPR = "minimal.mpr"
179+ fmt .Fprintf (os .Stderr , "Info: using helpdesk-clean-11.10.0 as shared source project\n " )
180+ sharedProjectGraph = buildSharedGraph (filepath .Join (sharedSourceProject , sharedSourceMPR ))
181+ os .Exit (m .Run ())
182+ }
183+ }
184+
185+ // 3. Last resort: create a project via mx create-project.
175186 mxPath := findMxBinary ()
176187 if mxPath == "" {
177- fmt .Fprintln (os .Stderr , "SKIP: mx binary not available and source project not found at" , sourceProject )
188+ fmt .Fprintln (os .Stderr , "SKIP: mx binary not available and no source project found" )
178189 os .Exit (0 )
179190 }
180191
0 commit comments