Skip to content

Commit

Permalink
Merge pull request #33 from jmquigs/ci-update
Browse files Browse the repository at this point in the history
Ci update
  • Loading branch information
jmquigs committed Mar 21, 2023
2 parents 396976d + 8333910 commit bbcdc2d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Native/hook_core/src/hook_device_d3d11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1085,9 +1085,17 @@ mod tests {
assert_eq!(res, 0);
}

let assert_log = |expected_count:usize,msg:&str| {
let logtext = std::fs::read_to_string(testlog).unwrap();
let count = logtext.matches(msg).count();
if count != expected_count {
eprintln!("logtext: {}", logtext);
}
assert_eq!(count, expected_count);
};

// log file should contain stuff
let logtext = std::fs::read_to_string(testlog).unwrap();
assert_eq!(1, logtext.matches("hook_device_QueryInterface: hr 0").count());
assert_log(1, "hook_device_QueryInterface: hr 0");

unsafe {
(*device).Release();
Expand All @@ -1097,8 +1105,7 @@ mod tests {
}

// context should release
let logtext = std::fs::read_to_string(testlog).unwrap();
assert_eq!(1, logtext.matches("context hook release: rc now 0").count());
assert_log(1, "context hook release: rc now 0");

// if a new device is created things should not explode or go into
// weird infinite loops or otherwise be bad.
Expand All @@ -1115,8 +1122,7 @@ mod tests {
&mut context);

// log should note that we already did this
let logtext = std::fs::read_to_string(testlog).unwrap();
assert_eq!(1, logtext.matches("WARNING: device state was already initialized").count());
assert_log(1, "WARNING: device state was already initialized");

// query interface on device should succeed
let mut pdev:*mut ID3D11Device = null_mut();
Expand All @@ -1132,8 +1138,7 @@ mod tests {
}

// context should release. 2 because we did it twice
let logtext = std::fs::read_to_string(testlog).unwrap();
assert_eq!(2, logtext.matches("context hook release: rc now 0").count());
assert_log(2, "context hook release: rc now 0");

unsafe {
let _unbox = Box::from_raw(DEVICE_STATE);
Expand Down
8 changes: 8 additions & 0 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,14 @@ let doCISetup() =
printfn "fsharp targets: %A" fsharpFiles
| None -> failwithf "no vs path found, searched %A" VSSearchPaths

// put the current directory into the registry as the MMRoot
// let cu = Microsoft.Win32.RegistryHive.CurrentUser
// let mmRoot = "SOFTWARE\\ModelMod"
printfn "set registry key HKEY_CURRENT_USER\\SOFTWARE\\ModelMod\\MMRoot to %s" (System.IO.Directory.GetCurrentDirectory())
Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER\\SOFTWARE\\ModelMod", "MMRoot", System.IO.Directory.GetCurrentDirectory())
// if not (Directory.Exists("Logs")) then
// Directory.CreateDirectory("Logs") |> ignore

printfn "action setup complete"

let getVSPath() =
Expand Down

0 comments on commit bbcdc2d

Please sign in to comment.