Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. #!/usr/bin/rdmd
  2.  
  3. import std.stdio;
  4. import std.string;
  5. import std.conv;
  6.  
  7. void main(string[] args)
  8. {
  9. string[] records;
  10. bool inRecord;
  11. bool failedRecord;
  12. string testname;
  13. string[] failedTests;
  14.  
  15. foreach(line; File(args[1]).byLine)
  16. {
  17. records ~= to!string(line);
  18.  
  19. if (line == "================================================================================")
  20. {
  21. if (inRecord)
  22. {
  23. inRecord = false;
  24. // Print lines of failed Test
  25. if (failedRecord)
  26. {
  27. if (testname != "")
  28. failedTests ~= testname;
  29.  
  30. testname = "";
  31. foreach(record; records)
  32. {
  33. writeln(record);
  34. }
  35. }
  36.  
  37. // Reset and continue processing next record
  38. records = [];
  39. failedRecord = false;
  40. continue;
  41. }
  42.  
  43. if (!inRecord)
  44. {
  45. inRecord = true;
  46. continue;
  47. }
  48. }
  49.  
  50. if (line.startsWith("Result: FAIL"))
  51. {
  52. failedRecord = true;
  53. }
  54.  
  55. if (line.startsWith("/usr/share/glusterfs/tests/") && line.stripRight.endsWith(" .."))
  56. {
  57. testname = to!string(line.replace(" ..", ""));
  58. }
  59.  
  60. }
  61. stderr.writeln("Failed test files:");
  62. stderr.writeln(failedTests.join("\n"));
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement