Skip to content

Commit

Permalink
[Backend] Hook up core functionality to logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Helios747 committed Aug 31, 2017
1 parent dfaf5b8 commit ed7f54d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
15 changes: 14 additions & 1 deletion DolphinBisectTool/Backend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ public void Bisect(string boot_title = "")
string base_url = "https://dl.dolphin-emu.org/builds/dolphin-master-";
int test_index = 0;
int test_direction = 0;
List<String> skipped_builds = new List<string>();
RunBuild run_build = new RunBuild();
Logger log = new Logger();

while (!(m_first_index == m_second_index-1))
while (!(m_first_index == m_second_index - 1))
{

test_index = m_first_index == -1 ? (0 + m_second_index) / 2 : (m_first_index + m_second_index) / 2;
Expand All @@ -55,10 +57,13 @@ public void Bisect(string boot_title = "")
try
{
Download(base_url + m_build_list[test_index] + "-x64.7z", m_build_list[test_index]);
log.Write("Testing build " + m_build_list[test_index]);
break;
}
catch (Exception e)
{
log.Write("ERROR. Skipping build " + m_build_list[test_index]);
skipped_builds.Add(m_build_list[test_index]);
BisectError(e.Message);
if (test_direction == 0)
--test_index;
Expand All @@ -77,18 +82,26 @@ public void Bisect(string boot_title = "")

if (return_val == UserInput.Yes)
{
log.Write("Build " + m_build_list[test_index] + " marked as a BAD build");
m_first_index = test_index;
test_direction = 1;
}
else if (return_val == UserInput.No)
{
log.Write("Build " + m_build_list[test_index] + " marked as a GOOD build");
m_second_index = test_index;
test_direction = 0;
}
else
return;
}

log.Write("Bisect completed. " + m_build_list[test_index] + " may be the culprit.");
if (!(skipped_builds.Count == 0))
{
string sb = string.Join(", ", skipped_builds.ToArray());
log.Write("Skipped builds: " + sb);
}
UserInput open_url = BisectEvent(test_index, true);

if (open_url == UserInput.Yes)
Expand Down
9 changes: 8 additions & 1 deletion DolphinBisectTool/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ public Logger()

~Logger()
{
log_file.Close();
// TODO - figure out why closing the file here throws an exception.
try
{
log_file.Close();
}
catch (Exception e)
{
}
}

public void Write(string s)
Expand Down

0 comments on commit ed7f54d

Please sign in to comment.