diff --git a/CLAUDE.md b/CLAUDE.md index 2e14c3f..85db8b1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -71,10 +71,8 @@ cp FSharp.Core.4.4.3.0/FSharp.Core.dll Debug/ cd Debug && mono /path/to/nunit3-console.exe Test.MMManaged.dll ``` -Known: 6 tests fail on linux regardless of the change under test (TestMesh, TestMeshTransform -x2, TestModDB, TestModDBInterop, TestYaml). They all die in `Util.TestDataDir`'s static -constructor, which searches windows-style relative paths for TestData. Compare against a -master build before assuming a failure is yours. +All tests pass on linux. `State.reloadSnapshotProfiles` logs an error about a missing +`TestData/SnapshotProfiles` dir during the interop test; that is expected and not a failure. ## Interop notes diff --git a/Test.MMManaged/TestMesh.fs b/Test.MMManaged/TestMesh.fs index 23be289..339c597 100644 --- a/Test.MMManaged/TestMesh.fs +++ b/Test.MMManaged/TestMesh.fs @@ -7,7 +7,7 @@ open ModelMod open ModelMod.CoreTypes let monolith = - let mpath = Path.Combine(Util.TestDataDir,"monolithref.mmobj") + let mpath = Path.Combine(Util.TestDataDir,"MonolithRef.mmobj") MeshUtil.readFrom(mpath,CoreTypes.GPUReplacement,CoreTypes.DefaultReadFlags) open MonoGameHelpers diff --git a/Test.MMManaged/TestMeshTransform.fs b/Test.MMManaged/TestMeshTransform.fs index 6b795f8..ffcbcba 100644 --- a/Test.MMManaged/TestMeshTransform.fs +++ b/Test.MMManaged/TestMeshTransform.fs @@ -10,7 +10,7 @@ open ModelMod.CoreTypes let vecEq = Util.veqEqEpsilon 0.000001f let monolith = - let mpath = Path.Combine(Util.TestDataDir,"monolithref.mmobj") + let mpath = Path.Combine(Util.TestDataDir,"MonolithRef.mmobj") MeshUtil.readFrom(mpath,CoreTypes.GPUReplacement,CoreTypes.DefaultReadFlags) [] diff --git a/Test.MMManaged/Util.fs b/Test.MMManaged/Util.fs index 99c4043..2758e3e 100644 --- a/Test.MMManaged/Util.fs +++ b/Test.MMManaged/Util.fs @@ -12,22 +12,18 @@ let veqEqEpsilon (ep:float32) (v1:Vec3F) (v2:Vec3F) = let dz = Math.Abs(v1.Z - v2.Z) dx < ep && dy < ep && dz < ep -let TestDataDir = - let asmPath = Assembly.GetExecutingAssembly().CodeBase.Replace("file:///","") - - let paths = [ @"..\..\TestData"; @"..\TestData"; "@\..\..\..\..\..\TestData" ] - - let paths = paths |> List.map (fun p -> Path.GetFullPath(Path.Combine(asmPath,p))) - - let found = - paths |> List.tryPick (fun p -> - if Directory.Exists p then - Some(p) - else - None - ) - - match found with - | None -> failwithf "Failed to locate test data directory, searched: %A" paths +let TestDataDir = + // walk up from the assembly dir looking for TestData; the output layout differs between the + // VS and dotnet builds. avoid literal path separators, they aren't portable. + let asmDir = Path.GetDirectoryName(Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath) + + let rec search (dir:DirectoryInfo) levels = + if isNull (box dir) || levels = 0 then + None + else + let cand = Path.Combine(dir.FullName, "TestData") + if Directory.Exists cand then Some(cand) else search dir.Parent (levels-1) + + match search (DirectoryInfo(asmDir)) 6 with + | None -> failwithf "Failed to locate test data directory at or above: %s" asmDir | Some path -> path - \ No newline at end of file