static void Main(string[] args)
    {
        String DeviceQuery = "IsDevice";

        //
        //  Process args
        //


        if (args.Length < 1)
        {
            Console.WriteLine(" No Params\n");
        }
        else
        {
            String Param = args[0].ToString().ToUpper(new CultureInfo("en-US", false));

            switch (Param)
            {
            case "/DQ:":
                DeviceQuery = args[1].ToString();
                break;
            }
        }



        //
        //   Create WDTF Object
        //

        IWDTF2 WDTF = new WDTF2Class();

        //
        //  Query for devices.
        //

        IWDTFTargets2 Devices = WDTF.DeviceDepot.Query(DeviceQuery);

        //
        //  Get Simple I/O tests for all devices that have them.
        //

        IWDTFSimpleIOStressActions2 SimpleIoStressCollection = (IWDTFSimpleIOStressActions2)Devices.GetInterfacesIfExist("SimpleIOStressEx");

        //
        //  Start test case
        //

        WDTF.Log.StartTestCase("Start Simple I/O");

        //
        //  Start all I/O tests
        //

        if (SimpleIoStressCollection.Count > 0)
        {
            SimpleIoStressCollection.Start();
            SimpleIoStressCollection.Stop();
        }

        //
        //  End test case.
        //

        WDTF.Log.EndTestCase();
    }
Esempio n. 2
0
    static void Main(string[] args)
    {
        String DeviceQuery = "IsDevice";

        //
        //  Process args
        //


        if (args.Length < 1)
        {
            Console.WriteLine(" No Params\n");
        }
        else
        {
            String Param = args[0].ToString().ToUpper(new CultureInfo("en-US", false));

            switch (Param)
            {
            case "/DQ:":
                DeviceQuery = args[1].ToString();;
                break;
            }
        }



        //
        //   Create WDTF Object
        //

        IWDTF2 WDTF = new WDTF2Class();

        //
        //  Query for devices.
        //

        IWDTFTargets2 Devices = WDTF.DeviceDepot.Query(DeviceQuery);

        //
        //  Get Simple I/O tests for all devices that have them.
        //

        IWDTFActions2 Actions = Devices.GetInterfacesIfExist("SimpleIOEx");

        //
        //  Start test case
        //

        WDTF.Log.StartTestCase("Start Simple I/O");

        //
        //  Do a litle bit of device testing.
        //

        foreach (IWDTFSimpleIOEx2 SimpleIoEx in Actions)
        {
            SimpleIoEx.Open();
            SimpleIoEx.PerformIO();
            SimpleIoEx.Close();
        }

        //
        //  End test case.
        //

        WDTF.Log.EndTestCase();
    }
Esempio n. 3
0
    static void Main(string[] args)
    {
        String DeviceQuery = "IsDevice";

        //
        //  Process args
        //


        if (args.Length < 1)
        {
            Console.WriteLine(" No Params\n");
        }
        else
        {
            String Param = args[0].ToString().ToUpper(new CultureInfo("en-US", false));

            switch (Param)
            {
            case "/DQ:":
                DeviceQuery = args[1].ToString();;
                break;
            }
        }



        //
        //   Create WDTF Object
        //

        IWDTF2 WDTF = new WDTF2Class();

        //
        //  Query for devices.
        //

        IWDTFTargets2 Devices = WDTF.DeviceDepot.Query(DeviceQuery);

        //
        //  Return if query didn't return any devices
        //

        if (Devices.Count == 0)
        {
            return;
        }


        //
        //  Get EDT interface
        //

        IWDTFEnhancedDeviceTestSupportActions2 Edt = (IWDTFEnhancedDeviceTestSupportActions2)Devices.GetInterfacesIfExist("EDT");


        //
        //  Enable EDT support
        //

        Edt.Enable();

        //
        //  Start test case
        //

        WDTF.Log.StartTestCase(" Perfrom PNP Surpise remove");


        //
        //  Get PNP interface
        //

        IWDTFPNPActions2 Pnp = (IWDTFPNPActions2)Devices.GetInterfacesIfExist("PNP");


        //
        //  Perfrom PNP Surpise remove
        //


        Pnp.EDTSurpriseRemoveDevice();
        Pnp.RestartDevice();


        //
        //  End test case.
        //

        WDTF.Log.EndTestCase();
    }
