Source code of Windows XP (NT5)
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.

77 lines
2.5 KiB

  1. rem this test will run offline test
  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 ClearAndRunTest(BaseName, SystemElement, SettingRef)
  10. Dim Collection
  11. Dim InstancePaths()
  12. Dim InstanceCount
  13. Dim ResultRef
  14. Set Collection = Service.InstancesOf (BaseName & "_DiagTest")
  15. InstanceCount = 0
  16. Err.Clear
  17. for each Instance in Collection
  18. if Err.Number = 0 Then
  19. InstanceCount = InstanceCount + 1
  20. ReDim Preserve InstancePaths(InstanceCount)
  21. Set ObjectPath = Instance.Path_
  22. InstancePaths(InstanceCount) = ObjectPath.Path
  23. End If
  24. next 'Instance
  25. if InstanceCount = 0 Then
  26. MsgBox "No instances available for this class"
  27. Else
  28. CurrentInstanceIndex = 1
  29. End if
  30. Err.Clear
  31. Set Instance = Service.Get(InstancePaths(CurrentInstanceIndex))
  32. if Err.Number = 0 Then
  33. rem don't clear
  34. ' Err.Clear
  35. ' RetVal = Instance.ClearResults(SystemElement, NotCleared)
  36. ' if Err.Number = 0 Then
  37. ' a.Writeline(BaseName & " Clear Results Method Execution Succeeded -> " & RetVal & " " & NotCleared)
  38. ' Else
  39. ' a.Writeline(BaseName & " Clear Result Method Execution Failed " & Err.Description)
  40. ' end if
  41. '
  42. RetVal = Instance.RunTest (SystemElement, SettingRef, ResultRef)
  43. if Err.Number = 0 Then
  44. a.Writeline(BaseName & " Run Test Method Execution Succeeded -> " & RetVal)
  45. a.Writeline(" " & ResultRef)
  46. Set Instance2 = Service.Get(ResultRef)
  47. Set ObjectPath2 = Instance2.Path_
  48. a.WriteLine(" ** " & ObjectPath2.Path)
  49. Set Instance3 = Service.Get(ResultRef)
  50. Set ObjectPath3 = Instance3.Path_
  51. a.WriteLine(" *3 " & ObjectPath3.Path)
  52. Set Instance4 = Service.Get(ResultRef)
  53. Set ObjectPath4 = Instance4.Path_
  54. a.WriteLine(" *4 " & ObjectPath4.Path)
  55. Else
  56. a.Writeline(BaseName & " Run Test Method Execution Failed " & Err.Description)
  57. End if
  58. End if
  59. end sub
  60. a1 = "Sample_Offline"
  61. b1 = "Win32_USBController.DeviceID=""PCI\\VEN_8086&DEV_7112&SUBSYS_00000000&REV_01\\2&EBB567F&0&3A"""
  62. c1 = a1 & "_DiagSetting.SettingID=""" & a1 & "_DiagTest_0_2"""
  63. ClearAndRunTest a1, b1, c1