Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
3.3 KiB

  1. rem this will run all tests once
  2. Dim Classy
  3. Set fso = CreateObject("Scripting.FileSystemObject")
  4. Set a = fso.CreateTextFile("filter.log", True)
  5. Set Locator = CreateObject("WbemScripting.SWbemLocator")
  6. ' Note that Locator.ConnectServer can be used to connect to remote computers
  7. Set Service = Locator.ConnectServer(, "root\cimv2")
  8. Service.Security_.ImpersonationLevel=3
  9. sub DumpAndList(Name)
  10. a.WriteLine(Name)
  11. Set Collection = Service.InstancesOf (Name)
  12. Err.Clear
  13. for each Instance in Collection
  14. if Err.Number = 0 Then
  15. Set ObjectPath = Instance.Path_
  16. a.WriteLine(" " & ObjectPath.Path)
  17. ' WRite out properties too
  18. REM Now try to get object by relpath
  19. Set Instance2 = Service.Get(ObjectPath.Path)
  20. Set ObjectPath2 = Instance2.Path_
  21. a.WriteLine(" ** " & ObjectPath2.Path)
  22. End If
  23. next 'Instance
  24. a.WriteLine("")
  25. end sub
  26. sub DumpAllCdmClasses(BaseName)
  27. Classy = BaseName & "_DiagResult"
  28. DumpAndList(Classy)
  29. Classy = BaseName & "_DiagResultForMSE"
  30. DumpAndList(Classy)
  31. Classy = BaseName & "_DiagResultForTest"
  32. DumpAndList(Classy)
  33. end sub
  34. sub ClearAndRunTest(BaseName, SystemElement, SettingRef)
  35. Dim Collection
  36. Dim InstancePaths()
  37. Dim InstanceCount
  38. Dim ResultRef
  39. Set Collection = Service.InstancesOf (BaseName & "_DiagTest")
  40. InstanceCount = 0
  41. Err.Clear
  42. for each Instance in Collection
  43. if Err.Number = 0 Then
  44. InstanceCount = InstanceCount + 1
  45. ReDim Preserve InstancePaths(InstanceCount)
  46. Set ObjectPath = Instance.Path_
  47. InstancePaths(InstanceCount) = ObjectPath.Path
  48. End If
  49. next 'Instance
  50. if InstanceCount = 0 Then
  51. MsgBox "No instances available for this class"
  52. Else
  53. CurrentInstanceIndex = 1
  54. End if
  55. Err.Clear
  56. Set Instance = Service.Get(InstancePaths(CurrentInstanceIndex))
  57. if Err.Number = 0 Then
  58. RetVal = Instance.RunTest (SystemElement, SettingRef, ResultRef)
  59. if Err.Number = 0 Then
  60. a.Writeline(BaseName & " Run Test Method Execution Succeeded -> " & RetVal)
  61. a.Writeline(" " & ResultRef)
  62. Set Instance2 = Service.Get(ResultRef)
  63. Set ObjectPath2 = Instance2.Path_
  64. a.WriteLine(" ** " & ObjectPath2.Path)
  65. Else
  66. a.Writeline(BaseName & " Run Test Method Execution Failed " & Err.Description)
  67. End if
  68. End if
  69. end sub
  70. a.WriteLine("Before running methods")
  71. DumpAllCdmClasses("Printer_Filter")
  72. DumpAllCdmClasses("Sample_Filter")
  73. DumpAllCdmClasses("Sample_Offline")
  74. a1 = "Printer_Filter"
  75. b1 = "Win32_Keyboard.DeviceID=""ROOT\\*PNP030B\\1_0_22_0_32_0"""
  76. c1 = a1 & "_DiagSetting.SettingID=""" & a1 & "_DiagTest_0_2"""
  77. ClearAndRunTest a1, b1, c1
  78. a1 = "Sample_Filter"
  79. b1 = "Win32_USBController.DeviceID=""PCI\\VEN_8086&DEV_7112&SUBSYS_00000000&REV_01\\2&EBB567F&0&3A"""
  80. c1 = a1 & "_DiagSetting.SettingID=""" & a1 & "_DiagTest_0_2"""
  81. ClearAndRunTest a1, b1, c1
  82. a1 = "Sample_Offline"
  83. b1 = "Win32_USBController.DeviceID=""PCI\\VEN_8086&DEV_7112&SUBSYS_00000000&REV_01\\2&EBB567F&0&3A"""
  84. c1 = a1 & "_DiagSetting.SettingID=""" & a1 & "_DiagTest_0_2"""
  85. ClearAndRunTest a1, b1, c1
  86. a.WriteLine("After running methods")
  87. DumpAllCdmClasses("Printer_Filter")
  88. DumpAllCdmClasses("Sample_Filter")
  89. DumpAllCdmClasses("Sample_Offline")