Skip to content

Commit 3a7a748

Browse files
committed
Log installed packages
We sometimes see errors in tools that are run in part of tests. It would be nice to understand what the exact versions being tested/used were, so we can try and reproduce the error.
1 parent 177b405 commit 3a7a748

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Turkey/TestRunner.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,27 @@ private static void LogEnvironment(string logDir)
178178

179179
string unameOutput = ProcessRunner.Run("uname", "-a");
180180
File.WriteAllText(Path.Combine(logDir, "uname"), unameOutput);
181+
182+
try
183+
{
184+
string installedPackages = ProcessRunner.Run("rpm", "--query", "--all");
185+
File.WriteAllText(Path.Combine(logDir, "packages"), installedPackages);
186+
}
187+
catch (InvalidOperationException e)
188+
{
189+
string error = e.Message
190+
try
191+
{
192+
string installedPackages = ProcessRunner.Run("apk", "list", "--installed");
193+
File.WriteAllText(Path.Combine(logDir, "packages"), installedPackages);
194+
}
195+
catch (InvalidOperationException e)
196+
{
197+
error = error + Environment.NewLine + e.Message;
198+
string installedPackages = "could not find installed packages" + Environment.NewLine + error;
199+
File.WriteAllText(Path.Combine(logDir, "packages"), installedpackages);
200+
}
201+
}
181202
}
182203
}
183204
}

0 commit comments

Comments
 (0)