Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Test.MMManaged/TestMesh.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Test.MMManaged/TestMeshTransform.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

[<Test>]
Expand Down
32 changes: 14 additions & 18 deletions Test.MMManaged/Util.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Loading