Esempio n. 4
0
        public void Driver()
        {
            //
            // Get the Absolute Driver Package Path string.
            //

            if (m_testContext.Properties["AbsoluteDriverPackagePath"] == null)
            {
                //
                //  Required parameter not supplied. Log an error and quit.
                //

                Log.Error(" The Driver Package Installation was not given the path to the Driver Package");

                return;
            }
            else
            {
                //
                //  Save Absolute Driver Package Path
                //
                //  As this test is initiated from the VS/WDK developer system but
                //  executed on the test system we need to expand any environment variable in
                //  the path also.
                //

                m_sAbsoluteDriverPackagePath =
                    Environment.ExpandEnvironmentVariables(m_testContext.Properties["AbsoluteDriverPackagePath"].ToString());
            }


            //
            //  Init WDTF
            //

            IWDTF2 WDTF = new WDTF2Class();
            IWDTFDriverSetupSystemAction2 SystemDriverSetup = (IWDTFDriverSetupSystemAction2)WDTF.SystemDepot.ThisSystem.GetInterface("DriverSetup");
            IWDTFSystemAction2            System            = (IWDTFSystemAction2)WDTF.SystemDepot.ThisSystem.GetInterface("System");
            IWDTFTargets2 Devices;


            //
            //  Init Driver Package Class
            //

            WDTF.Log.StartTestCase("Init Driver Package");

            WDTFDriverPackage2 DriverPackage = new WDTFDriverPackage2Class();

            DriverPackage.SetPackageInfFileName(m_sAbsoluteDriverPackagePath);

            //
            //  See if we started because of a reboot
            //

            if (System.IsRestarted)
            {
                //
                //  We have restarted lets see if the driver package installed on any device
                //  If not we have failed.
                //

                Devices = WDTF.DeviceDepot.Query(DriverPackage.GetQueryForDeviceUsingPackage());

                if (Devices.Count == 0)
                {
                    WDTF.Log.OutputError(" Failed to install the driver package on any device ");
                }

                //
                // Driver package installed onto device , verify it started
                //

                foreach (IWDTFTarget2 Device in Devices)
                {
                    if (Device.Eval("ProblemCode!=0"))
                    {
                        WDTF.Log.OutputError("Driver package installed onto device but driver failed to start");
                        WDTF.Log.OutputInfo("Device:     " + Device.GetValue("UniqueTargetName"));
                        WDTF.Log.OutputInfo("Status:     " + Device.GetValue("DeviceStatusString"));
                    }
                }

                SystemDriverSetup.SnapTriageLogs();
                WDTF.Log.EndTestCase();
                return;
            }

            //
            //  Output some INF info
            //

            WDTF.Log.OutputInfo(" INF Info");
            WDTF.Log.OutputInfo("   Class: " + DriverPackage.ClassName);
            WDTF.Log.OutputInfo("   Provider: " + DriverPackage.Provider);
            WDTF.Log.OutputInfo("   Version: " + DriverPackage.Version);
            WDTF.Log.OutputInfo("   Date: " + DriverPackage.Date);
            WDTF.Log.OutputInfo("   CatalogFile: " + DriverPackage.CatalogFile);
            WDTF.Log.OutputInfo("   HasCatalog: " + DriverPackage.HasCatalog.ToString());
            WDTF.Log.OutputInfo("   IsImported: " + DriverPackage.IsImported.ToString());
            WDTF.Log.OutputInfo("   DigitalSigner: " + DriverPackage.DigitalSigner);
            WDTF.Log.OutputInfo("   IsDigitalSigned: " + DriverPackage.IsDigitalSigned.ToString());
            WDTF.Log.OutputInfo("   IsDigitalSignerTrusted: " + DriverPackage.IsDigitalSignerTrusted.ToString());

            //
            //  Determine if the system has a device that the package can be
            //  installed on to.
            //

            Devices = WDTF.DeviceDepot.Query(DriverPackage.GetQueryForDeviceThatCanUsePackage());

            if (Devices.Count == 0)
            {
                WDTF.Log.OutputError(" System has no device the driver package can  be installed onto.");
                return;
            }

            Devices = null;

            WDTF.Log.EndTestCase();

            //
            //  Import driver package
            //

            WDTF.Log.StartTestCase("Import  Driver Package");

            SystemDriverSetup.ClearTriageLogs();

            SystemDriverSetup.ImportDriverPackage(DriverPackage);

            WDTF.Log.EndTestCase();

            //
            //  Install driver package onto device
            //

            WDTF.Log.StartTestCase("Install driver package onto device");

            Devices = WDTF.DeviceDepot.Query(DriverPackage.GetQueryForDeviceThatCanUsePackage());


            IWDTFActions2 DeviceDriverSetupActions = DeviceDriverSetupActions = Devices.GetInterfaces("DriverSetup");
            bool          bRebootRequired          = false;

            foreach (IWDTFDriverSetupAction2 DeviceDriverSetup in DeviceDriverSetupActions)
            {
                if (DeviceDriverSetup.UpdateDriver(DriverPackage))
                {
                    bRebootRequired = true;
                }
            }


            if (bRebootRequired == false)
            {
                Devices = WDTF.DeviceDepot.Query(DriverPackage.GetQueryForDeviceUsingPackage());

                if (Devices.Count == 0)
                {
                    WDTF.Log.OutputError(" Failed to install driver package on any device ");
                }

                //
                // Driver package installed onto device , verify it started
                //

                foreach (IWDTFTarget2 Device in Devices)
                {
                    if (Device.Eval("ProblemCode!=0"))
                    {
                        WDTF.Log.OutputError("Driver package installed onto device but driver failed to start");
                        WDTF.Log.OutputInfo("Device:     " + Device.GetValue("UniqueTargetName"));
                        WDTF.Log.OutputInfo("Status:     " + Device.GetValue("DeviceStatusString"));
                    }
                }

                SystemDriverSetup.SnapTriageLogs();
                WDTF.Log.EndTestCase();
                return;
            }
            else
            {
                //
                //  Update driver indecated we need reboot
                //

                WDTF.Log.EndTestCase();
                System.RebootRestart();
                return;
            }
        }